-
Notifications
You must be signed in to change notification settings - Fork 19
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
Render audio graph without emitting to the speakers #234
Conversation
/// The audio output device - use `None` for the default device | ||
pub sink_id: Option<String>, | ||
|
||
/// The audio output device |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is terrible and I know it. The spec is not much better. I will explore other options
d3d5269
to
2cbab59
Compare
Before: `Option<Option<String>>` /// - use `None` for the default device /// - use `Some(None)` to process the audio graph without playing through an audio output device. /// - use `Some(Some(sinkId))` to use the specified audio sink id, obtained with `enumerate_devices` After: `Option<String>` /// - use `None` to process the audio graph without playing through an audio output device. /// - use `Some("")` for the default audio output device /// - use `Some(sinkId)` to use the specified audio sink id, obtained with `enumerate_devices` We now require the user to specify `Some("")` for the default audio device. In the docs we suggest to use the `::default()` implementation so you are not required to think about it for most usecases.
Hi @b-ma I would love your opinion on my latest API-compliance decision:
|
This comment was marked as outdated.
This comment was marked as outdated.
Hey! yup I try to check that today or tomorrow |
Hey, after reading the spec (which I'm really not sure I understood well) and read again (...a bit fast) WebAudio/web-audio-api#2400, I would personally go for the very simple:
This is not very elegant, but much more simple in my opinion... and as the Maybe we should mark the whole thing as unstable until this is implemented in Chrome or Firefox so that we can compare with what they did, to see if we didn't miss something? |
src/context/online.rs
Outdated
@@ -9,6 +11,20 @@ use crate::AudioRenderCapacity; | |||
use std::error::Error; | |||
use std::sync::Mutex; | |||
|
|||
/// Check if the provided sink_id is available for playback | |||
/// | |||
/// It should be `None` of `Some(sinkId)` where `sinkId` is returned from `enumerate_devices` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be None
of or Some(sinkId)
?
No more nested `Option`, just a plain `String`: - use `""` for the default audio output device - use `"none"` to process the audio graph without playing through an audio output device. - use `"sinkId"` to use the specified audio sink id, obtained with [`enumerate_devices`]
Thanks for the suggestion. Way simpler indeed. |
|
This is the third PR for #216
There are some leftover To-dos and your review comments that I will address soon. Thanks for having a look!