diff options
author | chansuke <chansuke@georepublic.de> | 2018-09-18 23:24:15 +0900 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-09-19 17:40:47 -0400 |
commit | c37a345dc9f4dda6ea29c42f96f6c7201c42cbac (patch) | |
tree | 1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/audioparam.rs | |
parent | 2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff) | |
download | servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip |
Format script component
Diffstat (limited to 'components/script/dom/audioparam.rs')
-rw-r--r-- | components/script/dom/audioparam.rs | 82 |
1 files changed, 36 insertions, 46 deletions
diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audioparam.rs index db73619180f..40826790cbf 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audioparam.rs @@ -76,7 +76,9 @@ impl AudioParam { } fn message_node(&self, message: AudioNodeMessage) { - self.context.audio_context_impl().message_node(self.node, message); + self.context + .audio_context_impl() + .message_node(self.node, message); } pub fn context(&self) -> &BaseAudioContext { @@ -101,25 +103,25 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate fn SetAutomationRate(&self, automation_rate: AutomationRate) { self.automation_rate.set(automation_rate); - self.message_node( - AudioNodeMessage::SetParamRate(self.param, automation_rate.into()) - ); + self.message_node(AudioNodeMessage::SetParamRate( + self.param, + automation_rate.into(), + )); } // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn Value(&self) -> Finite<f32> { let (tx, rx) = mpsc::channel(); - self.message_node( - AudioNodeMessage::GetParamValue(self.param, tx) - ); + self.message_node(AudioNodeMessage::GetParamValue(self.param, tx)); Finite::wrap(rx.recv().unwrap()) } // https://webaudio.github.io/web-audio-api/#dom-audioparam-value fn SetValue(&self, value: Finite<f32>) { - self.message_node( - AudioNodeMessage::SetParam(self.param, UserAutomationEvent::SetValue(*value)), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::SetValue(*value), + )); } // https://webaudio.github.io/web-audio-api/#dom-audioparam-defaultvalue @@ -139,12 +141,10 @@ impl AudioParamMethods for AudioParam { // https://webaudio.github.io/web-audio-api/#dom-audioparam-setvalueattime fn SetValueAtTime(&self, value: Finite<f32>, start_time: Finite<f64>) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::SetValueAtTime(*value, *start_time), - ) - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::SetValueAtTime(*value, *start_time), + )); DomRoot::from_ref(self) } @@ -154,12 +154,10 @@ impl AudioParamMethods for AudioParam { value: Finite<f32>, end_time: Finite<f64>, ) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::RampToValueAtTime(RampKind::Linear, *value, *end_time), - ), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::RampToValueAtTime(RampKind::Linear, *value, *end_time), + )); DomRoot::from_ref(self) } @@ -169,12 +167,10 @@ impl AudioParamMethods for AudioParam { value: Finite<f32>, end_time: Finite<f64>, ) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::RampToValueAtTime(RampKind::Exponential, *value, *end_time), - ), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::RampToValueAtTime(RampKind::Exponential, *value, *end_time), + )); DomRoot::from_ref(self) } @@ -185,34 +181,28 @@ impl AudioParamMethods for AudioParam { start_time: Finite<f64>, time_constant: Finite<f32>, ) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::SetTargetAtTime(*target, *start_time, (*time_constant).into()), - ), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::SetTargetAtTime(*target, *start_time, (*time_constant).into()), + )); DomRoot::from_ref(self) } // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelscheduledvalues fn CancelScheduledValues(&self, cancel_time: Finite<f64>) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::CancelScheduledValues(*cancel_time), - ), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::CancelScheduledValues(*cancel_time), + )); DomRoot::from_ref(self) } // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelandholdattime fn CancelAndHoldAtTime(&self, cancel_time: Finite<f64>) -> DomRoot<AudioParam> { - self.message_node( - AudioNodeMessage::SetParam( - self.param, - UserAutomationEvent::CancelAndHoldAtTime(*cancel_time), - ), - ); + self.message_node(AudioNodeMessage::SetParam( + self.param, + UserAutomationEvent::CancelAndHoldAtTime(*cancel_time), + )); DomRoot::from_ref(self) } } |