diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index 83cbeb6c..17a46fe5 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -386,7 +386,8 @@ bool ALSound::Frequency(int channel, float frequency) return false; } - mChannels[channel]->SetFrequency(frequency); + mChannels[channel]->SetFrequency(frequency * mChannels[channel]->GetInitFrequency()); + mChannels[channel]->SetChangeFrequency(frequency); return true; } @@ -461,11 +462,13 @@ void ALSound::FrameMove(float delta) // setting volume volume = progress * (oper.finalAmplitude - it.second->GetStartAmplitude()); - it.second->SetVolume((volume + it.second->GetStartAmplitude()) * mAudioVolume); + volume = (volume + it.second->GetStartAmplitude()) * mAudioVolume; + it.second->SetVolume(volume); // setting frequency frequency = progress * (oper.finalFrequency - it.second->GetStartFrequency()) * it.second->GetStartFrequency() * it.second->GetChangeFrequency() * it.second->GetInitFrequency(); it.second->AdjustFrequency(frequency); + GetLogger()->Error("%f\n", frequency); if (oper.totalTime <= oper.currentTime) { if (oper.nextOper == SOPER_LOOP) { diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp index 3c8bc502..0faecd09 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 + freq); } @@ -119,7 +119,7 @@ bool Channel::SetVolume(float vol) if (!mReady || vol < 0 || mBuffer == nullptr) return false; - alSourcef(mSource, AL_GAIN, MIN(vol, 1.0f)); + alSourcef(mSource, AL_GAIN, MIN(powf(vol, 0.2f), 1.0f)); if (alCheck()) { GetLogger()->Warn("Could not set sound volume to '%f'. Code: %d\n", vol, alGetCode()); return false;