diff options
author | chai <chaifix@163.com> | 2018-11-18 23:31:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-18 23:31:17 +0800 |
commit | f0f340dec7821cee103ab9267ef941a917ef4dc4 (patch) | |
tree | 2f77f6ce6bdc9f63f002c13d4c261e1d6a9c1729 /src/libjin/audio/je_source.h | |
parent | fc7b4579e49aaeecc81919e247e03f68bd5abfd4 (diff) |
*目录改为小写
Diffstat (limited to 'src/libjin/audio/je_source.h')
-rw-r--r-- | src/libjin/audio/je_source.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/src/libjin/audio/je_source.h b/src/libjin/audio/je_source.h new file mode 100644 index 0000000..f60daf9 --- /dev/null +++ b/src/libjin/audio/je_source.h @@ -0,0 +1,116 @@ +#ifndef __JE_AUDIO_SOURCE_H__ +#define __JE_AUDIO_SOURCE_H__ +#include "../core/je_configuration.h" +#if defined(jin_audio) + +#include "SDL2/SDL.h" + +namespace JinEngine +{ + namespace Audio + { + + /// + /// Audio source encoding type. + /// + enum SourceType + { + INVALID = 0, + WAV, + OGG, + }; + + /// + /// Audio source. + /// + class Source + { + public: + /// + /// Source constructor. + /// + Source() {}; + + /// + /// Source destructor. + /// + virtual ~Source() {}; + + /// + /// Start playing source. + /// + virtual void play() = 0; + + /// + /// Stop playing source. + /// + virtual void stop() = 0; + + /// + /// Pause source. + /// + virtual void pause() = 0; + + /// + /// Resume source. + /// + virtual void resume() = 0; + + /// + /// Rewind source. + /// + virtual void rewind() = 0; + + /// + /// Whether the source is playing or not. + /// + virtual bool isStopped() const = 0; + + /// + /// Whether the source is paused or not. + /// + virtual bool isPaused() const = 0; + + /// + /// Set source pitch. + /// + /// @param pitch Pitch of source. + /// + virtual void setPitch(float pitch) = 0; + + /// + /// Set volume of source. + /// + /// @param volume Volume of source. + /// + virtual void setVolume(float volume) = 0; + + /// + /// Set source loop. + /// + /// @param loop Looping or not. + /// + virtual void setLoop(bool loop) = 0; + + /// + /// Set source rate. + /// + /// @param rate Rate of source. + /// + virtual void setRate(float rate) = 0; + + protected: + + /// + /// Get type of source data. + /// + static SourceType getType(const void* mem, int size); + + }; + + } // namespace Audio +} // namespace JinEngine + +#endif // jin_audio + +#endif // __JE_AUDIO_SOURCE_H__
\ No newline at end of file |