CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/AudioCommon.cpp
Views: 1401
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
int __AudioMix(int16_t *outStereo, int numFrames, int sampleRateHz) {
11
int validFrames = g_resampler.Mix(outStereo, numFrames, false, sampleRateHz);
12
13
// Mix sound effects on top.
14
g_BackgroundAudio.SFX().Mix(outStereo, validFrames, sampleRateHz);
15
16
return validFrames;
17
}
18
19
void System_AudioGetDebugStats(char *buf, size_t bufSize) {
20
if (buf) {
21
g_resampler.GetAudioDebugStats(buf, bufSize);
22
} else {
23
g_resampler.ResetStatCounters();
24
}
25
}
26
27
void System_AudioClear() {
28
g_resampler.Clear();
29
}
30
31
void System_AudioPushSamples(const int32_t *audio, int numSamples) {
32
if (audio) {
33
g_resampler.PushSamples(audio, numSamples);
34
} else {
35
g_resampler.Clear();
36
}
37
}
38
39