diff --git a/Source/Project64-audio/AudioMain.cpp b/Source/Project64-audio/AudioMain.cpp index 260c4648c..70620d379 100644 --- a/Source/Project64-audio/AudioMain.cpp +++ b/Source/Project64-audio/AudioMain.cpp @@ -87,36 +87,36 @@ EXPORT void CALL AiDacrateChanged(int SystemType) } uint32_t Frequency = video_clock / (g_Dacrate + 1); - if (Frequency < 4000) - { - WriteTrace(TraceAudioDriver, TraceDebug, "Not Audio Data!"); - return; - } - else - { - int32_t BufferSize = 0; double audio_clock = 0; - double framerate1 = 59.94004; double framerate2 = 64; double framerate = 0; + if (Frequency < 4000) + { + WriteTrace(TraceAudioDriver, TraceDebug, "Not Audio Data!"); + return; + } + else + { + int32_t BufferSize = 0; double audio_clock = 0; + double framerate1 = 59.94004; double framerate2 = 64; double framerate = 0; - if (g_settings->FPSBuffer() == true) + if (g_settings->FPSBuffer() == true) { framerate = framerate1; } - else + else { framerate = framerate2; } - if (g_settings->TinyBuffer() == true) - { - audio_clock = ((video_clock / framerate) * 2); - } - else - { - audio_clock = ((video_clock / framerate) * 4); - } + if (g_settings->TinyBuffer() == true) + { + audio_clock = ((video_clock / framerate) * 2); + } + else + { + audio_clock = ((video_clock / framerate) * 4); + } - BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1; - g_SoundDriver->AI_SetFrequency(Frequency, BufferSize); - } + BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1; + g_SoundDriver->AI_SetFrequency(Frequency, BufferSize); + } } WriteTrace(TraceAudioInterface, TraceDebug, "Done"); } diff --git a/Source/Project64-audio/AudioSettings.h b/Source/Project64-audio/AudioSettings.h index 7dd0629ed..1632c3e65 100644 --- a/Source/Project64-audio/AudioSettings.h +++ b/Source/Project64-audio/AudioSettings.h @@ -20,7 +20,7 @@ public: inline bool debugger_enabled(void) const { return m_debugger_enabled; } inline uint32_t GetVolume(void) const { return m_Volume; } inline bool TinyBuffer(void) const { return m_TinyBuffer; } - inline bool FPSBuffer(void) const { return m_FPSBuffer; } + inline bool FPSBuffer(void) const { return m_FPSBuffer; } inline bool SyncAudio(void) const { return m_SyncAudio; } inline bool FullSpeed(void) const { return m_FullSpeed; } inline bool FlushLogs(void) const { return m_FlushLogs; } @@ -28,8 +28,8 @@ public: void SetAudioEnabled(bool Enabled); void SetVolume(uint32_t Volume); - void SetTinyBuffer(bool TinyBuffer); - void SetFPSBuffer(bool FPSBuffer); + void SetTinyBuffer(bool TinyBuffer); + void SetFPSBuffer(bool FPSBuffer); void ReadSettings(); private: @@ -60,7 +60,7 @@ private: bool m_debugger_enabled; uint32_t m_Volume; bool m_TinyBuffer; - bool m_FPSBuffer; + bool m_FPSBuffer; bool m_SyncAudio; bool m_FullSpeed; }; diff --git a/Source/Project64-audio/Driver/DirectSound.cpp b/Source/Project64-audio/Driver/DirectSound.cpp index 2dff729d3..354d923c1 100644 --- a/Source/Project64-audio/Driver/DirectSound.cpp +++ b/Source/Project64-audio/Driver/DirectSound.cpp @@ -132,16 +132,16 @@ void DirectSoundDriver::SetFrequency(uint32_t Frequency, uint32_t BufferSize) void DirectSoundDriver::SetVolume(uint32_t Volume) { - LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb; - int32_t dsVolume = -((100 - (int32_t)Volume) * 25); - if (Volume == 0) - { - dsVolume = DSBVOLUME_MIN; - } - if (lpdsb != NULL) - { - lpdsb->SetVolume(dsVolume); - } + LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb; + int32_t dsVolume = -((100 - (int32_t)Volume) * 25); + if (Volume == 0) + { + dsVolume = DSBVOLUME_MIN; + } + if (lpdsb != NULL) + { + lpdsb->SetVolume(dsVolume); + } } void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate) diff --git a/Source/Project64-audio/Driver/SoundBase.cpp b/Source/Project64-audio/Driver/SoundBase.cpp index db5d2f8fb..26bf84cff 100644 --- a/Source/Project64-audio/Driver/SoundBase.cpp +++ b/Source/Project64-audio/Driver/SoundBase.cpp @@ -38,6 +38,10 @@ void SoundDriverBase::AI_SetFrequency(uint32_t Frequency, uint32_t BufferSize) { SetFrequency(Frequency, BufferSize); m_MaxBufferSize = (BufferSize * 4); + if (g_settings->TinyBuffer() == true) + { + m_MaxBufferSize = m_MaxBufferSize * 2; + ] m_BufferRemaining = 0; m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0; }