summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-03 21:58:08 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-04 03:06:57 +0300
commit866a71ffd576fd10c4e309195016d86f0c8ed635 (patch)
tree21bbec175afc181cada529598267d62f12fcb671 /src/sound.cpp
parentebecb0cf42f2066943908fa158ac91527e0e6629 (diff)
downloadplus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.gz
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.bz2
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.xz
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.zip
Add const to more classes.
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 7869d3108..cb4b11770 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -147,7 +147,7 @@ void Sound::init()
playMusic(mCurrentMusicFile);
}
-void Sound::info()
+void Sound::info() const
{
SDL_version compiledVersion;
const SDL_version *linkedVersion;
@@ -195,7 +195,7 @@ void Sound::info()
logger->log("Sound::info() Channels: %i", channels);
}
-void Sound::setMusicVolume(int volume)
+void Sound::setMusicVolume(const int volume)
{
mMusicVolume = volume;
@@ -203,7 +203,7 @@ void Sound::setMusicVolume(int volume)
Mix_VolumeMusic(mMusicVolume);
}
-void Sound::setSfxVolume(int volume)
+void Sound::setSfxVolume(const int volume)
{
mSfxVolume = volume;
@@ -213,7 +213,7 @@ void Sound::setSfxVolume(int volume)
static Music *loadMusic(const std::string &fileName)
{
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
return resman->getMusic(paths.getStringValue("music") + fileName);
}
@@ -239,7 +239,7 @@ void Sound::stopMusic()
haltMusic();
}
-void Sound::fadeInMusic(const std::string &fileName, int ms)
+void Sound::fadeInMusic(const std::string &fileName, const int ms)
{
mCurrentMusicFile = fileName;
@@ -256,7 +256,7 @@ void Sound::fadeInMusic(const std::string &fileName, int ms)
}
}
-void Sound::fadeOutMusic(int ms)
+void Sound::fadeOutMusic(const int ms)
{
mCurrentMusicFile.clear();
@@ -277,7 +277,7 @@ void Sound::fadeOutMusic(int ms)
}
}
-void Sound::fadeOutAndPlayMusic(const std::string &fileName, int ms)
+void Sound::fadeOutAndPlayMusic(const std::string &fileName, const int ms)
{
mNextMusicFile = fileName;
fadeOutMusic(ms);
@@ -302,7 +302,7 @@ void Sound::logic()
}
}
-void Sound::playSfx(const std::string &path, int x, int y)
+void Sound::playSfx(const std::string &path, const int x, const int y) const
{
if (!mInstalled || path.empty() || !mPlayBattle)
return;
@@ -312,8 +312,8 @@ void Sound::playSfx(const std::string &path, int x, int y)
tmpPath = path;
else
tmpPath = paths.getValue("sfx", "sfx/") + path;
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(tmpPath);
+ ResourceManager *const resman = ResourceManager::getInstance();
+ SoundEffect *const sample = resman->getSoundEffect(tmpPath);
if (sample)
{
logger->log("Sound::playSfx() Playing: %s", path.c_str());
@@ -326,7 +326,7 @@ void Sound::playSfx(const std::string &path, int x, int y)
dx = -dx;
if (dy < 0)
dy = -dy;
- int dist = dx > dy ? dx : dy;
+ const int dist = dx > dy ? dx : dy;
if (dist * 8 > vol)
return;
@@ -352,12 +352,12 @@ void Sound::playGuiSfx(const std::string &path)
tmpPath = path;
else
tmpPath = paths.getValue("sfx", "sfx/") + path;
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(tmpPath);
+ ResourceManager *const resman = ResourceManager::getInstance();
+ SoundEffect *const sample = resman->getSoundEffect(tmpPath);
if (sample)
{
logger->log("Sound::playGuiSfx() Playing: %s", path.c_str());
- int ret = sample->play(0, 120, mGuiChannel);
+ const int ret = sample->play(0, 120, mGuiChannel);
if (ret != -1)
mGuiChannel = ret;
}
@@ -396,7 +396,7 @@ void Sound::changeAudio()
init();
}
-void Sound::volumeOff()
+void Sound::volumeOff() const
{
if (mInstalled)
{