Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/AudioCommon.cpp
3185 views
1
#include "Common/System/System.h"
2
#include "Core/HW/StereoResampler.h" // TODO: doesn't belong in Core/HW...
3
#include "UI/AudioCommon.h"
4
#include "UI/BackgroundAudio.h"
5
6
StereoResampler g_resampler;
7
8
// numFrames is number of stereo frames.
9
// This is called from *outside* the emulator thread.
10
void NativeMix(int16_t *outStereo, int numFrames, int sampleRateHz, void *userdata) {
11
g_resampler.Mix(outStereo, numFrames, false, sampleRateHz);
12
13
// Mix sound effects on top.
14
g_BackgroundAudio.SFX().Mix(outStereo, numFrames, sampleRateHz);
15
}
16
17
void System_AudioGetDebugStats(char *buf, size_t bufSize) {
18
if (buf) {
19
g_resampler.GetAudioDebugStats(buf, bufSize);
20
} else {
21
g_resampler.ResetStatCounters();
22
}
23
}
24
25
void System_AudioClear() {
26
g_resampler.Clear();
27
}
28
29
void System_AudioPushSamples(const int32_t *audio, int numSamples, float volume) {
30
if (audio) {
31
g_resampler.PushSamples(audio, numSamples, volume);
32
} else {
33
g_resampler.Clear();
34
}
35
}
36
37