载入中...
搜索中...
未找到
SoundData.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Resource.h"
4
5#include <cstddef>
6#include <cstdint>
7#include <vector>
8
9namespace eve {
10namespace sound {
11
13class SoundData : public Resource {
14public:
16 SoundData(std::vector<uint8_t> pcm, int sampleRate, int bitDepth, int channels);
17 ~SoundData() override;
18
20 void adopt(eve::Resource &replacement) override;
21
23 int getSampleCount() const;
24 int getSampleRate() const;
25 int getBitDepth() const;
26 int getChannelCount() const;
28 double getDuration() const;
30 void *getData() const;
31 size_t getSize() const;
32
33private:
34 std::vector<uint8_t> pcm;
35 int sampleRate = 0;
36 int bitDepth = 0;
37 int channels = 0;
38};
39
40} // namespace sound
41} // namespace eve
Resource is a game object that is managed by the ResourceManager. It can be loaded from a file or gen...
Definition Resource.h:35
Raw PCM audio buffer with format metadata (samples/rate/bit depth/channels).
Definition SoundData.h:13
double getDuration() const
Duration in seconds.
Definition SoundData.cpp:40
void * getData() const
Raw PCM access.
Definition SoundData.cpp:46
void adopt(eve::Resource &replacement) override
Replace this buffer with replacement's (cache reload).
Definition SoundData.cpp:22
int getBitDepth() const
Definition SoundData.cpp:37
int getChannelCount() const
Definition SoundData.cpp:38
int getSampleRate() const
Definition SoundData.cpp:36
int getSampleCount() const
Format metadata.
Definition SoundData.cpp:30
size_t getSize() const
Definition SoundData.cpp:47
Definition Build.cpp:11