From 6cc59854d349a02263a5d27810fb824a9f4d1fde Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 23 May 2018 08:26:48 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=9F=B3=E9=A2=91=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/audio/sdl/source.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/libjin/audio/sdl/source.h') 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 +#include +#include + #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 commands; + static std::stack commandsPool; + static Command* getCommand(); + static void collectCommand(Command* cmd); + + static std::vector sources; + + void* data; + void* pos; + int length; + int pitch; + bool paused; + bool playing; + bool stopped; + }; } -- cgit v1.1-26-g67d0