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: usizeMedia instance ID.
client_context_id: ClientContextIdClient 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: f32Number of samples that will be played in one second.
dest_node: NodeIdThe 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, ) -> Option<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)
Sourcepub fn disconnect_output(&self, out: PortId<OutputPort>)
pub fn disconnect_output(&self, out: PortId<OutputPort>)
Disconnect all outgoing connections from a node’s output
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output>
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
Sourcepub fn disconnect_output_between_to(
&self,
out: PortId<OutputPort>,
inp: PortId<InputPort>,
)
pub fn disconnect_output_between_to( &self, out: PortId<OutputPort>, inp: PortId<InputPort>, )
Disconnect all outgoing connections from a node’s output to another node’s input
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input
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.
pub fn set_eos_callback(&self, callback: SinkEosCallback)
fn set_mute(&self, val: bool)
Trait Implementations§
Source§impl Drop for AudioContext
impl Drop for AudioContext
Source§impl MallocSizeOf for AudioContext
impl MallocSizeOf for AudioContext
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl !Freeze for AudioContext
impl !RefUnwindSafe for AudioContext
impl Send for AudioContext
impl !Sync for AudioContext
impl Unpin for AudioContext
impl !UnwindSafe for AudioContext
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more