diff options
Diffstat (limited to 'engines/sword25/sfx')
-rw-r--r-- | engines/sword25/sfx/soundengine.cpp | 90 | ||||
-rw-r--r-- | engines/sword25/sfx/soundengine.h | 47 | ||||
-rw-r--r-- | engines/sword25/sfx/soundengine_script.cpp | 198 |
3 files changed, 173 insertions, 162 deletions
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index f057a657c0..c753afd9b9 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -56,7 +56,7 @@ private: SoundEngine::SoundEngine(Kernel *pKernel) : ResourceService(pKernel) { - if (!_RegisterScriptBindings()) + if (!registerScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); else BS_LOGLN("Script bindings registered."); @@ -71,42 +71,42 @@ Service *SoundEngine_CreateObject(Kernel *pKernel) { return new SoundEngine(pKernel); } -bool SoundEngine::Init(uint sampleRate, uint channels) { - warning("STUB: SoundEngine::Init(%d, %d)", sampleRate, channels); +bool SoundEngine::init(uint sampleRate, uint channels) { + warning("STUB: SoundEngine::init(%d, %d)", sampleRate, channels); return true; } -void SoundEngine::Update() { +void SoundEngine::update() { } -void SoundEngine::SetVolume(float volume, SOUND_TYPES type) { - warning("STUB: SoundEngine::SetVolume(%f, %d)", volume, type); +void SoundEngine::setVolume(float volume, SOUND_TYPES type) { + warning("STUB: SoundEngine::setVolume(%f, %d)", volume, type); } -float SoundEngine::GetVolume(SOUND_TYPES type) { - warning("STUB: SoundEngine::GetVolume(%d)", type); +float SoundEngine::getVolume(SOUND_TYPES type) { + warning("STUB: SoundEngine::getVolume(%d)", type); return 0; } -void SoundEngine::PauseAll() { - debugC(1, kDebugSound, "SoundEngine::PauseAll()"); +void SoundEngine::pauseAll() { + debugC(1, kDebugSound, "SoundEngine::pauseAll()"); _mixer->pauseAll(true); } -void SoundEngine::ResumeAll() { - debugC(1, kDebugSound, "SoundEngine::ResumeAll()"); +void SoundEngine::resumeAll() { + debugC(1, kDebugSound, "SoundEngine::resumeAll()"); _mixer->pauseAll(false); } -void SoundEngine::PauseLayer(uint layer) { - warning("STUB: SoundEngine::PauseLayer(%d)", layer); +void SoundEngine::pauseLayer(uint layer) { + warning("STUB: SoundEngine::pauseLayer(%d)", layer); } -void SoundEngine::ResumeLayer(uint layer) { - warning("STUB: SoundEngine::ResumeLayer(%d)", layer); +void SoundEngine::resumeLayer(uint layer) { + warning("STUB: SoundEngine::resumeLayer(%d)", layer); } SndHandle *SoundEngine::getHandle(uint *id) { @@ -148,109 +148,109 @@ Audio::Mixer::SoundType getType(SoundEngine::SOUND_TYPES type) { return Audio::Mixer::kPlainSoundType; } -bool SoundEngine::PlaySound(const Common::String &fileName, SOUND_TYPES type, float volume, float pan, bool loop, int loopStart, int loopEnd, uint layer) { - debugC(1, kDebugSound, "SoundEngine::PlaySound(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer); +bool SoundEngine::playSound(const Common::String &fileName, SOUND_TYPES type, float volume, float pan, bool loop, int loopStart, int loopEnd, uint layer) { + debugC(1, kDebugSound, "SoundEngine::playSound(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer); - PlaySoundEx(fileName, type, volume, pan, loop, loopStart, loopEnd, layer); + playSoundEx(fileName, type, volume, pan, loop, loopStart, loopEnd, layer); return true; } -uint SoundEngine::PlaySoundEx(const Common::String &fileName, SOUND_TYPES type, float volume, float pan, bool loop, int loopStart, int loopEnd, uint layer) { +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); Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(in, DisposeAfterUse::YES); uint id; SndHandle *handle = getHandle(&id); - debugC(1, kDebugSound, "SoundEngine::PlaySoundEx(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer); + debugC(1, kDebugSound, "SoundEngine::playSoundEx(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer); _mixer->playStream(getType(type), &(handle->handle), stream, -1, (byte)(volume * 255), (int8)(pan * 127)); return id; } -void SoundEngine::SetSoundVolume(uint handle, float volume) { +void SoundEngine::setSoundVolume(uint handle, float volume) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::SetSoundVolume(%d, %f)", handle, volume); + debugC(1, kDebugSound, "SoundEngine::setSoundVolume(%d, %f)", handle, volume); _mixer->setChannelVolume(_handles[handle].handle, (byte)(volume * 255)); } -void SoundEngine::SetSoundPanning(uint handle, float pan) { +void SoundEngine::setSoundPanning(uint handle, float pan) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::SetSoundPanning(%d, %f)", handle, pan); + debugC(1, kDebugSound, "SoundEngine::setSoundPanning(%d, %f)", handle, pan); _mixer->setChannelBalance(_handles[handle].handle, (int8)(pan * 127)); } -void SoundEngine::PauseSound(uint handle) { +void SoundEngine::pauseSound(uint handle) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::PauseSound(%d)", handle); + debugC(1, kDebugSound, "SoundEngine::pauseSound(%d)", handle); _mixer->pauseHandle(_handles[handle].handle, true); } -void SoundEngine::ResumeSound(uint handle) { +void SoundEngine::resumeSound(uint handle) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::ResumeSound(%d)", handle); + debugC(1, kDebugSound, "SoundEngine::resumeSound(%d)", handle); _mixer->pauseHandle(_handles[handle].handle, false); } -void SoundEngine::StopSound(uint handle) { +void SoundEngine::stopSound(uint handle) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::StopSound(%d)", handle); + debugC(1, kDebugSound, "SoundEngine::stopSound(%d)", handle); _mixer->stopHandle(_handles[handle].handle); } -bool SoundEngine::IsSoundPaused(uint handle) { - warning("STUB: SoundEngine::IsSoundPaused(%d)", handle); +bool SoundEngine::isSoundPaused(uint handle) { + warning("STUB: SoundEngine::isSoundPaused(%d)", handle); return false; } -bool SoundEngine::IsSoundPlaying(uint handle) { +bool SoundEngine::isSoundPlaying(uint handle) { assert(handle < SOUND_HANDLES); - debugC(1, kDebugSound, "SoundEngine::IsSoundPlaying(%d)", handle); + debugC(1, kDebugSound, "SoundEngine::isSoundPlaying(%d)", handle); return _mixer->isSoundHandleActive(_handles[handle].handle); } -float SoundEngine::GetSoundVolume(uint handle) { - warning("STUB: SoundEngine::GetSoundVolume(%d)", handle); +float SoundEngine::getSoundVolume(uint handle) { + warning("STUB: SoundEngine::getSoundVolume(%d)", handle); return 0; } -float SoundEngine::GetSoundPanning(uint handle) { - warning("STUB: SoundEngine::GetSoundPanning(%d)", handle); +float SoundEngine::getSoundPanning(uint handle) { + warning("STUB: SoundEngine::getSoundPanning(%d)", handle); return 0; } -float SoundEngine::GetSoundTime(uint handle) { - warning("STUB: SoundEngine::GetSoundTime(%d)", handle); +float SoundEngine::getSoundTime(uint handle) { + warning("STUB: SoundEngine::getSoundTime(%d)", handle); return 0; } -Resource *SoundEngine::LoadResource(const Common::String &fileName) { - warning("STUB: SoundEngine::LoadResource(%s)", fileName.c_str()); +Resource *SoundEngine::loadResource(const Common::String &fileName) { + warning("STUB: SoundEngine::loadResource(%s)", fileName.c_str()); return new SoundResource(fileName); } -bool SoundEngine::CanLoadResource(const Common::String &fileName) { +bool SoundEngine::canLoadResource(const Common::String &fileName) { Common::String fname = fileName; - debugC(1, kDebugSound, "SoundEngine::CanLoadResource(%s)", fileName.c_str()); + debugC(1, kDebugSound, "SoundEngine::canLoadResource(%s)", fileName.c_str()); fname.toLowercase(); diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h index 23913b4e1f..81383b12cb 100644 --- a/engines/sword25/sfx/soundengine.h +++ b/engines/sword25/sfx/soundengine.h @@ -98,7 +98,7 @@ public: * @remark Calls to other methods may take place only if this * method was called successfully. */ - bool Init(uint SampleRate, uint Channels = 32); + bool init(uint sampleRate, uint channels = 32); /** * Performs a "tick" of the sound engine @@ -107,14 +107,14 @@ public: * of the sound engine that are not running in their own thread, or to perform * additional administrative tasks that are needed. */ - void Update(); + void update(); /** * Sets the default volume for the different sound types * @param Volume The default volume level (0 = off, 1 = full volume) * @param Type The SoundType whose volume is to be changed */ - void SetVolume(float Volume, SOUND_TYPES Type); + void setVolume(float volume, SOUND_TYPES type); /** * Specifies the default volume of different sound types @@ -122,30 +122,29 @@ public: * @return Returns the standard sound volume for the given type * (0 = off, 1 = full volume). */ - float GetVolume(SOUND_TYPES Type); + float getVolume(SOUND_TYPES type); /** * Pauses all the sounds that are playing. */ - void PauseAll(); + void pauseAll(); /** * Resumes all currently stopped sounds */ - void ResumeAll(); + void resumeAll(); /** * Pauses all sounds of a given layer. * @param Layer The Sound Layer */ - void PauseLayer(uint Layer); + void pauseLayer(uint layer); /** * Resumes all the sounds in a layer that was previously stopped with PauseLayer() * @param Layer The Sound Layer */ - void ResumeLayer(uint Layer); - + void resumeLayer(uint layer); /** * Plays a sound @@ -163,7 +162,7 @@ public: * @remark If more control is needed over the playing, eg. changing the sound parameters * for Volume and Panning, then PlaySoundEx should be used. */ - bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0); + bool playSound(const Common::String &fileName, SOUND_TYPES type, float volume = 1.0f, float pan = 0.0f, bool loop = false, int loopStart = -1, int loopEnd = -1, uint layer = 0); /** * Plays a sound @@ -180,78 +179,78 @@ public: * @remark If more control is needed over the playing, eg. changing the sound parameters * for Volume and Panning, then PlaySoundEx should be used. */ - uint PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0); + uint playSoundEx(const Common::String &fileName, SOUND_TYPES type, float volume = 1.0f, float pan = 0.0f, bool loop = false, int loopStart = -1, int loopEnd = -1, uint layer = 0); /** * Sets the volume of a playing sound * @param Handle The sound handle * @param Volume The volume of the sound (0 = off, 1 = full volume) */ - void SetSoundVolume(uint Handle, float Volume); + void setSoundVolume(uint handle, float volume); /** * Sets the panning of a playing sound * @param Handle The sound handle * @param Pan Panning (-1 = full left, 1 = right) */ - void SetSoundPanning(uint Handle, float Pan); + void setSoundPanning(uint handle, float pan); /** * Pauses a playing sound * @param Handle The sound handle */ - void PauseSound(uint Handle); + void pauseSound(uint handle); /** * Resumes a paused sound * @param Handle The sound handle */ - void ResumeSound(uint Handle); + void resumeSound(uint handle); /** * Stops a playing sound * @param Handle The sound handle * @remark Calling this method invalidates the passed handle; it can no longer be used. */ - void StopSound(uint Handle); + void stopSound(uint handle); /** * Returns whether a sound is paused * @param Handle The sound handle * @return Returns true if the sound is paused, false otherwise. */ - bool IsSoundPaused(uint Handle); + bool isSoundPaused(uint handle); /** * Returns whether a sound is still playing. * @param Handle The sound handle * @return Returns true if the sound is playing, false otherwise. */ - bool IsSoundPlaying(uint Handle); + bool isSoundPlaying(uint handle); /** * Returns the volume of a playing sound (0 = off, 1 = full volume) */ - float GetSoundVolume(uint Handle); + float getSoundVolume(uint handle); /** * Returns the panning of a playing sound (-1 = full left, 1 = right) */ - float GetSoundPanning(uint Handle); + float getSoundPanning(uint handle); /** * Returns the position within a playing sound in seconds */ - float GetSoundTime(uint Handle); + float getSoundTime(uint handle); - Resource *LoadResource(const Common::String &FileName); - bool CanLoadResource(const Common::String &FileName); + Resource *loadResource(const Common::String &fileName); + bool canLoadResource(const Common::String &fileName); bool persist(OutputPersistenceBlock &writer); bool unpersist(InputPersistenceBlock &reader); private: - bool _RegisterScriptBindings(); + bool registerScriptBindings(); SndHandle *getHandle(uint *id); private: diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp index 808fced94a..653c6d96db 100644 --- a/engines/sword25/sfx/soundengine_script.cpp +++ b/engines/sword25/sfx/soundengine_script.cpp @@ -45,261 +45,273 @@ namespace Sword25 { -static int Init(lua_State *L) { +static int init(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); if (lua_gettop(L) == 0) - lua_pushbooleancpp(L, pSfx->Init(44100, 32)); + lua_pushbooleancpp(L, pSfx->init(44100, 32)); else if (lua_gettop(L) == 1) - lua_pushbooleancpp(L, pSfx->Init(static_cast<uint>(luaL_checknumber(L, 1)), 32)); + lua_pushbooleancpp(L, pSfx->init(static_cast<uint>(luaL_checknumber(L, 1)), 32)); else - lua_pushbooleancpp(L, pSfx->Init(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<uint>(luaL_checknumber(L, 2)))); + lua_pushbooleancpp(L, pSfx->init(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<uint>(luaL_checknumber(L, 2)))); return 1; } -static int Update(lua_State *L) { +static int update(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->Update(); + pSfx->update(); return 0; } -static int SetVolume(lua_State *L) { +static int setVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->SetVolume(static_cast<float>(luaL_checknumber(L, 1)), + pSfx->setVolume(static_cast<float>(luaL_checknumber(L, 1)), static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 2)))); return 0; } -static int GetVolume(lua_State *L) { +static int getVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1))))); + lua_pushnumber(L, pSfx->getVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1))))); return 1; } -static int PauseAll(lua_State *L) { +static int pauseAll(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->PauseAll(); + pSfx->pauseAll(); return 0; } -static int ResumeAll(lua_State *L) { +static int resumeAll(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->ResumeAll(); + pSfx->resumeAll(); return 0; } -static int PauseLayer(lua_State *L) { +static int pauseLayer(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->PauseLayer(static_cast<int>(luaL_checknumber(L, 1))); + pSfx->pauseLayer(static_cast<int>(luaL_checknumber(L, 1))); return 0; } -static int ResumeLayer(lua_State *L) { +static int resumeLayer(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->ResumeLayer(static_cast<int>(luaL_checknumber(L, 1))); + pSfx->resumeLayer(static_cast<int>(luaL_checknumber(L, 1))); return 0; } -static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, uint &Layer) { - FileName = luaL_checkstring(L, 1); +static void processPlayParams(lua_State *L, Common::String &fileName, SoundEngine::SOUND_TYPES &type, float &volume, float &pan, bool &loop, int &loopStart, int &loopEnd, uint &layer) { + fileName = luaL_checkstring(L, 1); - Type = static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 2))); + type = static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 2))); - if (lua_gettop(L) < 3 || lua_isnil(L, 3)) Volume = 1.0f; - else Volume = static_cast<float>(luaL_checknumber(L, 3)); + if (lua_gettop(L) < 3 || lua_isnil(L, 3)) + volume = 1.0f; + else + volume = static_cast<float>(luaL_checknumber(L, 3)); - if (lua_gettop(L) < 4 || lua_isnil(L, 4)) Pan = 0.0f; - else Pan = static_cast<float>(luaL_checknumber(L, 4)); + if (lua_gettop(L) < 4 || lua_isnil(L, 4)) + pan = 0.0f; + else + pan = static_cast<float>(luaL_checknumber(L, 4)); - if (lua_gettop(L) < 5 || lua_isnil(L, 5)) Loop = false; - else Loop = lua_tobooleancpp(L, 5); + if (lua_gettop(L) < 5 || lua_isnil(L, 5)) + loop = false; + else + loop = lua_tobooleancpp(L, 5); - if (lua_gettop(L) < 6 || lua_isnil(L, 6)) LoopStart = -1; - else LoopStart = static_cast<int>(luaL_checknumber(L, 6)); + if (lua_gettop(L) < 6 || lua_isnil(L, 6)) + loopStart = -1; + else + loopStart = static_cast<int>(luaL_checknumber(L, 6)); - if (lua_gettop(L) < 7 || lua_isnil(L, 7)) LoopEnd = -1; - else LoopEnd = static_cast<int>(luaL_checknumber(L, 7)); + if (lua_gettop(L) < 7 || lua_isnil(L, 7)) + loopEnd = -1; + else + loopEnd = static_cast<int>(luaL_checknumber(L, 7)); - if (lua_gettop(L) < 8 || lua_isnil(L, 8)) Layer = 0; - else Layer = static_cast<uint>(luaL_checknumber(L, 8)); + if (lua_gettop(L) < 8 || lua_isnil(L, 8)) + layer = 0; + else + layer = static_cast<uint>(luaL_checknumber(L, 8)); } -static int PlaySound(lua_State *L) { +static int playSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - Common::String FileName; - SoundEngine::SOUND_TYPES Type; - float Volume; - float Pan; - bool Loop; - int LoopStart; - int LoopEnd; - uint Layer; - ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer); + Common::String fileName; + SoundEngine::SOUND_TYPES type; + float volume; + float pan; + bool loop; + int loopStart; + int loopEnd; + uint layer; + processPlayParams(L, fileName, type, volume, pan, loop, loopStart, loopEnd, layer); - lua_pushbooleancpp(L, pSfx->PlaySound(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer)); + lua_pushbooleancpp(L, pSfx->playSound(fileName, type, volume, pan, loop, loopStart, loopEnd, layer)); return 1; } -static int PlaySoundEx(lua_State *L) { +static int playSoundEx(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - Common::String FileName; - SoundEngine::SOUND_TYPES Type; - float Volume; - float Pan; - bool Loop; - int LoopStart; - int LoopEnd; - uint Layer; - ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer); + Common::String fileName; + SoundEngine::SOUND_TYPES type; + float volume; + float pan; + bool loop; + int loopStart; + int loopEnd; + uint layer; + processPlayParams(L, fileName, type, volume, pan, loop, loopStart, loopEnd, layer); - lua_pushnumber(L, pSfx->PlaySoundEx(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer)); + lua_pushnumber(L, pSfx->playSoundEx(fileName, type, volume, pan, loop, loopStart, loopEnd, layer)); return 1; } -static int SetSoundVolume(lua_State *L) { +static int setSoundVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->SetSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); + pSfx->setSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); return 0; } -static int SetSoundPanning(lua_State *L) { +static int setSoundPanning(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->SetSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); + pSfx->setSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2))); return 0; } -static int PauseSound(lua_State *L) { +static int pauseSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->PauseSound(static_cast<uint>(luaL_checknumber(L, 1))); + pSfx->pauseSound(static_cast<uint>(luaL_checknumber(L, 1))); return 0; } -static int ResumeSound(lua_State *L) { +static int resumeSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->ResumeSound(static_cast<uint>(luaL_checknumber(L, 1))); + pSfx->resumeSound(static_cast<uint>(luaL_checknumber(L, 1))); return 0; } -static int StopSound(lua_State *L) { +static int stopSound(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->StopSound(static_cast<uint>(luaL_checknumber(L, 1))); + pSfx->stopSound(static_cast<uint>(luaL_checknumber(L, 1))); return 0; } -static int IsSoundPaused(lua_State *L) { +static int isSoundPaused(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast<uint>(luaL_checknumber(L, 1)))); + lua_pushbooleancpp(L, pSfx->isSoundPaused(static_cast<uint>(luaL_checknumber(L, 1)))); return 1; } -static int IsSoundPlaying(lua_State *L) { +static int isSoundPlaying(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast<uint>(luaL_checknumber(L, 1)))); + lua_pushbooleancpp(L, pSfx->isSoundPlaying(static_cast<uint>(luaL_checknumber(L, 1)))); return 1; } -static int GetSoundVolume(lua_State *L) { +static int getSoundVolume(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)))); + lua_pushnumber(L, pSfx->getSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)))); return 1; } -static int GetSoundPanning(lua_State *L) { +static int getSoundPanning(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)))); + lua_pushnumber(L, pSfx->getSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)))); return 1; } @@ -307,25 +319,25 @@ static int GetSoundPanning(lua_State *L) { static const char *SFX_LIBRARY_NAME = "Sfx"; static const luaL_reg SFX_FUNCTIONS[] = { - {"Init", Init}, - {"Update", Update}, - {"__SetVolume", SetVolume}, - {"__GetVolume", GetVolume}, - {"PauseAll", PauseAll}, - {"ResumeAll", ResumeAll}, - {"PauseLayer", PauseLayer}, - {"ResumeLayer", ResumeLayer}, - {"__PlaySound", PlaySound}, - {"__PlaySoundEx", PlaySoundEx}, - {"__SetSoundVolume", SetSoundVolume}, - {"__SetSoundPanning", SetSoundPanning}, - {"__PauseSound", PauseSound}, - {"__ResumeSound", ResumeSound}, - {"__StopSound", StopSound}, - {"__IsSoundPaused", IsSoundPaused}, - {"__IsSoundPlaying", IsSoundPlaying}, - {"__GetSoundVolume", GetSoundVolume}, - {"__GetSoundPanning", GetSoundPanning}, + {"Init", init}, + {"Update", update}, + {"__SetVolume", setVolume}, + {"__GetVolume", getVolume}, + {"PauseAll", pauseAll}, + {"ResumeAll", resumeAll}, + {"PauseLayer", pauseLayer}, + {"ResumeLayer", resumeLayer}, + {"__PlaySound", playSound}, + {"__PlaySoundEx", playSoundEx}, + {"__SetSoundVolume", setSoundVolume}, + {"__SetSoundPanning", setSoundPanning}, + {"__PauseSound", pauseSound}, + {"__ResumeSound", resumeSound}, + {"__StopSound", stopSound}, + {"__IsSoundPaused", isSoundPaused}, + {"__IsSoundPlaying", isSoundPlaying}, + {"__GetSoundVolume", getSoundVolume}, + {"__GetSoundPanning", getSoundPanning}, {0, 0} }; @@ -336,7 +348,7 @@ static const lua_constant_reg SFX_CONSTANTS[] = { {0, 0} }; -bool SoundEngine::_RegisterScriptBindings() { +bool SoundEngine::registerScriptBindings() { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); ScriptEngine *pScript = static_cast<ScriptEngine *>(pKernel->GetService("script")); |