diff options
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 |