diff options
author | chai <chaifix@163.com> | 2018-05-23 08:26:48 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-05-23 08:26:48 +0800 |
commit | 6cc59854d349a02263a5d27810fb824a9f4d1fde (patch) | |
tree | 6603725cdf07ca1ee3c3ce27b75619a8fa436c88 /src/libjin/audio/sdl/source.h | |
parent | 904e78d568bae0afe87d20cb412bdce38d550c1a (diff) |
更新音频模块
Diffstat (limited to 'src/libjin/audio/sdl/source.h')
-rw-r--r-- | src/libjin/audio/sdl/source.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/libjin/audio/sdl/source.h b/src/libjin/audio/sdl/source.h index 0c8e938..682ff50 100644 --- a/src/libjin/audio/sdl/source.h +++ b/src/libjin/audio/sdl/source.h @@ -1,6 +1,10 @@ #ifndef __JIN_SOURCE_SDL_H #define __JIN_SOURCE_SDL_H +#include <vector> +#include <queue> +#include <stack> + #include "3rdparty/wav/wav.h" #define STB_VORBIS_HEADER_ONLY #include "3rdparty/stb/stb_vorbis.c" @@ -37,9 +41,14 @@ namespace audio bool setLoop(bool loop) override; void setRate(float rate) override; + /* process function */ + static void processCommand(); + static void processSource(); + static void removeSource(SDLSource* source); + private: - typedef struct Command + struct Command { typedef enum Action { @@ -50,16 +59,34 @@ namespace audio Resume, Rewind, SetVolume, + SetLoop, + SetRate, }; Action action; union { int _integer; + float _float; bool _boolean; const char* _string; - } parameter; + }; + SDLSource* source; }; - Command command; + static std::queue<Command*> commands; + static std::stack<Command*> commandsPool; + static Command* getCommand(); + static void collectCommand(Command* cmd); + + static std::vector<SDLSource*> sources; + + void* data; + void* pos; + int length; + int pitch; + bool paused; + bool playing; + bool stopped; + }; } |