diff options
Diffstat (limited to 'src/libjin/audio/sdl/source.h')
-rw-r--r-- | src/libjin/audio/sdl/source.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/libjin/audio/sdl/source.h b/src/libjin/audio/sdl/source.h index 365d6ff..ff311b6 100644 --- a/src/libjin/audio/sdl/source.h +++ b/src/libjin/audio/sdl/source.h @@ -14,6 +14,7 @@ namespace audio { typedef struct SDLSourceCommand; + class SDLSourceManager; class SDLSource : public Source { @@ -39,33 +40,33 @@ namespace audio bool setLoop(bool loop) override; void setRate(float rate) override; + inline void handle(SDLSourceManager* manager, SDLSourceCommand* cmd); + inline void process(void* buffer, size_t size); + private: SDLSource(); - friend class SDLSourceManager; - - void loadWAV(void* mem, int size); - void loadOGG(void* mem, int size); + void decode_wav(void* mem, int size); + void decode_ogg(void* mem, int size); inline bool is(int state) const { return (status.state & state) == state; } struct { const void* data; // Ƶ - int size; // dataֽڳ + int length; // dataֽڳ const void* end; // dataβ = (unsigned char*)data + size - int rate; // Ƶ + int samplerate; // Ƶ unsigned char bitdepth; // ÿsampleıس int samples; // sample = size / (bitdepth / 8) - unsigned char channel; // channel1(mono)2(stereo) - char silence; // 0 + unsigned char channels; // channel1(mono)2(stereo) } raw; /* Procedure controller variable */ struct { - int pos; // ǰŵλ + int pos; // ǰŵsample int pitch; // pitch int state; // ǰ״̬ bool loop; // loop or not @@ -85,10 +86,6 @@ namespace audio static void processCommands(); static void processSources(void* buffer, size_t size); - private: - - friend class SDLSource; - static void removeSource(SDLSource* source); static void pushSource(SDLSource* source); static SDLSourceCommand* getCommand(); |