summaryrefslogtreecommitdiffstats
path: root/src/sound
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2013-03-14 23:03:03 +0100
committererihel <erihel@gmail.com>2013-03-14 23:03:03 +0100
commit9f5bef030d97e9ee20d8c635335fdafd854fed44 (patch)
tree74ab7ae681316db9c92f172dc0fcd69ef958e5fd /src/sound
parent6c783b903392173a6a98048aad3d600e4dcfe103 (diff)
downloadcolobot-9f5bef030d97e9ee20d8c635335fdafd854fed44.tar.gz
colobot-9f5bef030d97e9ee20d8c635335fdafd854fed44.tar.bz2
colobot-9f5bef030d97e9ee20d8c635335fdafd854fed44.zip
* Adjusted sound volume to game settings
* Added fabs to remove logs about pitch having negative values
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/oalsound/alsound.cpp10
-rw-r--r--src/sound/oalsound/channel.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 47d5e34..8c1cb81 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -136,7 +136,7 @@ void ALSound::SetMusicVolume(int volume)
{
mMusicVolume = MIN(static_cast<float>(volume) / MAXVOLUME, 1.0f);
if (mCurrentMusic) {
- mCurrentMusic->SetVolume(mMusicVolume);
+ mCurrentMusic->SetVolume(mMusicVolume * mAudioVolume);
}
}
@@ -318,7 +318,7 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
Position(channel, pos);
// setting initial values
- mChannels[channel]->SetStartAmplitude(amplitude * mAudioVolume);
+ mChannels[channel]->SetStartAmplitude(amplitude);
mChannels[channel]->SetStartFrequency(frequency);
mChannels[channel]->SetChangeFrequency(1.0f);
mChannels[channel]->ResetOper();
@@ -434,7 +434,7 @@ bool ALSound::MuteAll(bool bMute)
volume = mAudioVolume;
for (auto channel : mChannels) {
- channel.second->SetVolume(volume);
+ channel.second->SetVolume(volume * mAudioVolume);
}
return true;
@@ -508,7 +508,7 @@ bool ALSound::PlayMusic(int rank, bool bRepeat)
GetLogger()->Debug("Music loaded from cache\n");
mCurrentMusic->SetBuffer(music);
- mCurrentMusic->SetVolume(mMusicVolume);
+ mCurrentMusic->SetVolume(mMusicVolume * mAudioVolume);
mCurrentMusic->SetLoop(bRepeat);
mCurrentMusic->Play();
return true;
@@ -533,7 +533,7 @@ bool ALSound::PlayMusic(int rank, bool bRepeat)
mMusicCache[rank] = buffer;
}
- mCurrentMusic->SetVolume(mMusicVolume);
+ mCurrentMusic->SetVolume(mMusicVolume * mAudioVolume);
mCurrentMusic->SetLoop(bRepeat);
mCurrentMusic->Play();
diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp
index 0faecd0..19394c6 100644
--- a/src/sound/oalsound/channel.cpp
+++ b/src/sound/oalsound/channel.cpp
@@ -94,7 +94,7 @@ bool Channel::AdjustFrequency(float freq)
if (!mReady || mBuffer == nullptr)
return false;
- return SetFrequency(mInitFrequency + freq);
+ return SetFrequency(mInitFrequency + fabs(freq));
}