diff options
author | chai <chaifix@163.com> | 2018-08-14 14:56:47 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-14 14:56:47 +0800 |
commit | 5c9af043503f92852a1a765b6ecfbc1aea24d2e9 (patch) | |
tree | eb371092c4137a672e7bfc13dc56ee777623ebfe /src/lua/audio/Source.h | |
parent | 5162f84be0a4deb447c6ba1226722b049335d525 (diff) |
*update
Diffstat (limited to 'src/lua/audio/Source.h')
-rw-r--r-- | src/lua/audio/Source.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/lua/audio/Source.h b/src/lua/audio/Source.h new file mode 100644 index 0000000..094ad12 --- /dev/null +++ b/src/lua/audio/Source.h @@ -0,0 +1,93 @@ +#ifndef __JIN_LUA_AUDIO_SOURCE_H +#define __JIN_LUA_AUDIO_SOURCE_H +#include "libjin/jin.h" +#include "../luaopen_types.h" + +namespace jin +{ +namespace lua +{ +namespace audio +{ + + class Source : public Object + { + public: + void play() + { + source->play(); + } + + void stop() + { + source->stop(); + } + + void pause() + { + source->pause(); + } + + void resume() + { + source->resume(); + } + + void rewind() + { + source->rewind(); + } + + bool isStopped() const + { + return source->isStopped(); + } + + bool isPaused() const + { + return source->isPaused(); + } + + void setPitch(float pitch) + { + source->setPitch(pitch); + } + + void setVolume(float volume) + { + source->setVolume(volume); + } + + bool setLoop(bool loop) + { + return source->setLoop(loop); + } + + void setRate(float rate) + { + source->setRate(rate); + } + + inline static Source * createSource(void* mem, size_t size) + { + Source* src = new Source; + src->source = jin::audio::SDLSource::createSource(mem, size); + return src; + } + + private: + ~Source() + { + source->stop(); + delete source; + } + + jin::audio::SDLSource* source; + + }; + +} // audio +} // lua +} // jin + +#endif
\ No newline at end of file |