Merge pull request #1394 from Frank-74/patch-2

Fix tabs/spaces, tiny buffer unlimited VI problem
This commit is contained in:
zilmar 2017-10-16 09:27:37 +11:00 committed by GitHub
commit 99131d1374
4 changed files with 40 additions and 36 deletions

View File

@ -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");
}

View File

@ -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;
};

View File

@ -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)

View File

@ -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;
}