mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
sets audio samples to 0 if audio was not mixed.
This commit is contained in:
parent
c4b44d3a39
commit
1708febac1
@ -17,6 +17,9 @@
|
||||
|
||||
#pragma once
|
||||
#include "sceAudio.h"
|
||||
#ifndef SCE_AUDIO_NO_MIX
|
||||
#define SCE_AUDIO_NO_MIX -1
|
||||
#endif
|
||||
|
||||
|
||||
// Easy interface for sceAudio to write to, to keep the complexity in check.
|
||||
|
@ -28,7 +28,7 @@ int PSPMixer::Mix(short *stereoout, int numSamples)
|
||||
{
|
||||
int numFrames = __AudioMix(stereoout, numSamples);
|
||||
#ifdef _WIN32
|
||||
if (numFrames < numSamples) {
|
||||
if (numFrames < numSamples && numFrames != SCE_AUDIO_NO_MIX) {
|
||||
// Our dsound backend will not stop playing, let's just feed it zeroes if we miss data.
|
||||
memset(stereoout + 2 * 2 * numFrames, 0, 2 * 2 * (numSamples - numFrames));
|
||||
numFrames = numSamples;
|
||||
|
@ -194,13 +194,23 @@ void NativeHost::ShutdownSound() {
|
||||
|
||||
int NativeMix(short *audio, int num_samples) {
|
||||
// ILOG("Entering mixer");
|
||||
int numMixedSamples = 0;
|
||||
|
||||
if (g_mixer) {
|
||||
num_samples = g_mixer->Mix(audio, num_samples);
|
||||
} else {
|
||||
numMixedSamples = g_mixer->Mix(audio, num_samples);
|
||||
|
||||
if(numMixedSamples == SCE_AUDIO_NO_MIX) {
|
||||
goto noMix;
|
||||
}
|
||||
|
||||
} else{
|
||||
//this is the one place a goto is warranted. Still, find a way to rewrite
|
||||
//;_;
|
||||
noMix:
|
||||
memset(audio, 0, num_samples * 2 * sizeof(short));
|
||||
}
|
||||
// ILOG("Leaving mixer");
|
||||
return num_samples;
|
||||
return numMixedSamples;
|
||||
}
|
||||
|
||||
void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, bool *landscape) {
|
||||
|
Loading…
Reference in New Issue
Block a user