audio: fix incorrect dynCall in Emscripten audio.

This only seemed to cause problems with `-s ASYNCIFY` on the build command
line, but it was incorrect in general.

Fixes #11258.
This commit is contained in:
Ryan C. Gordon 2024-10-18 23:52:23 -04:00
parent 07bb8f1c4c
commit b6a6a4a7f8
No known key found for this signature in database
GPG Key ID: FA148B892AB48044

View File

@ -233,7 +233,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
if ((SDL3 === undefined) || (SDL3.audio_recording === undefined)) { return; } if ((SDL3 === undefined) || (SDL3.audio_recording === undefined)) { return; }
audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0);
SDL3.audio_recording.currentRecordingBuffer = audioProcessingEvent.inputBuffer; SDL3.audio_recording.currentRecordingBuffer = audioProcessingEvent.inputBuffer;
dynCall('vi', $2, [$3]); dynCall('ii', $2, [$3]);
}; };
SDL3.audio_recording.mediaStreamNode.connect(SDL3.audio_recording.scriptProcessorNode); SDL3.audio_recording.mediaStreamNode.connect(SDL3.audio_recording.scriptProcessorNode);
SDL3.audio_recording.scriptProcessorNode.connect(SDL3.audioContext.destination); SDL3.audio_recording.scriptProcessorNode.connect(SDL3.audioContext.destination);
@ -249,7 +249,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
SDL3.audio_recording.silenceBuffer.getChannelData(0).fill(0.0); SDL3.audio_recording.silenceBuffer.getChannelData(0).fill(0.0);
var silence_callback = function() { var silence_callback = function() {
SDL3.audio_recording.currentRecordingBuffer = SDL3.audio_recording.silenceBuffer; SDL3.audio_recording.currentRecordingBuffer = SDL3.audio_recording.silenceBuffer;
dynCall('vi', $2, [$3]); dynCall('ii', $2, [$3]);
}; };
SDL3.audio_recording.silenceTimer = setInterval(silence_callback, ($1 / SDL3.audioContext.sampleRate) * 1000); SDL3.audio_recording.silenceTimer = setInterval(silence_callback, ($1 / SDL3.audioContext.sampleRate) * 1000);
@ -274,7 +274,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
SDL3.audio_playback.silenceBuffer = undefined; SDL3.audio_playback.silenceBuffer = undefined;
} }
SDL3.audio_playback.currentPlaybackBuffer = e['outputBuffer']; SDL3.audio_playback.currentPlaybackBuffer = e['outputBuffer'];
dynCall('vi', $2, [$3]); dynCall('ii', $2, [$3]);
}; };
SDL3.audio_playback.scriptProcessorNode['connect'](SDL3.audioContext['destination']); SDL3.audio_playback.scriptProcessorNode['connect'](SDL3.audioContext['destination']);
@ -292,7 +292,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
// the buffer that gets filled here just gets ignored, so the app can make progress // the buffer that gets filled here just gets ignored, so the app can make progress
// and/or avoid flooding audio queues until we can actually play audio. // and/or avoid flooding audio queues until we can actually play audio.
SDL3.audio_playback.currentPlaybackBuffer = SDL3.audio_playback.silenceBuffer; SDL3.audio_playback.currentPlaybackBuffer = SDL3.audio_playback.silenceBuffer;
dynCall('vi', $2, [$3]); dynCall('ii', $2, [$3]);
SDL3.audio_playback.currentPlaybackBuffer = undefined; SDL3.audio_playback.currentPlaybackBuffer = undefined;
}; };