Struct servo_media_audio::context::AudioContext
source · pub struct AudioContext {
id: usize,
client_context_id: ClientContextId,
backend_chan: Arc<Mutex<Sender<BackendMsg>>>,
sender: Sender<AudioRenderThreadMsg>,
state: Cell<ProcessingState>,
sample_rate: f32,
dest_node: NodeId,
listener: NodeId,
make_decoder: Arc<dyn Fn() -> Box<dyn AudioDecoder> + Sync + Send>,
}
Expand description
Representation of an audio context on the control thread.
Fields§
§id: usize
Media instance ID.
client_context_id: ClientContextId
Client context ID.
backend_chan: Arc<Mutex<Sender<BackendMsg>>>
Owner backend communication channel.
sender: Sender<AudioRenderThreadMsg>
Rendering thread communication channel.
state: Cell<ProcessingState>
State of the audio context on the control thread.
sample_rate: f32
Number of samples that will be played in one second.
dest_node: NodeId
The identifier of an AudioDestinationNode with a single input representing the final destination for all audio.
listener: NodeId
§make_decoder: Arc<dyn Fn() -> Box<dyn AudioDecoder> + Sync + Send>
Implementations§
source§impl AudioContext
impl AudioContext
sourcepub fn new<B: AudioBackend>(
id: usize,
client_context_id: &ClientContextId,
backend_chan: Arc<Mutex<Sender<BackendMsg>>>,
options: AudioContextOptions,
) -> Result<Self, AudioSinkError>
pub fn new<B: AudioBackend>( id: usize, client_context_id: &ClientContextId, backend_chan: Arc<Mutex<Sender<BackendMsg>>>, options: AudioContextOptions, ) -> Result<Self, AudioSinkError>
Constructs a new audio context.
pub fn state(&self) -> ProcessingState
pub fn dest_node(&self) -> NodeId
pub fn listener(&self) -> NodeId
pub fn current_time(&self) -> f64
pub fn create_node(&self, node_type: AudioNodeInit, ch: ChannelInfo) -> NodeId
pub fn resume(&self) -> StateChangeResult
pub fn suspend(&self) -> StateChangeResult
pub fn close(&self) -> StateChangeResult
pub fn message_node(&self, id: NodeId, msg: AudioNodeMessage)
pub fn connect_ports(&self, from: PortId<OutputPort>, to: PortId<InputPort>)
pub fn disconnect_all_from(&self, node: NodeId)
pub fn disconnect_output(&self, out: PortId<OutputPort>)
sourcepub fn disconnect_between(&self, from: NodeId, to: NodeId)
pub fn disconnect_between(&self, from: NodeId, to: NodeId)
Disconnect connections from a node to another node
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode
sourcepub fn disconnect_to(&self, from: NodeId, to: PortId<InputPort>)
pub fn disconnect_to(&self, from: NodeId, to: PortId<InputPort>)
Disconnect connections from a node to another node’s input
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam
sourcepub fn disconnect_output_between(&self, out: PortId<OutputPort>, to: NodeId)
pub fn disconnect_output_between(&self, out: PortId<OutputPort>, to: NodeId)
Disconnect all outgoing connections from a node’s output to another node
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output
pub fn disconnect_output_between_to( &self, out: PortId<OutputPort>, inp: PortId<InputPort>, )
sourcepub fn decode_audio_data(&self, data: Vec<u8>, callbacks: AudioDecoderCallbacks)
pub fn decode_audio_data(&self, data: Vec<u8>, callbacks: AudioDecoderCallbacks)
Asynchronously decodes the audio file data contained in the given buffer.