Struct web_audio_api::node::ScriptProcessorNode
source · pub struct ScriptProcessorNode { /* private fields */ }
Expand description
An AudioNode which can generate, process, or analyse audio directly using a script (deprecated)
Implementations§
source§impl ScriptProcessorNode
impl ScriptProcessorNode
sourcepub fn new<C: BaseAudioContext>(
context: &C,
options: ScriptProcessorOptions
) -> Self
pub fn new<C: BaseAudioContext>( context: &C, options: ScriptProcessorOptions ) -> Self
Creates a ScriptProcessorNode
§Arguments
context
- Audio context in which the node will liveoptions
- node options
§Panics
This function panics if:
buffer_size
is not 256, 512, 1024, 2048, 4096, 8192, or 16384- the number of input and output channels are both zero
- either of the channel counts exceed
crate::MAX_CHANNELS
pub fn buffer_size(&self) -> usize
sourcepub fn set_onaudioprocess<F: FnMut(&mut AudioProcessingEvent) + Send + 'static>(
&self,
callback: F
)
pub fn set_onaudioprocess<F: FnMut(&mut AudioProcessingEvent) + Send + 'static>( &self, callback: F )
Register callback to run when the AudioProcessingEvent is dispatched
The event handler processes audio from the input (if any) by accessing the audio data from the inputBuffer attribute. The audio data which is the result of the processing (or the synthesized data if there are no inputs) is then placed into the outputBuffer.
Only a single event handler is active at any time. Calling this method multiple times will override the previous event handler.
sourcepub fn clear_onaudioprocess(&self)
pub fn clear_onaudioprocess(&self)
Unset the callback to run when the AudioProcessingEvent is dispatched
Trait Implementations§
source§impl AudioNode for ScriptProcessorNode
impl AudioNode for ScriptProcessorNode
source§fn registration(&self) -> &AudioContextRegistration
fn registration(&self) -> &AudioContextRegistration
Handle of the associated
BaseAudioContext
. Read moresource§fn channel_config(&self) -> &ChannelConfig
fn channel_config(&self) -> &ChannelConfig
Config for up/down-mixing of input channels for this node. Read more
source§fn number_of_inputs(&self) -> usize
fn number_of_inputs(&self) -> usize
The number of inputs feeding into the AudioNode. For source nodes, this will be 0.
source§fn number_of_outputs(&self) -> usize
fn number_of_outputs(&self) -> usize
The number of outputs coming out of the AudioNode.
source§fn set_channel_count_mode(&self, mode: ChannelCountMode)
fn set_channel_count_mode(&self, mode: ChannelCountMode)
Update the
channel_count_mode
attributesource§fn set_channel_count(&self, count: usize)
fn set_channel_count(&self, count: usize)
Update the
channel_count
attributesource§fn context(&self) -> &ConcreteBaseAudioContext
fn context(&self) -> &ConcreteBaseAudioContext
The
BaseAudioContext
concrete type which owns this
AudioNode.source§fn connect<'a>(&self, dest: &'a dyn AudioNode) -> &'a dyn AudioNode
fn connect<'a>(&self, dest: &'a dyn AudioNode) -> &'a dyn AudioNode
Connect the output of this AudioNode to the input of another node. Read more
source§fn connect_at<'a>(
&self,
dest: &'a dyn AudioNode,
output: usize,
input: usize
) -> &'a dyn AudioNode
fn connect_at<'a>( &self, dest: &'a dyn AudioNode, output: usize, input: usize ) -> &'a dyn AudioNode
Connect a specific output of this AudioNode to a specific input of another node. Read more
source§fn disconnect_from<'a>(&self, dest: &'a dyn AudioNode) -> &'a dyn AudioNode
fn disconnect_from<'a>(&self, dest: &'a dyn AudioNode) -> &'a dyn AudioNode
Disconnects all outputs of the AudioNode that go to a specific destination AudioNode.
source§fn disconnect(&self)
fn disconnect(&self)
Disconnects all outgoing connections from the AudioNode.
source§fn channel_count_mode(&self) -> ChannelCountMode
fn channel_count_mode(&self) -> ChannelCountMode
Represents an enumerated value describing the way channels must be matched between the
node’s inputs and outputs.
source§fn channel_interpretation(&self) -> ChannelInterpretation
fn channel_interpretation(&self) -> ChannelInterpretation
Represents an enumerated value describing the meaning of the channels. This interpretation
will define how audio up-mixing and down-mixing will happen.
source§fn set_channel_interpretation(&self, v: ChannelInterpretation)
fn set_channel_interpretation(&self, v: ChannelInterpretation)
Update the
channel_interpretation
attributesource§fn channel_count(&self) -> usize
fn channel_count(&self) -> usize
Represents an integer used to determine how many channels are used when up-mixing and
down-mixing connections to any inputs to the node.
source§fn set_onprocessorerror(
&self,
callback: Box<dyn FnOnce(ErrorEvent) + Send + 'static>
)
fn set_onprocessorerror( &self, callback: Box<dyn FnOnce(ErrorEvent) + Send + 'static> )
Register callback to run when an unhandled exception occurs in the audio processor. Read more
source§fn clear_onprocessorerror(&self)
fn clear_onprocessorerror(&self)
Unset the callback to run when an unhandled exception occurs in the audio processor.
Auto Trait Implementations§
impl Freeze for ScriptProcessorNode
impl RefUnwindSafe for ScriptProcessorNode
impl Send for ScriptProcessorNode
impl Sync for ScriptProcessorNode
impl Unpin for ScriptProcessorNode
impl UnwindSafe for ScriptProcessorNode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more