From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Audio/SDL/je_sdl_audio.h | 237 ++++++++++++++++++------------------ 1 file changed, 120 insertions(+), 117 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 57fee5b..77162d4 100644 --- a/src/libjin/Audio/SDL/je_sdl_audio.h +++ b/src/libjin/Audio/SDL/je_sdl_audio.h @@ -1,5 +1,5 @@ -#ifndef __JE_AUDIO_SDL_H -#define __JE_AUDIO_SDL_H +#ifndef __JE_AUDIO_SDL_H__ +#define __JE_AUDIO_SDL_H__ #include "../../core/je_configuration.h" #if defined(jin_audio) && (jin_audio == jin_audio_sdl) @@ -13,123 +13,126 @@ namespace JinEngine { namespace Audio { - - #define SDLAUDIO_BITDEPTH 16 - #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: - int samplerate; // 采样频率 - int samples; // 缓冲区的sample数,<=samplerate - }; - - /// - /// 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 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(); - - /// - /// Lock audio device. - /// - void lock(); - - /// - /// Unlock audio device. - /// - void unlock(); - - private: - singleton(SDLAudio); - - /// - /// SDL audio constructor. - /// - SDLAudio() {}; - - /// - /// SDL audio destructor. - /// - ~SDLAudio() {}; - - /// - /// 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; - - }; - + namespace SDL + { + +#define SDLAUDIO_BITDEPTH 16 +#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: + int samplerate; // 采样频率 + int samples; // 缓冲区的sample数,<=samplerate + }; + + /// + /// 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 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(); + + /// + /// Lock audio device. + /// + void lock(); + + /// + /// Unlock audio device. + /// + void unlock(); + + private: + singleton(SDLAudio); + + /// + /// SDL audio constructor. + /// + SDLAudio() {}; + + /// + /// SDL audio destructor. + /// + ~SDLAudio() {}; + + /// + /// 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; + + }; + + } // namespace SDL } // namespace Audio } // namespace JinEngine #endif // (jin_audio) && (jin_audio == jin_audio_sdl) -#endif // __JE_AUDIO_SDL_H \ No newline at end of file +#endif // __JE_AUDIO_SDL_H__ \ No newline at end of file -- cgit v1.1-26-g67d0