New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement deprecated setPosition and setOrientation methods for AudioListener #22898 #23279
Merged
+42
−21
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
| @@ -6,9 +6,13 @@ use crate::dom::audioparam::AudioParam; | ||
| use crate::dom::baseaudiocontext::BaseAudioContext; | ||
| use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::{self, AudioListenerMethods}; | ||
| use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; | ||
| use crate::dom::bindings::error::Fallible; | ||
| use crate::dom::bindings::num::Finite; | ||
| use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; | ||
| use crate::dom::bindings::root::{Dom, DomRoot}; | ||
| use crate::dom::window::Window; | ||
|
|
||
| use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AudioParamMethods; | ||
| use dom_struct::dom_struct; | ||
| use servo_media::audio::param::{ParamDir, ParamType}; | ||
| use std::f32; | ||
| @@ -121,6 +125,7 @@ impl AudioListener { | ||
| f32::MIN, // min value | ||
| f32::MAX, // max value | ||
| ); | ||
|
|
||
| AudioListener { | ||
| reflector_: Reflector::new(), | ||
| position_x: Dom::from_ref(&position_x), | ||
| @@ -181,4 +186,36 @@ impl AudioListenerMethods for AudioListener { | ||
| fn UpZ(&self) -> DomRoot<AudioParam> { | ||
| DomRoot::from_ref(&self.up_z) | ||
| } | ||
|
|
||
| // https://webaudio.github.io/web-audio-api/#dom-audiolistener-setorientation | ||
| fn SetOrientation( | ||
| &self, | ||
| x: Finite<f32>, | ||
| y: Finite<f32>, | ||
| z: Finite<f32>, | ||
| xUp: Finite<f32>, | ||
| yUp: Finite<f32>, | ||
| zUp: Finite<f32>, | ||
| ) -> Fallible<DomRoot<AudioListener>> { | ||
| self.forward_x.SetValue(x); | ||
| self.forward_y.SetValue(y); | ||
| self.forward_z.SetValue(z); | ||
| self.up_x.SetValue(xUp); | ||
| self.up_y.SetValue(yUp); | ||
|
This conversation was marked as resolved
by jdm
Akhilesh1996
Contributor
|
||
| self.up_z.SetValue(zUp); | ||
| Ok(DomRoot::from_ref(self)) | ||
| } | ||
|
|
||
| // https://webaudio.github.io/web-audio-api/#dom-audiolistener-setposition | ||
| fn SetPosition( | ||
| &self, | ||
| x: Finite<f32>, | ||
| y: Finite<f32>, | ||
| z: Finite<f32>, | ||
| ) -> Fallible<DomRoot<AudioListener>> { | ||
| self.position_x.SetValue(x); | ||
| self.position_y.SetValue(y); | ||
| self.position_z.SetValue(z); | ||
| Ok(DomRoot::from_ref(self)) | ||
| } | ||
| } | ||
| @@ -1,8 +1,10 @@ | ||
| [panner-equalpower.html] | ||
| expected: ERROR | ||
| [X Number of impulses found is not equal to 100. Got 0.] | ||
| expected: FAIL | ||
|
|
||
| [< [test\] 1 out of 4 assertions were failed.] | ||
| expected: FAIL | ||
|
|
||
| [# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.] | ||
| expected: FAIL | ||
|
|
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
yUp doesn't exist?