Permalink
Browse files

audio: Add a volume factor when converting audio samples to float

  • Loading branch information...
fzurita committed Mar 1, 2016
1 parent 37c5957 commit e389fc5f4e44b92e48b1a042a11647b10578ea13
Showing with 2 additions and 2 deletions.
  1. +2 −1 jni/mupen64plus-audio-sles/main.cpp
  2. +0 −1 jni/soundtouch/source/Android-lib/jni/Android.mk
@@ -954,13 +954,14 @@ 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;
int numSamples = length/sizeof(short);
short* primaryBufferShort = (short*)primaryBuffer;
float primaryBufferFloat[numSamples];
for(int index = 0; index < numSamples; ++index)
{
primaryBufferFloat[index] = static_cast<float>(primaryBufferShort[index])/32767.0;
primaryBufferFloat[index] = volumeFactor*static_cast<float>(primaryBufferShort[index])/32767.0;
}
soundTouch.putSamples((SAMPLETYPE*)primaryBufferFloat, length/N64_SAMPLE_BYTES);
@@ -18,7 +18,6 @@ LOCAL_PATH := $(call my-dir)
MY_LOCAL_SRC_FILES := ../../SoundTouch/AAFilter.cpp ../../SoundTouch/FIFOSampleBuffer.cpp \
../../SoundTouch/FIRFilter.cpp ../../SoundTouch/cpu_detect_x86.cpp \
../../SoundStretch/WavFile.cpp \
../../SoundTouch/RateTransposer.cpp ../../SoundTouch/SoundTouch.cpp \
../../SoundTouch/InterpolateCubic.cpp ../../SoundTouch/InterpolateLinear.cpp \
../../SoundTouch/InterpolateShannon.cpp ../../SoundTouch/TDStretch.cpp \

0 comments on commit e389fc5

Please sign in to comment.