Merge pull request #1394 from Frank-74/patch-2
Fix tabs/spaces, tiny buffer unlimited VI problem
This commit is contained in:
commit
99131d1374
|
@ -87,36 +87,36 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
|
||||||
}
|
}
|
||||||
uint32_t Frequency = video_clock / (g_Dacrate + 1);
|
uint32_t Frequency = video_clock / (g_Dacrate + 1);
|
||||||
|
|
||||||
if (Frequency < 4000)
|
if (Frequency < 4000)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceDebug, "Not Audio Data!");
|
WriteTrace(TraceAudioDriver, TraceDebug, "Not Audio Data!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t BufferSize = 0; double audio_clock = 0;
|
int32_t BufferSize = 0; double audio_clock = 0;
|
||||||
double framerate1 = 59.94004; double framerate2 = 64; double framerate = 0;
|
double framerate1 = 59.94004; double framerate2 = 64; double framerate = 0;
|
||||||
|
|
||||||
if (g_settings->FPSBuffer() == true)
|
if (g_settings->FPSBuffer() == true)
|
||||||
{
|
{
|
||||||
framerate = framerate1;
|
framerate = framerate1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
framerate = framerate2;
|
framerate = framerate2;
|
||||||
}
|
}
|
||||||
if (g_settings->TinyBuffer() == true)
|
if (g_settings->TinyBuffer() == true)
|
||||||
{
|
{
|
||||||
audio_clock = ((video_clock / framerate) * 2);
|
audio_clock = ((video_clock / framerate) * 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
audio_clock = ((video_clock / framerate) * 4);
|
audio_clock = ((video_clock / framerate) * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1;
|
BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1;
|
||||||
g_SoundDriver->AI_SetFrequency(Frequency, BufferSize);
|
g_SoundDriver->AI_SetFrequency(Frequency, BufferSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Done");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
inline bool debugger_enabled(void) const { return m_debugger_enabled; }
|
inline bool debugger_enabled(void) const { return m_debugger_enabled; }
|
||||||
inline uint32_t GetVolume(void) const { return m_Volume; }
|
inline uint32_t GetVolume(void) const { return m_Volume; }
|
||||||
inline bool TinyBuffer(void) const { return m_TinyBuffer; }
|
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 SyncAudio(void) const { return m_SyncAudio; }
|
||||||
inline bool FullSpeed(void) const { return m_FullSpeed; }
|
inline bool FullSpeed(void) const { return m_FullSpeed; }
|
||||||
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
||||||
|
@ -28,8 +28,8 @@ public:
|
||||||
|
|
||||||
void SetAudioEnabled(bool Enabled);
|
void SetAudioEnabled(bool Enabled);
|
||||||
void SetVolume(uint32_t Volume);
|
void SetVolume(uint32_t Volume);
|
||||||
void SetTinyBuffer(bool TinyBuffer);
|
void SetTinyBuffer(bool TinyBuffer);
|
||||||
void SetFPSBuffer(bool FPSBuffer);
|
void SetFPSBuffer(bool FPSBuffer);
|
||||||
void ReadSettings();
|
void ReadSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -60,7 +60,7 @@ private:
|
||||||
bool m_debugger_enabled;
|
bool m_debugger_enabled;
|
||||||
uint32_t m_Volume;
|
uint32_t m_Volume;
|
||||||
bool m_TinyBuffer;
|
bool m_TinyBuffer;
|
||||||
bool m_FPSBuffer;
|
bool m_FPSBuffer;
|
||||||
bool m_SyncAudio;
|
bool m_SyncAudio;
|
||||||
bool m_FullSpeed;
|
bool m_FullSpeed;
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,16 +132,16 @@ void DirectSoundDriver::SetFrequency(uint32_t Frequency, uint32_t BufferSize)
|
||||||
|
|
||||||
void DirectSoundDriver::SetVolume(uint32_t Volume)
|
void DirectSoundDriver::SetVolume(uint32_t Volume)
|
||||||
{
|
{
|
||||||
LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
|
LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
|
||||||
int32_t dsVolume = -((100 - (int32_t)Volume) * 25);
|
int32_t dsVolume = -((100 - (int32_t)Volume) * 25);
|
||||||
if (Volume == 0)
|
if (Volume == 0)
|
||||||
{
|
{
|
||||||
dsVolume = DSBVOLUME_MIN;
|
dsVolume = DSBVOLUME_MIN;
|
||||||
}
|
}
|
||||||
if (lpdsb != NULL)
|
if (lpdsb != NULL)
|
||||||
{
|
{
|
||||||
lpdsb->SetVolume(dsVolume);
|
lpdsb->SetVolume(dsVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
|
void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
|
||||||
|
|
|
@ -38,6 +38,10 @@ void SoundDriverBase::AI_SetFrequency(uint32_t Frequency, uint32_t BufferSize)
|
||||||
{
|
{
|
||||||
SetFrequency(Frequency, BufferSize);
|
SetFrequency(Frequency, BufferSize);
|
||||||
m_MaxBufferSize = (BufferSize * 4);
|
m_MaxBufferSize = (BufferSize * 4);
|
||||||
|
if (g_settings->TinyBuffer() == true)
|
||||||
|
{
|
||||||
|
m_MaxBufferSize = m_MaxBufferSize * 2;
|
||||||
|
]
|
||||||
m_BufferRemaining = 0;
|
m_BufferRemaining = 0;
|
||||||
m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0;
|
m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue