-
Notifications
You must be signed in to change notification settings - Fork 16
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
Run diagnostics on live AudioContext #401
Conversation
@@ -344,6 +344,26 @@ impl AudioContext { | |||
self.base().clear_event_handler(EventType::SinkChange); | |||
} | |||
|
|||
#[allow(clippy::missing_panics_doc)] | |||
pub fn run_diagnostics<F: Fn(String) + Send + 'static>(&self, callback: F) { |
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.
Wondering if we should mark this method #[doc(hidden)]
because I could imagine we are not keeping the API stable over different versions. Would be interesting to return more structured data in the future
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.
yup looks reasonable
src/context/online.rs
Outdated
EventHandler::Once(Box::new(callback)), | ||
); | ||
|
||
let buffer = Vec::with_capacity(32 * 1024); |
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.
32kB ought to be enough for anybody.
-- Bill Gates
/bench because we are messing with vtables here in tight loops |
|
||
/// Return the name of the actual AudioProcessor type | ||
#[doc(hidden)] // not meant to be user facing | ||
fn name(&self) -> &'static str { |
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 method enables us to ask a Box<dyn AudioProcessor>
what its true type is (e.g. ConstantSourceRenderer). This opens the way to mute audio graph legs with no side effects like proposed in #397
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.
Nice, I'll try to make to list all the cases I can think of about this graph thing next week
|
Looks all good to me! |
Usage:
context.run_diagnostics(|s| println!("Diagnostics:\n{}", s));
It will generate a report on the next render quantum, in a somewhat realtime safe manner.
This will hopefully aid debugging of e.g. #396