Skip to content

Commit 2398f05

Browse files
committed
Implement the Audio.ShowDebugPlate console command
1 parent 99e77e6 commit 2398f05

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3426,6 +3426,30 @@ PF_CONSOLE_CMD( Audio, NextDebugPlate, "", "Cycles through the volume displays f
34263426
plgAudioSys::NextDebugSound();
34273427
}
34283428

3429+
PF_CONSOLE_CMD(Audio, ShowDebugPlate, "string object, int soundIdx", "Shows the volume display for a registered sound")
3430+
{
3431+
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), "", nullptr);
3432+
if (!key) {
3433+
plSound::SetCurrDebugPlate(nullptr);
3434+
return;
3435+
}
3436+
3437+
plSceneObject* so = plSceneObject::ConvertNoRef(key->GetObjectPtr());
3438+
if (!so) {
3439+
PrintString("Invalid SceneObject");
3440+
return;
3441+
}
3442+
3443+
const plAudioInterface* ai = so->GetAudioInterface();
3444+
if (ai) {
3445+
plSound* sound = ai->GetSound(params[1]);
3446+
// sue me
3447+
plSound::SetCurrDebugPlate(sound->GetKey());
3448+
} else {
3449+
PrintString("SceneObject has no AudioInterface");
3450+
}
3451+
}
3452+
34293453
#endif // LIMIT_CONSOLE_COMMANDS
34303454

34313455
PF_CONSOLE_CMD( Audio, SetLoadOnDemand, "bool on", "Enable or disable load-on-demand for sounds")

0 commit comments

Comments
 (0)