mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 23:40:29 +02:00
Remove the return value from NativeMix, correct mixing with other channel numbers than 2
This commit is contained in:
1 parent
5ace3179f8
commit
0502d79c99
9 files changed
+55
-70
No files matched your search
+14
-6
@@ -803,19 +803,27 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
void CallbackPostRender(UIContext *dc, void *userdata);
|
||||
bool CreateGlobalPipelines();
|
||||
|
||||
// TODO: Add faster special case for channels == 2.
|
||||
void NativeMixWrapper(float *dest, int framesToWrite, int channels, int sampleRateHz, void *userdata) {
|
||||
static int16_t *buffer;
|
||||
static int bufSize;
|
||||
if (bufSize < framesToWrite * channels) {
|
||||
buffer = new int16_t[framesToWrite * channels];
|
||||
bufSize = framesToWrite * channels;
|
||||
if (bufSize < framesToWrite * 2) {
|
||||
buffer = new int16_t[framesToWrite * 2];
|
||||
bufSize = framesToWrite * 2;
|
||||
}
|
||||
|
||||
NativeMix(buffer, framesToWrite, sampleRateHz, userdata);
|
||||
|
||||
for (int i = 0; i < framesToWrite * channels; i++) {
|
||||
int16_t value = buffer[i];
|
||||
dest[i] = (float)value * (float)(1.0f / 32767.0f);
|
||||
for (int i = 0; i < framesToWrite; i++) {
|
||||
int16_t lvalue = buffer[i * 2];
|
||||
int16_t rvalue = buffer[i * 2 + 1];
|
||||
dest[i * channels] = (float)lvalue * (float)(1.0f / 32767.0f);
|
||||
if (channels > 1) {
|
||||
dest[i * channels + 1] = (float)lvalue * (float)(1.0f / 32767.0f);
|
||||
}
|
||||
for (int j = 2; j < channels; j++) {
|
||||
dest[i * channels + j] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user