dl
dl_audio_loader.h
浏览该文件的文档.
1
12#pragma once
13
14#ifndef DL_DISABLE_AUDIO
15#include <string>
16#include "memory/dl_buffer.h"
17
18namespace dl
19{
22{
23public:
24 struct PCM
25 {
26 int _numChannel;//通道数 1,2 AL_FORMAT_MONO8,AL_FORMAT_STEREO8
27 int _bitPerSample;//采样数 8,16
29 size_t _freq;//采样率
30 };
31 static bool ReadWav(std::string_view path_name, PCM& pcm);
32 static bool ReadOgg(std::string_view path_name, PCM& pcm);
33 static bool ReadFlac(std::string_view path_name, PCM& pcm);
34 static bool ReadMp3(std::string_view path_name, PCM& pcm);
35#if DL_PLATFORM == DL_PLATFORM_WIN32
36 static bool WriteOgg(std::string_view path_name, const PCM& pcm);
37#endif
39};
40
43{
44 int16_t audioFormat;
45 int16_t numChannels;
46 int32_t sampleRate;
47 int32_t byteRate;
48 int16_t blockAlign;
50};
51
52}
53
54#endif
音频文件解析器
static bool ReadWav(std::string_view path_name, PCM &pcm)
static bool ReadMp3(std::string_view path_name, PCM &pcm)
static bool ReadFlac(std::string_view path_name, PCM &pcm)
static bool WriteOgg(std::string_view path_name, const PCM &pcm)
static bool ReadOgg(std::string_view path_name, PCM &pcm)
表示一段内存
wav格式信息 16字节