diff options
Diffstat (limited to 'src/sound/oalsound/alsound.cpp')
-rw-r--r-- | src/sound/oalsound/alsound.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index 0201417..f683a62 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -296,6 +296,8 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc GetLogger()->Warn("Sound %d was not loaded!\n", sound); return -1; } + + GetLogger()->Trace("ALSound::Play sound: %d volume: %f frequency: %f\n", sound, amplitude, frequency); int channel; bool bAlreadyLoaded; @@ -308,12 +310,12 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc Position(channel, pos); // setting initial values - mChannels[channel]->SetStartAmplitude(amplitude); + mChannels[channel]->SetStartAmplitude(mAudioVolume); mChannels[channel]->SetStartFrequency(frequency); mChannels[channel]->SetChangeFrequency(1.0f); mChannels[channel]->ResetOper(); - mChannels[channel]->AdjustFrequency(frequency); - mChannels[channel]->AdjustVolume(mAudioVolume); + mChannels[channel]->AdjustFrequency(frequency); + mChannels[channel]->AdjustVolume(amplitude * mAudioVolume); mChannels[channel]->Play(); return channel; } @@ -451,17 +453,17 @@ void ALSound::FrameMove(float delta) it.second->AdjustVolume(volume * mAudioVolume); // setting frequency - frequency = progress * (oper.finalFrequency - it.second->GetStartFrequency()) * it.second->GetStartFrequency() * it.second->GetChangeFrequency(); + frequency = progress * abs(oper.finalFrequency - it.second->GetStartFrequency()) * it.second->GetStartFrequency() * it.second->GetChangeFrequency(); it.second->AdjustFrequency(frequency); if (it.second->GetEnvelope().totalTime <= it.second->GetCurrentTime()) { if (oper.nextOper == SOPER_LOOP) { - GetLogger()->Trace("Sound oper: replay.\n"); + GetLogger()->Trace("ALSound::FrameMove oper: replay.\n"); it.second->SetCurrentTime(0.0f); it.second->Play(); } else { - GetLogger()->Trace("Sound oper: next.\n"); + GetLogger()->Trace("ALSound::FrameMove oper: next.\n"); it.second->SetStartAmplitude(oper.finalAmplitude); it.second->SetStartFrequency(oper.finalFrequency); it.second->PopEnvelope(); |