Skip to content

Commit 4d24bc1

Browse files
committed
AudioProcessor trait: document the origin of the onmessage method
1 parent f36bc48 commit 4d24bc1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/context/base.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub trait BaseAudioContext {
2525
/// Construct a new pair of [`AudioNode`] and [`AudioProcessor`]
2626
///
2727
/// The `AudioNode` lives in the user-facing control thread. The Processor is sent to the render thread.
28+
///
29+
/// Check the `examples/worklet.rs` file for example usage of this method.
2830
fn register<
2931
T: AudioNode,
3032
F: FnOnce(AudioContextRegistration) -> (T, Box<dyn AudioProcessor>),

src/render/processor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ pub trait AudioProcessor: Send {
105105
/// via
106106
/// [`AudioContextRegistration::post_message`](crate::context::AudioContextRegistration::post_message).
107107
/// This will not be necessary for most processors.
108+
///
109+
/// This method is just a shim of the full
110+
/// [`MessagePort`](https://webaudio.github.io/web-audio-api/#dom-audioworkletprocessor-port)
111+
/// `onmessage` functionality of the AudioWorkletProcessor.
108112
#[allow(unused_variables)]
109113
fn onmessage(&mut self, msg: Box<dyn Any + Send + 'static>) {
110114
log::warn!("Ignoring incoming message");

0 commit comments

Comments
 (0)