diff options
author | chai <chaifix@163.com> | 2018-10-20 16:18:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-20 16:18:11 +0800 |
commit | cf68d9f46da1cf20503a7d738da1f43de916004d (patch) | |
tree | 5577e44d926deadb15ef5ca145e705eae14636fe /src/lua/modules/audio/source.cpp | |
parent | e9410bd371fc68169c57d2c52382948a0b083da4 (diff) |
*格式化代码
Diffstat (limited to 'src/lua/modules/audio/source.cpp')
-rw-r--r-- | src/lua/modules/audio/source.cpp | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/src/lua/modules/audio/source.cpp b/src/lua/modules/audio/source.cpp index a001f92..e5b7953 100644 --- a/src/lua/modules/audio/source.cpp +++ b/src/lua/modules/audio/source.cpp @@ -3,114 +3,114 @@ #include "lua/common/common.h" #include "lua/modules/types.h" -namespace jin +namespace JinEngine { -namespace lua -{ - - using namespace JinEngine::Audio; - - typedef Ref<Source>& SourceRef; - - static inline SourceRef checkSource(lua_State* L) + namespace Lua { - Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE); - return proxy->getRef<Source>(); - } - static int l_play(lua_State* L) - { - SourceRef ref = checkSource(L); - ref->play(); - return 0; - } - - static int l_stop(lua_State* L) - { - SourceRef ref = checkSource(L); - ref->stop(); - return 0; - } - - static int l_pause(lua_State* L) - { - SourceRef ref = checkSource(L); - ref->pause(); - return 0; - } - - static int l_rewind(lua_State* L) - { - SourceRef ref = checkSource(L); - ref->rewind(); - return 0; - } - - static int l_resume(lua_State* L) - { - SourceRef ref = checkSource(L); - ref->resume(); - return 0; - } - - static int l_isStop(lua_State* L) - { - SourceRef ref = checkSource(L); - bool isStop = ref->isStopped(); - luax_pushboolean(L, isStop); - return 1; - } - - static int l_isPaused(lua_State* L) - { - SourceRef ref = checkSource(L); - bool isPaused = ref->isPaused(); - luax_pushboolean(L, isPaused); - return 1; - } - - static int l_setVolume(lua_State* L) - { - SourceRef ref = checkSource(L); - float volume = luax_checknumber(L, 2); - ref->setVolume(volume); - return 0; - } - - static int l_setLoop(lua_State* L) - { - SourceRef ref = checkSource(L); - bool loop = luax_checkbool(L, 2); - ref->setLoop(loop); - return 0; - } - - static int l_gc(lua_State* L) - { - Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE); - proxy->release(); - return 0; - } - - static const luaL_Reg f[] = { - { "__gc", l_gc }, - { "play", l_play }, - { "stop", l_stop }, - { "pause", l_pause }, - { "resume", l_resume }, - { "rewind", l_rewind }, - { "isStop", l_isStop }, - { "isPaused", l_isPaused }, - { "setVolume", l_setVolume }, - { "setLoop", l_setLoop }, - { 0, 0 } - }; + using namespace JinEngine::Audio; + + typedef Ref<Source>& SourceRef; + + static inline SourceRef checkSource(lua_State* L) + { + Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE); + return proxy->getRef<Source>(); + } + + static int l_play(lua_State* L) + { + SourceRef ref = checkSource(L); + ref->play(); + return 0; + } + + static int l_stop(lua_State* L) + { + SourceRef ref = checkSource(L); + ref->stop(); + return 0; + } + + static int l_pause(lua_State* L) + { + SourceRef ref = checkSource(L); + ref->pause(); + return 0; + } + + static int l_rewind(lua_State* L) + { + SourceRef ref = checkSource(L); + ref->rewind(); + return 0; + } + + static int l_resume(lua_State* L) + { + SourceRef ref = checkSource(L); + ref->resume(); + return 0; + } + + static int l_isStop(lua_State* L) + { + SourceRef ref = checkSource(L); + bool isStop = ref->isStopped(); + luax_pushboolean(L, isStop); + return 1; + } + + static int l_isPaused(lua_State* L) + { + SourceRef ref = checkSource(L); + bool isPaused = ref->isPaused(); + luax_pushboolean(L, isPaused); + return 1; + } + + static int l_setVolume(lua_State* L) + { + SourceRef ref = checkSource(L); + float volume = luax_checknumber(L, 2); + ref->setVolume(volume); + return 0; + } + + static int l_setLoop(lua_State* L) + { + SourceRef ref = checkSource(L); + bool loop = luax_checkbool(L, 2); + ref->setLoop(loop); + return 0; + } + + static int l_gc(lua_State* L) + { + Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE); + proxy->release(); + return 0; + } + + static const luaL_Reg f[] = { + { "__gc", l_gc }, + { "play", l_play }, + { "stop", l_stop }, + { "pause", l_pause }, + { "resume", l_resume }, + { "rewind", l_rewind }, + { "isStop", l_isStop }, + { "isPaused", l_isPaused }, + { "setVolume", l_setVolume }, + { "setLoop", l_setLoop }, + { 0, 0 } + }; - int luaopen_Source(lua_State* L) - { - luax_newtype(L, JIN_AUDIO_SOURCE, f); - return 0; - } - -} // lua -} // jin
\ No newline at end of file + int luaopen_Source(lua_State* L) + { + luax_newtype(L, JIN_AUDIO_SOURCE, f); + return 0; + } + + } // Lua +} // JinEngine
\ No newline at end of file |