cpal icon indicating copy to clipboard operation
cpal copied to clipboard

feat: implement input stream support for web backends

Open roderickvd opened this issue 1 month ago • 0 comments

Implements missing microphone/input support for WebAudio and Emscripten backends. Previously, calling any input-related methods would return empty results or panic.

Implementation

Uses navigator.mediaDevices.getUserMedia() to request microphone access, then creates a MediaStreamAudioSourceNode connected to a ScriptProcessorNode for audio capture. The async getUserMedia Promise is handled via wasm_bindgen_futures::spawn_local(), allowing the synchronous API to return immediately while permission is requested in the background.

Status

This is very preliminary and mostly untested code. Please test and report back here.

roderickvd avatar Nov 13 '25 02:11 roderickvd