diff options
Diffstat (limited to 'engines/sword25/sfx')
-rw-r--r-- | engines/sword25/sfx/soundengine.cpp | 6 | ||||
-rw-r--r-- | engines/sword25/sfx/soundengine.h | 2 | ||||
-rw-r--r-- | engines/sword25/sfx/soundengine_script.cpp | 80 |
3 files changed, 42 insertions, 46 deletions
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index c753afd9b9..fa39639f51 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -67,10 +67,6 @@ SoundEngine::SoundEngine(Kernel *pKernel) : ResourceService(pKernel) { _handles[i].type = kFreeHandle; } -Service *SoundEngine_CreateObject(Kernel *pKernel) { - return new SoundEngine(pKernel); -} - bool SoundEngine::init(uint sampleRate, uint channels) { warning("STUB: SoundEngine::init(%d, %d)", sampleRate, channels); @@ -157,7 +153,7 @@ bool SoundEngine::playSound(const Common::String &fileName, SOUND_TYPES type, fl } uint SoundEngine::playSoundEx(const Common::String &fileName, SOUND_TYPES type, float volume, float pan, bool loop, int loopStart, int loopEnd, uint layer) { - Common::SeekableReadStream *in = Kernel::GetInstance()->GetPackage()->getStream(fileName); + Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(fileName); Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(in, DisposeAfterUse::YES); uint id; SndHandle *handle = getHandle(&id); diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h index 81383b12cb..b8c10cc293 100644 --- a/engines/sword25/sfx/soundengine.h +++ b/engines/sword25/sfx/soundengine.h @@ -88,7 +88,7 @@ public: typedef void (*DynamicSoundReadCallback)(void *UserData, void *Data, uint DataLength); SoundEngine(Kernel *pKernel); - ~SoundEngine() {}; + ~SoundEngine() {} /** * Initialises the sound engine diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp index 2808296799..eabbef6e5e 100644 --- a/engines/sword25/sfx/soundengine_script.cpp +++ b/engines/sword25/sfx/soundengine_script.cpp @@ -46,9 +46,9 @@ namespace Sword25 { static int init(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); if (lua_gettop(L) == 0) @@ -62,9 +62,9 @@ static int init(lua_State *L) { } static int update(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->update(); @@ -73,9 +73,9 @@ static int update(lua_State *L) { } static int setVolume(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->setVolume(static_cast<float>(luaL_checknumber(L, 1)), @@ -85,9 +85,9 @@ static int setVolume(lua_State *L) { } static int getVolume(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1))))); @@ -96,9 +96,9 @@ static int getVolume(lua_State *L) { } static int pauseAll(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->pauseAll(); @@ -107,9 +107,9 @@ static int pauseAll(lua_State *L) { } static int resumeAll(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->resumeAll(); @@ -118,9 +118,9 @@ static int resumeAll(lua_State *L) { } static int pauseLayer(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->pauseLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -129,9 +129,9 @@ static int pauseLayer(lua_State *L) { } static int resumeLayer(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->resumeLayer(static_cast<int>(luaL_checknumber(L, 1))); @@ -176,9 +176,9 @@ static void processPlayParams(lua_State *L, Common::String &fileName, SoundEngin } static int playSound(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); Common::String fileName; @@ -197,9 +197,9 @@ static int playSound(lua_State *L) { } static int playSoundEx(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); Common::String fileName; @@ -218,9 +218,9 @@ static int playSoundEx(lua_State *L) { } static int setSoundVolume(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->setSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -229,9 +229,9 @@ static int setSoundVolume(lua_State *L) { } static int setSoundPanning(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->setSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); @@ -240,9 +240,9 @@ static int setSoundPanning(lua_State *L) { } static int pauseSound(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->pauseSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -251,9 +251,9 @@ static int pauseSound(lua_State *L) { } static int resumeSound(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->resumeSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -262,9 +262,9 @@ static int resumeSound(lua_State *L) { } static int stopSound(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); pSfx->stopSound(static_cast<uint>(luaL_checknumber(L, 1))); @@ -273,9 +273,9 @@ static int stopSound(lua_State *L) { } static int isSoundPaused(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->isSoundPaused(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -284,9 +284,9 @@ static int isSoundPaused(lua_State *L) { } static int isSoundPlaying(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); lua_pushbooleancpp(L, pSfx->isSoundPlaying(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -295,9 +295,9 @@ static int isSoundPlaying(lua_State *L) { } static int getSoundVolume(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -306,9 +306,9 @@ static int getSoundVolume(lua_State *L) { } static int getSoundPanning(lua_State *L) { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); + SoundEngine *pSfx = pKernel->getSfx(); BS_ASSERT(pSfx); lua_pushnumber(L, pSfx->getSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)))); @@ -349,9 +349,9 @@ static const lua_constant_reg SFX_CONSTANTS[] = { }; bool SoundEngine::registerScriptBindings() { - Kernel *pKernel = Kernel::GetInstance(); + Kernel *pKernel = Kernel::getInstance(); BS_ASSERT(pKernel); - ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); + ScriptEngine *pScript = pKernel->getScript(); BS_ASSERT(pScript); lua_State *L = static_cast<lua_State *>(pScript->getScriptObject()); BS_ASSERT(L); |