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(AudioProcessingEvent) + Send + 'static>(
&self,
callback: F,
)
pub fn set_onaudioprocess<F: FnMut(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.
The output buffer is shipped back to the render thread when the AudioProcessingEvent goes out of scope, so be sure not to store it somewhere.
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
BaseAudioContext
. Read moreSource§fn channel_config(&self) -> &ChannelConfig
fn channel_config(&self) -> &ChannelConfig
Source§fn number_of_inputs(&self) -> usize
fn number_of_inputs(&self) -> usize
Source§fn number_of_outputs(&self) -> usize
fn number_of_outputs(&self) -> usize
Source§fn set_channel_count_mode(&self, mode: ChannelCountMode)
fn set_channel_count_mode(&self, mode: ChannelCountMode)
channel_count_mode
attributeSource§fn set_channel_count(&self, count: usize)
fn set_channel_count(&self, count: usize)
channel_count
attributeSource§fn context(&self) -> &ConcreteBaseAudioContext
fn context(&self) -> &ConcreteBaseAudioContext
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
Source§fn connect_from_output_to_input<'a>(
&self,
dest: &'a dyn AudioNode,
output: usize,
input: usize,
) -> &'a dyn AudioNode
fn connect_from_output_to_input<'a>( &self, dest: &'a dyn AudioNode, output: usize, input: usize, ) -> &'a dyn AudioNode
Source§fn disconnect(&self)
fn disconnect(&self)
Source§fn disconnect_dest(&self, dest: &dyn AudioNode)
fn disconnect_dest(&self, dest: &dyn AudioNode)
Source§fn disconnect_output(&self, output: usize)
fn disconnect_output(&self, output: usize)
Source§fn disconnect_dest_from_output(&self, dest: &dyn AudioNode, output: usize)
fn disconnect_dest_from_output(&self, dest: &dyn AudioNode, output: usize)
Source§fn disconnect_dest_from_output_to_input(
&self,
dest: &dyn AudioNode,
output: usize,
input: usize,
)
fn disconnect_dest_from_output_to_input( &self, dest: &dyn AudioNode, output: usize, input: usize, )
Source§fn channel_count_mode(&self) -> ChannelCountMode
fn channel_count_mode(&self) -> ChannelCountMode
Source§fn channel_interpretation(&self) -> ChannelInterpretation
fn channel_interpretation(&self) -> ChannelInterpretation
Source§fn set_channel_interpretation(&self, v: ChannelInterpretation)
fn set_channel_interpretation(&self, v: ChannelInterpretation)
channel_interpretation
attribute