Browse Source

fix volume scaling

pull/149/head
Pyr0Byt3 7 years ago committed by Anders Jenbo
parent
commit
cb9ef7a8b8
  1. 8
      SourceX/miniwin/dsound.cpp

8
SourceX/miniwin/dsound.cpp

@ -74,8 +74,7 @@ HRESULT DirectSoundBuffer::Play(DWORD dwReserved1, DWORD dwPriority, DWORD dwFla
}
Mix_Volume(channel, volume);
int panned = 255 - 255 * abs(pan) / 10000;
Mix_SetPanning(channel, pan <= 0 ? 255 : panned, pan >= 0 ? 255 : panned);
Mix_SetPanning(channel, pan <= 0 ? 255 : abs(pan), pan >= 0 ? 255 : pan);
return DVL_DS_OK;
};
@ -87,14 +86,15 @@ HRESULT DirectSoundBuffer::SetFormat(LPCWAVEFORMATEX pcfxFormat)
HRESULT DirectSoundBuffer::SetVolume(LONG lVolume)
{
volume = MIX_MAX_VOLUME - MIX_MAX_VOLUME * lVolume / VOLUME_MIN;
volume = pow(10, lVolume / 2000.0) * MIX_MAX_VOLUME;
return DVL_DS_OK;
};
HRESULT DirectSoundBuffer::SetPan(LONG lPan)
{
pan = lPan;
pan = copysign(pow(10, -abs(lPan) / 2000.0) * 255, lPan);
return DVL_DS_OK;
};

Loading…
Cancel
Save