Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Cpal + wasm + WebAudioAPI setup #878

Open
venelinpetrov opened this issue Apr 25, 2024 · 0 comments
Open

[QUESTION] Cpal + wasm + WebAudioAPI setup #878

venelinpetrov opened this issue Apr 25, 2024 · 0 comments

Comments

@venelinpetrov
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant