From 066e5987c515dfc34537d73ca9d2a81ddd1f9e1b Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 21 Oct 2018 13:37:27 +0800 Subject: =?UTF-8?q?*=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Audio/SDL/je_sdl_audio.h | 83 ++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 5 deletions(-) (limited to 'src/libjin/Audio/SDL/je_sdl_audio.h') diff --git a/src/libjin/Audio/SDL/je_sdl_audio.h b/src/libjin/Audio/SDL/je_sdl_audio.h index 01da7b3..b13dc10 100644 --- a/src/libjin/Audio/SDL/je_sdl_audio.h +++ b/src/libjin/Audio/SDL/je_sdl_audio.h @@ -18,9 +18,15 @@ namespace JinEngine #define SDLAUDIO_BYTEDEPTH (SDLAUDIO_BITDEPTH >> 3) #define SDLAUDIO_CHANNELS 2 + /// + /// Audio system SDL implementation. + /// class SDLAudio : public AudioManager { public: + /// + /// SDL audio setting. + /// struct Setting : SettingBase { public: @@ -28,29 +34,95 @@ namespace JinEngine int samples; // »º³åÇøµÄsampleÊý£¬<=samplerate }; - /* IAudio interface */ + /// + /// Play all sources whose state is playing. + /// void play() override; + + /// + /// Stop and remove all sources from the queue. + /// void stop() override; + + /// + /// Pause audio. + /// void pause() override; + + /// + /// Resume audio. + /// void resume() override; + + /// + /// Set global audio volume. + /// void setVolume(float volume) override; - /* process functions*/ + + /// + /// Process all commands in the queue. + /// void processCommands(); + + /// + /// Process all sources. + /// + /// @param buffer Source buffer. + /// @param len Source length. + /// void processSources(void* buffer, size_t len); + + /// + /// Process audio buffer. + /// + /// @param buffer Audio stream buffer. + /// @param len Length of stream buffer. + /// void processBuffer(void* buffer, size_t len); + + /// + /// Goon process. + /// + /// @return True if sucessful, otherwise return false. + /// bool goOnProcess(); - /* thread-safe */ + + /// + /// Lock audio device. + /// void lock(); + + /// + /// Unlock audio device. + /// void unlock(); private: singleton(SDLAudio); + + /// + /// SDL audio constructor. + /// SDLAudio() {}; + + /// + /// SDL audio destructor. + /// ~SDLAudio() {}; - /* subsystem interface */ + + /// + /// Initialize audio system. + /// + /// @param setting Audio setting. + /// bool initSystem(const SettingBase* setting) override; + + /// + /// Quit audio system. + /// void quitSystem() override; + // Audio device id. unsigned int audioDevice; }; @@ -59,4 +131,5 @@ namespace JinEngine } // namespace JinEngine #endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO -#endif // __JE_AUDIO_SDL_H + +#endif // __JE_AUDIO_SDL_H \ No newline at end of file -- cgit v1.1-26-g67d0