diff options
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; + }; } |