Permalink
Browse files

audio: Adjust SLES volume factor

  • Loading branch information...
fzurita committed Mar 2, 2016
1 parent e389fc5 commit 24ccc48c7301f3baddcbd0b85e8ec54db3d89300
Showing with 10 additions and 8 deletions.
  1. +10 −8 jni/mupen64plus-audio-sles/main.cpp
@@ -838,9 +838,9 @@ void* audioConsumer(void* param)
while(!shutdown)
{
- int queueLength = lock.limit - lock.value;
+ int slesQueueLength = lock.limit - lock.value;
- ranDry = queueLength < minQueueSize;
+ ranDry = slesQueueLength < minQueueSize;
struct threadmsg msg;
@@ -850,6 +850,8 @@ void* audioConsumer(void* param)
if( result != ETIMEDOUT )
{
+ int threadQueueLength = thread_queue_length(&audioConsumerQueue);
+
//Figure out how much to slow down by
float timeDiff = TimeDiff(&currTime, &prevTime);
feedTimes[feedTimeIndex] = timeDiff;
@@ -871,7 +873,7 @@ void* audioConsumer(void* param)
float temp = averageGameTime/averageFeedTime;
//Game is running too fast speed up audio
- if(queueLength > maxQueueSize)
+ if(slesQueueLength > maxQueueSize)
{
currAdjustment = temp + catchUpOffset;
}
@@ -880,7 +882,7 @@ void* audioConsumer(void* param)
{
currAdjustment = temp - catchUpOffset;
}
- else if(!ranDry && queueLength < maxQueueSize)
+ else if(!ranDry && slesQueueLength < maxQueueSize)
{
currAdjustment = temp;
}
@@ -901,10 +903,10 @@ void* audioConsumer(void* param)
free(currQueueData);
//Useful logging
- //if(queueLength == 0)
+ //if(slesQueueLength == 0)
//{
- // DebugMessage(M64MSG_ERROR, "target=%d, length = %d, speed = %d, dry=%d, slow_adj=%f, curr_adj=%f, feed_time=%f, game_time=%f",
- // TargetSecondaryBuffers, queueLength, desiredGameSpeed, ranDry, slowAdjustment, currAdjustment, averageFeedTime, averageGameTime);
+ // DebugMessage(M64MSG_ERROR, "sles_length=%d, thread_length=%d speed=%d, dry=%d, slow_adj=%f, curr_adj=%f, feed_time=%f",
+ // slesQueueLength, threadQueueLength, desiredGameSpeed, ranDry, slowAdjustment, currAdjustment, averageFeedTime);
//}
}
}
@@ -954,7 +956,7 @@ void processAudio(const unsigned char* buffer, unsigned int length)
DebugMessage(M64MSG_WARNING, "processAudio(): Audio primary buffer overflow.");
#ifdef FP_ENABLED
- static const float volumeFactor = 1.5;
+ static const float volumeFactor = 1.1;
int numSamples = length/sizeof(short);
short* primaryBufferShort = (short*)primaryBuffer;
float primaryBufferFloat[numSamples];

0 comments on commit 24ccc48

Please sign in to comment.