Update native to not wait in the opensl callback. Some minor audio optimizations. Also it seems ffmpeg has changed so update it.

This commit is contained in:
Henrik Rydgard 2013-06-22 17:34:46 +02:00
parent 83c17994f9
commit 67c185f8ea
4 changed files with 23 additions and 14 deletions

View File

@ -456,18 +456,27 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
// Alright, all voices mixed. Let's convert and clip, and at the same time, wipe mixBuffer for next time. Could also dither.
s16 *outp = (s16 *)Memory::GetPointer(outAddr);
s16 *inp = inAddr ? (s16*)Memory::GetPointer(inAddr) : 0;
for (int i = 0; i < grainSize * 2; i += 2) {
int sampleL = mixBuffer[i] + sendBuffer[i];
if (inp)
sampleL += (*inp++) * leftVol >> 12;
*outp++ = clamp_s16(sampleL);
if (outputMode == 0) {
// stereo
int sampleR = mixBuffer[i + 1] + sendBuffer[i + 1];
const s16 *inp = inAddr ? (s16*)Memory::GetPointer(inAddr) : 0;
if (outputMode == 0) {
if (inp) {
for (int i = 0; i < grainSize * 2; i += 2) {
int sampleL = mixBuffer[i] + sendBuffer[i] + ((*inp++) * leftVol >> 12);
int sampleR = mixBuffer[i + 1] + sendBuffer[i + 1] + ((*inp++) * rightVol >> 12);
*outp++ = clamp_s16(sampleL);
*outp++ = clamp_s16(sampleR);
}
} else {
for (int i = 0; i < grainSize * 2; i += 2) {
*outp++ = clamp_s16(mixBuffer[i] + sendBuffer[i]);
*outp++ = clamp_s16(mixBuffer[i + 1] + sendBuffer[i + 1]);
}
}
} else {
for (int i = 0; i < grainSize * 2; i += 2) {
int sampleL = mixBuffer[i] + sendBuffer[i];
if (inp)
sampleR += (*inp++) * rightVol >> 12;
*outp++ = clamp_s16(sampleR);
sampleL += (*inp++) * leftVol >> 12;
*outp++ = clamp_s16(sampleL);
}
}
memset(mixBuffer, 0, grainSize * sizeof(int) * 2);

View File

@ -5,7 +5,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native_audio
LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi
LOCAL_CFLAGS := -O3 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi
# yes, it's really CPPFLAGS for C++
LOCAL_CPPFLAGS := -std=gnu++11 -fno-rtti
NATIVE := ../../native

2
ffmpeg

@ -1 +1 @@
Subproject commit 84dac8cd4af62868ddc18ee813931e5a4788c28d
Subproject commit 278f7742523d26b6469a63b2bb902c51d23fbfca

2
native

@ -1 +1 @@
Subproject commit 0a26fae856aecdaa426d92fa5dde101b19487796
Subproject commit ca9301fedf879f28d6f11fda59709a66c5368bec