mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Show simple info about currently playing audio in on-screen Debug Statistics
This commit is contained in:
parent
541a5e2c51
commit
22f71f1e9a
5 changed files with 38 additions and 2 deletions
|
@ -577,6 +577,14 @@ static u32 __sceSasUnsetATRAC3(u32 core, int voiceNum) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void __SasGetDebugStats(char *stats, size_t bufsize) {
|
||||
if (sas) {
|
||||
sas->GetDebugText(stats, bufsize);
|
||||
} else {
|
||||
snprintf(stats, bufsize, "Sas not initialized");
|
||||
}
|
||||
}
|
||||
|
||||
const HLEFunction sceSasCore[] =
|
||||
{
|
||||
{0X42778A9F, &WrapU_UUUUU<sceSasInit>, "__sceSasInit", 'x', "xxxxx" },
|
||||
|
|
|
@ -21,4 +21,6 @@ void __SasInit();
|
|||
void __SasDoState(PointerWrap &p);
|
||||
void __SasShutdown();
|
||||
|
||||
void __SasGetDebugStats(char *stats, size_t bufsize);
|
||||
|
||||
void Register_sceSasCore();
|
||||
|
|
|
@ -345,6 +345,26 @@ SasInstance::~SasInstance() {
|
|||
ClearGrainSize();
|
||||
}
|
||||
|
||||
void SasInstance::GetDebugText(char *text, size_t bufsize) {
|
||||
char voiceBuf[4096];
|
||||
voiceBuf[0] = '\0';
|
||||
char *p = voiceBuf;
|
||||
for (int i = 0; i < maxVoices; i++) {
|
||||
if (voices[i].playing) {
|
||||
p += snprintf(p, sizeof(voiceBuf) - (p - voiceBuf), " %d: Pitch: %d L/R: %d,%d FX-L/R: %d,%d VAG: %08x:%d Height:%d\n", i, voices[i].pitch, voices[i].volumeLeft, voices[i].volumeRight, voices[i].effectLeft, voices[i].effectRight, voices[i].vagAddr, voices[i].vagSize, voices[i].envelope.GetHeight());
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(text, bufsize,
|
||||
"SR: %d Mode: %s Grain: %d\n"
|
||||
"Effect: Type: %d Dry: %d Wet: %d L: %d R: %d Delay: %d Feedback: %d\n"
|
||||
"\n%s\n",
|
||||
sampleRate, outputMode == PSP_SAS_OUTPUTMODE_RAW ? "Raw" : "Mixed", grainSize,
|
||||
waveformEffect.type, waveformEffect.isDryOn, waveformEffect.isWetOn, waveformEffect.leftVol, waveformEffect.rightVol, waveformEffect.delay, waveformEffect.feedback,
|
||||
voiceBuf);
|
||||
|
||||
}
|
||||
|
||||
void SasInstance::ClearGrainSize() {
|
||||
delete[] mixBuffer;
|
||||
delete[] sendBuffer;
|
||||
|
@ -500,7 +520,6 @@ void SasInstance::MixVoice(SasVoice &voice) {
|
|||
// TODO: Special case no-resample case (and 2x and 0.5x) for speed, it's not uncommon
|
||||
|
||||
u32 sampleFrac = voice.sampleFrac;
|
||||
// We need to shift by 12 anyway, so combine that with the volume shift.
|
||||
for (int i = 0; i < grainSize; i++) {
|
||||
// For now: nearest neighbour, not even using the resample history at all.
|
||||
int sample = resampleBuffer[sampleFrac / PSP_SAS_PITCH_BASE + 2];
|
||||
|
@ -562,7 +581,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
|
|||
if (outputMode == PSP_SAS_OUTPUTMODE_MIXED) {
|
||||
// Okay, apply effects processing to the Send buffer.
|
||||
// TODO: Is this only done in PSP_SAS_OUTPUTMODE_MIXED?
|
||||
if (waveformEffect.type != PSP_SAS_EFFECT_TYPE_OFF) {
|
||||
if (waveformEffect.type != PSP_SAS_EFFECT_TYPE_OFF && waveformEffect.isWetOn) {
|
||||
ApplyWaveformEffect();
|
||||
// TODO: Mix send when it has proper values, probably based on dry/wet?
|
||||
if (inp) {
|
||||
|
|
|
@ -292,6 +292,8 @@ public:
|
|||
void ApplyWaveformEffect();
|
||||
void SetWaveformEffectType(int type);
|
||||
|
||||
void GetDebugText(char *text, size_t bufsize);
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
SasVoice voices[PSP_SAS_VOICES_MAX];
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "GPU/GLES/Framebuffer.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "Core/HLE/sceSas.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
|
@ -794,6 +795,10 @@ static void DrawDebugStats(DrawBuffer *draw2d) {
|
|||
draw2d->SetFontScale(.7f, .7f);
|
||||
draw2d->DrawText(UBUNTU24, statbuf, 11, 31, 0xc0000000, FLAG_DYNAMIC_ASCII);
|
||||
draw2d->DrawText(UBUNTU24, statbuf, 10, 30, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
|
||||
|
||||
__SasGetDebugStats(statbuf, sizeof(statbuf));
|
||||
draw2d->DrawText(UBUNTU24, statbuf, PSP_CoreParameter().pixelWidth / 2 + 11, 31, 0xc0000000, FLAG_DYNAMIC_ASCII);
|
||||
draw2d->DrawText(UBUNTU24, statbuf, PSP_CoreParameter().pixelWidth / 2 + 10, 30, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
|
||||
draw2d->SetFontScale(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue