Minor tweaks to new Qt sound setup.

This commit is contained in:
mjbudd77 2021-08-07 12:49:55 -04:00
parent 896af76167
commit d53a746f18
2 changed files with 16 additions and 3 deletions

View File

@ -36,6 +36,9 @@ extern Config *g_config;
static volatile int *s_Buffer = 0;
static unsigned int s_BufferSize;
static unsigned int s_BufferSize25;
static unsigned int s_BufferSize50;
static unsigned int s_BufferSize75;
static unsigned int s_BufferRead;
static unsigned int s_BufferWrite;
static volatile unsigned int s_BufferIn;
@ -194,6 +197,12 @@ InitSound()
{
s_BufferSize = spec.samples * 2;
}
s_BufferSize25 = s_BufferSize/4;
s_BufferSize50 = s_BufferSize/2;
s_BufferSize75 = (3*s_BufferSize)/4;
//printf("Audio Buffer: %i %i \n", spec.samples, s_BufferSize );
noiseGate = 0.0;
noiseGateRate = 1.0 / (double)spec.samples;
noiseGateActive = true;
@ -277,7 +286,7 @@ WriteSound(int32 *buf,
{
ovrFlowSkip = 1;
}
if ( s_BufferIn >= (s_BufferSize/2) )
if ( s_BufferIn >= s_BufferSize50 )
{
ovrFlowSkip++;
}
@ -290,10 +299,14 @@ WriteSound(int32 *buf,
{
udrFlowDup = 1;
}
if ( s_BufferIn <= (s_BufferSize/2) )
if ( s_BufferIn < s_BufferSize50 )
{
udrFlowDup++;
}
else if ( s_BufferIn > s_BufferSize75 )
{
udrFlowDup--;
}
uflowMode = (udrFlowDup > 1);
}
extern int EmulationPaused;

View File

@ -253,7 +253,7 @@ RefreshThrottleFPS(void)
frmRateAdjRatio = (1.0 / ( hz * g_fpsScale )) / desired_frametime;
printf("frameAdjRatio:%f \n", frmRateAdjRatio );
//printf("frameAdjRatio:%f \n", frmRateAdjRatio );
}
else
{