[QUESTION] Cpal + wasm + WebAudioAPI setup
venelinpetrov opened this issue · 0 comments
venelinpetrov commented
Hi folks!
I found that cpal can access some low level information about audio drivers, that is otherwise inaccessible from WebAudioAPI. In particular, I would like to have access to ReaRoute, which is a driver, bundled with a DAW called Reaper. ReaRoute gives 16 inputs and 16 outputs and I was able to list them by running the enumerate.rs
example.
2. "ReaRoute ASIO (x64)"
Default input stream config:
SupportedStreamConfig { channels: 16, sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
All supported input stream configs:
2.1. SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
2.2. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
2.3. SupportedStreamConfigRange { channels: 3, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100),
...
Default output stream config:
SupportedStreamConfig { channels: 16, sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
All supported output stream configs:
2.1. SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
2.2. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
2.3. SupportedStreamConfigRange { channels: 3, min_sample_rate: SampleRate(44100), max_sample_rate: SampleRate(44100), buffer_size: Range { min: 512, max: 512 }, sample_format: I32 }
...
Now, my question is, is it possible to compile this example to WebAssemly and have full access to these inputs/outputs from WebAudioAPI? What object(s) do I need to expose from Rust to the Browser, and how to use these objects in the Browser.
Can you point me in the right direction how to achieve this goal? Thank you!