pub struct AudioParam { /* private fields */ }Expand description
The AudioParam class.
AudioParam
Implementations§
Source§impl AudioParam
impl AudioParam
Sourcepub fn value(&self) -> f32
pub fn value(&self) -> f32
Getter of the value attribute.
AudioParam.value
Sourcepub fn set_value(&mut self, value: f32)
pub fn set_value(&mut self, value: f32)
Setter of the value attribute.
AudioParam.value
Examples found in repository?
4fn main() {
5 let context = AudioContext::new();
6 println!("Got an AudioContext");
7
8 // Create oscillator
9 let mut oscillator = context.create_oscillator();
10 println!("Configuring oscillator");
11 oscillator.set_type_(&OscillatorType::TRIANGLE);
12 oscillator.frequency().set_value(261.63); // Middle C
13
14 let document = window().document();
15 let body = document.get_elements_by_tag_name(&"body".into()).item(0);
16 let mut button = document
17 .create_element(&"BUTTON".into())
18 .dyn_into::<HTMLButtonElement>()
19 .unwrap();
20
21 button.set_text_content(&"Click me".into());
22 button.add_event_listener(
23 &JsString::from("click"),
24 &EventListener::from_closure(move |_e: Event| {
25 println!("Playing");
26 oscillator.connect_with_destination_param(
27 context.destination().unchecked_ref::<AudioParam>(),
28 );
29 oscillator.start_with_when(0.0);
30 println!("All done!");
31 Undefined::VALUE
32 }),
33 );
34 body.append_child(button.dyn_ref::<Node>().unwrap());
35}Source§impl AudioParam
impl AudioParam
Sourcepub fn automation_rate(&self) -> AutomationRate
pub fn automation_rate(&self) -> AutomationRate
Getter of the automationRate attribute.
AudioParam.automationRate
Sourcepub fn set_automation_rate(&mut self, value: &AutomationRate)
pub fn set_automation_rate(&mut self, value: &AutomationRate)
Setter of the automationRate attribute.
AudioParam.automationRate
Source§impl AudioParam
impl AudioParam
Sourcepub fn default_value(&self) -> f32
pub fn default_value(&self) -> f32
Getter of the defaultValue attribute.
AudioParam.defaultValue
Source§impl AudioParam
impl AudioParam
Sourcepub fn min_value(&self) -> f32
pub fn min_value(&self) -> f32
Getter of the minValue attribute.
AudioParam.minValue
Source§impl AudioParam
impl AudioParam
Sourcepub fn max_value(&self) -> f32
pub fn max_value(&self) -> f32
Getter of the maxValue attribute.
AudioParam.maxValue
Source§impl AudioParam
impl AudioParam
Sourcepub fn set_value_at_time(&self, value: f32, start_time: f64) -> AudioParam
pub fn set_value_at_time(&self, value: f32, start_time: f64) -> AudioParam
The setValueAtTime method.
AudioParam.setValueAtTime
Source§impl AudioParam
impl AudioParam
Sourcepub fn linear_ramp_to_value_at_time(
&self,
value: f32,
end_time: f64,
) -> AudioParam
pub fn linear_ramp_to_value_at_time( &self, value: f32, end_time: f64, ) -> AudioParam
The linearRampToValueAtTime method.
AudioParam.linearRampToValueAtTime
Source§impl AudioParam
impl AudioParam
Sourcepub fn exponential_ramp_to_value_at_time(
&self,
value: f32,
end_time: f64,
) -> AudioParam
pub fn exponential_ramp_to_value_at_time( &self, value: f32, end_time: f64, ) -> AudioParam
The exponentialRampToValueAtTime method.
AudioParam.exponentialRampToValueAtTime
Source§impl AudioParam
impl AudioParam
Sourcepub fn set_target_at_time(
&self,
target: f32,
start_time: f64,
time_constant: f32,
) -> AudioParam
pub fn set_target_at_time( &self, target: f32, start_time: f64, time_constant: f32, ) -> AudioParam
The setTargetAtTime method.
AudioParam.setTargetAtTime
Source§impl AudioParam
impl AudioParam
Sourcepub fn set_value_curve_at_time(
&self,
values: TypedArray<f32>,
start_time: f64,
duration: f64,
) -> AudioParam
pub fn set_value_curve_at_time( &self, values: TypedArray<f32>, start_time: f64, duration: f64, ) -> AudioParam
The setValueCurveAtTime method.
AudioParam.setValueCurveAtTime
Source§impl AudioParam
impl AudioParam
Sourcepub fn cancel_scheduled_values(&self, cancel_time: f64) -> AudioParam
pub fn cancel_scheduled_values(&self, cancel_time: f64) -> AudioParam
The cancelScheduledValues method.
AudioParam.cancelScheduledValues
Source§impl AudioParam
impl AudioParam
Sourcepub fn cancel_and_hold_at_time(&self, cancel_time: f64) -> AudioParam
pub fn cancel_and_hold_at_time(&self, cancel_time: f64) -> AudioParam
The cancelAndHoldAtTime method.
AudioParam.cancelAndHoldAtTime
Methods from Deref<Target = Any>§
Sourcepub fn has_own_property(&self, prop: &str) -> bool
pub fn has_own_property(&self, prop: &str) -> bool
Checks whether a non-inherited property prop exists
Sourcepub fn at<T>(&self, idx: T) -> Val
pub fn at<T>(&self, idx: T) -> Val
Gets the element at index idx. Assumes the underlying js type is indexable
Sourcepub fn to_vec<V>(&self) -> Vec<V>where
V: FromVal,
pub fn to_vec<V>(&self) -> Vec<V>where
V: FromVal,
Converts the underlying js array to a Vec of V
Sourcepub fn call(&self, f: &str, args: &[Val]) -> Val
pub fn call(&self, f: &str, args: &[Val]) -> Val
Calls the method f with args, can return an undefined js value
Sourcepub fn new(&self, args: &[Val]) -> Val
pub fn new(&self, args: &[Val]) -> Val
Calls the object’s constructor with args constructing a new object
Sourcepub fn invoke(&self, args: &[Val]) -> Val
pub fn invoke(&self, args: &[Val]) -> Val
Invokes the function object with args, can return an undefined js value
Sourcepub fn instanceof(&self, v: Val) -> bool
pub fn instanceof(&self, v: Val) -> bool
Checks whether this Val is an instanceof v
pub fn is_number(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_null(&self) -> bool
pub fn is_undefined(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_function(&self) -> bool
pub fn as_<T>(&self) -> Twhere
T: FromVal,
Trait Implementations§
Source§impl AsMut<Val> for AudioParam
impl AsMut<Val> for AudioParam
Source§impl AsRef<Val> for AudioParam
impl AsRef<Val> for AudioParam
Source§impl Clone for AudioParam
impl Clone for AudioParam
Source§fn clone(&self) -> AudioParam
fn clone(&self) -> AudioParam
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudioParam
impl Debug for AudioParam
Source§impl Deref for AudioParam
impl Deref for AudioParam
Source§impl DerefMut for AudioParam
impl DerefMut for AudioParam
Source§impl DynCast for AudioParam
impl DynCast for AudioParam
Source§fn instanceof(val: &Any) -> bool
fn instanceof(val: &Any) -> bool
val instanceof ThisType.Source§fn unchecked_from_val(v: Any) -> Self
fn unchecked_from_val(v: Any) -> Self
Val into Self.Source§fn unchecked_from_val_ref(v: &Any) -> &Self
fn unchecked_from_val_ref(v: &Any) -> &Self
&Val into &Self.Source§fn unchecked_from_val_mut(v: &mut Any) -> &mut Self
fn unchecked_from_val_mut(v: &mut Any) -> &mut Self
&mut Val into &mut Self.fn has_type<T>(&self) -> boolwhere
T: DynCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: DynCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: DynCast,
fn dyn_mut<T>(&mut self) -> Option<&mut T>where
T: DynCast,
fn unchecked_into<T>(self) -> Twhere
T: DynCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: DynCast,
fn unchecked_mut<T>(&mut self) -> &mut Twhere
T: DynCast,
fn is_instance_of<T>(&self) -> boolwhere
T: DynCast,
Source§fn is_type_of(val: &Val) -> bool
fn is_type_of(val: &Val) -> bool
instanceof.