Skip to content

Commit

Permalink
Added simple test to get the quantum size from the context
Browse files Browse the repository at this point in the history
  • Loading branch information
cwoffenden committed Oct 9, 2024
1 parent 9033505 commit 61745c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/webaudio/audio_worklet_tone_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ bool observe_test_end(double time, void *userData) {
void AudioWorkletProcessorCreated(EMSCRIPTEN_WEBAUDIO_T audioContext, bool success, void *userData) {
if (!success) return;

// Get the buffer's quantum size, we'll report this later
int quantumSize = emscripten_audio_context_quantum_size(audioContext);

// Specify the input and output node configurations for the Wasm Audio
// Worklet. A simple setup with single mono output channel here, and no
// inputs.
Expand Down Expand Up @@ -98,7 +101,12 @@ void AudioWorkletProcessorCreated(EMSCRIPTEN_WEBAUDIO_T audioContext, bool succe
audioContext.suspend();
}
};
}, audioContext);

// Report the buffer size out of interest
let quantumText = document.createElement('p');
quantumText.innerHTML += `(Buffer quantum size: ${$1})`;
document.body.appendChild(quantumText);
}, audioContext, quantumSize);

#ifdef REPORT_RESULT
emscripten_set_timeout_loop(observe_test_end, 10, 0);
Expand Down

0 comments on commit 61745c0

Please sign in to comment.