Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not throw an error if voice is out of range in func_play() #570

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions internal/c/parts/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2773,15 +2773,8 @@ double func_play(uint32_t voice, int32_t passed) {
return 0.0;
}

if (passed) {
if (voice >= AudioEngine::PSG_VOICES) {
error(QB_ERROR_ILLEGAL_FUNCTION_CALL);

return 0.0;
}
} else {
voice = 0; // use voice 0 by default
}
// Default to voice 0 if voice is out of range
voice = (passed && voice < AudioEngine::PSG_VOICES) ? voice : 0;

if (audioEngine.InitializePSG(voice)) {
// Only proceed if the underlying PSG is initialized
Expand Down