cpal
cpal copied to clipboard
feat: implement input stream support for web backends
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.