pub struct GainNode { /* private fields */ }Expand description
A node that adjusts the volume (gain) of the input signal.
Supports dynamic gain updates via ControlMessage::SetParameter.
§Example
use rust_audio_api::nodes::{GainNode, NodeType};
use rust_audio_api::{AudioContext, NodeParameter};
let mut ctx = AudioContext::new().unwrap();
let mut gain_id = None;
let dest_id = ctx.build_graph(|builder| {
let gain = builder.add_node(NodeType::Gain(GainNode::new(0.5)));
gain_id = Some(gain);
gain
});
// Dynamically change the gain to 1.0 (full volume)
ctx.control_sender().send(
rust_audio_api::graph::ControlMessage::SetParameter(
gain_id.unwrap(),
NodeParameter::Gain(1.0)
)
).unwrap();Implementations§
Auto Trait Implementations§
impl Freeze for GainNode
impl RefUnwindSafe for GainNode
impl Send for GainNode
impl Sync for GainNode
impl Unpin for GainNode
impl UnsafeUnpin for GainNode
impl UnwindSafe for GainNode
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