Update DirectSound.cpp

This commit is contained in:
Frank-74 2017-10-13 01:42:18 +01:00 committed by GitHub
parent e7ce869a25
commit cc466d9735
1 changed files with 13 additions and 7 deletions

View File

@ -119,11 +119,11 @@ void DirectSoundDriver::StartAudio()
WriteTrace(TraceAudioDriver, TraceDebug, "Done"); WriteTrace(TraceAudioDriver, TraceDebug, "Done");
} }
void DirectSoundDriver::SetFrequency(uint32_t Frequency) void DirectSoundDriver::SetFrequency(uint32_t Frequency, uint32_t BufferSize)
{ {
WriteTrace(TraceAudioDriver, TraceDebug, "Start (Frequency: 0x%08X)", Frequency); WriteTrace(TraceAudioDriver, TraceDebug, "Start (Frequency: 0x%08X)", Frequency);
StopAudio(); StopAudio();
m_LOCK_SIZE = (uint32_t)((Frequency / g_settings->BufferDivider())) * 4; m_LOCK_SIZE = (BufferSize * 2);
SetSegmentSize(m_LOCK_SIZE, Frequency); SetSegmentSize(m_LOCK_SIZE, Frequency);
StartAudio(); StartAudio();
@ -132,10 +132,16 @@ void DirectSoundDriver::SetFrequency(uint32_t Frequency)
void DirectSoundDriver::SetVolume(uint32_t Volume) void DirectSoundDriver::SetVolume(uint32_t Volume)
{ {
/*DWORD dsVolume = ((DWORD)Volume * -25); LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
if (Volume == 100) dsVolume = (DWORD)DSBVOLUME_MIN; int32_t dsVolume = -((100 - (int32_t)Volume) * 25);
if (Volume == 0) dsVolume = DSBVOLUME_MAX; if (Volume == 0)
if (lpdsb != NULL) lpdsb->SetVolume(dsVolume);*/ {
dsVolume = DSBVOLUME_MIN;
}
if (lpdsb != NULL)
{
lpdsb->SetVolume(dsVolume);
}
} }
void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate) void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)