dl
dl
system
dl_audio_loader.h
浏览该文件的文档.
1
12
#pragma once
13
14
#ifndef DL_DISABLE_AUDIO
15
#include <string>
16
#include "
memory/dl_buffer.h
"
17
18
namespace
dl
19
{
20
21
class
AudioLoader
22
{
23
public
:
24
struct
PCM
25
{
26
int
_numChannel
;
//通道数 1,2 AL_FORMAT_MONO8,AL_FORMAT_STEREO8
27
int
_bitPerSample
;
//采样数 8,16
28
Buffer
_buf
;
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
36
~AudioLoader
();
37
};
38
39
//16字节
40
struct
WAVEFormat
41
{
42
int16_t
audioFormat
;
43
int16_t
numChannels
;
44
int32_t
sampleRate
;
45
int32_t
byteRate
;
46
int16_t
blockAlign
;
47
int16_t
bitsPerSample
;
48
};
49
50
}
51
52
#endif
dl::AudioLoader
定义
dl_audio_loader.h:22
dl::AudioLoader::ReadWav
static bool ReadWav(std::string_view path_name, PCM &pcm)
dl::AudioLoader::ReadMp3
static bool ReadMp3(std::string_view path_name, PCM &pcm)
dl::AudioLoader::ReadFlac
static bool ReadFlac(std::string_view path_name, PCM &pcm)
dl::AudioLoader::~AudioLoader
~AudioLoader()
dl::AudioLoader::ReadOgg
static bool ReadOgg(std::string_view path_name, PCM &pcm)
dl_buffer.h
表示一段内存
dl
定义
dl_array2.h:18
dl::Buffer
std::vector< std::byte > Buffer
定义
dl_buffer.h:21
dl::AudioLoader::PCM
定义
dl_audio_loader.h:25
dl::AudioLoader::PCM::_bitPerSample
int _bitPerSample
定义
dl_audio_loader.h:27
dl::AudioLoader::PCM::_numChannel
int _numChannel
定义
dl_audio_loader.h:26
dl::AudioLoader::PCM::_buf
Buffer _buf
定义
dl_audio_loader.h:28
dl::AudioLoader::PCM::_freq
size_t _freq
定义
dl_audio_loader.h:29
dl::WAVEFormat
定义
dl_audio_loader.h:41
dl::WAVEFormat::sampleRate
int32_t sampleRate
定义
dl_audio_loader.h:44
dl::WAVEFormat::bitsPerSample
int16_t bitsPerSample
定义
dl_audio_loader.h:47
dl::WAVEFormat::numChannels
int16_t numChannels
定义
dl_audio_loader.h:43
dl::WAVEFormat::byteRate
int32_t byteRate
定义
dl_audio_loader.h:45
dl::WAVEFormat::audioFormat
int16_t audioFormat
定义
dl_audio_loader.h:42
dl::WAVEFormat::blockAlign
int16_t blockAlign
定义
dl_audio_loader.h:46
制作者
1.13.1