Skip to content
Permalink
Browse files
audio: addd buffer size multiplier so that frquency doesn't affect audio
latency
  • Loading branch information
fzurita committed Mar 19, 2016
1 parent 0b602cf commit 378b44dec1e813238af4676412b010723de23fce
Showing 1 changed file with 7 additions and 2 deletions.
@@ -385,6 +385,9 @@ static void InitializeAudio(int freq)
}

DebugMessage(M64MSG_VERBOSE, "Requesting frequency: %iHz.", OutputFreq);

double bufferMultiplier = (double)OutputFreq/DEFAULT_FREQUENCY;
SecondaryBufferSize = bufferMultiplier*(double)SecondaryBufferSize;

/* Close everything because InitializeAudio can be called more than once */
CloseAudio();
@@ -832,11 +835,13 @@ void* audioConsumer(void* param)
//soundTouch.setSetting( SETTING_OVERLAP_MS, overlapMS );

soundTouch.setRate((double)GameFreq/(double)OutputFreq);

double bufferMultiplier = (double)OutputFreq/DEFAULT_FREQUENCY;

int prevQueueSize = thread_queue_length(&audioConsumerQueue);
int currQueueSize = prevQueueSize;
int maxQueueSize = TargetSecondaryBuffers + 40;
int minQueueSize = TargetSecondaryBuffers;
int maxQueueSize = TargetSecondaryBuffers + 30.0*bufferMultiplier;
int minQueueSize = (double)TargetSecondaryBuffers*bufferMultiplier;
bool drainQueue = false;

//Sound queue ran dry, device is running slow

0 comments on commit 378b44d

Please sign in to comment.