Implemented SetOrientation and SetPosition functions but still have errors in throwing NotSupported error message

This commit is contained in:
snarasi6 2019-04-26 19:03:06 -04:00 committed by Akhilesh V
parent 94c1551c8f
commit feeb89149d
4 changed files with 42 additions and 21 deletions

View file

@ -6,9 +6,13 @@ use crate::dom::audioparam::AudioParam;
use crate::dom::baseaudiocontext::BaseAudioContext; use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::{self, AudioListenerMethods}; use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::{self, AudioListenerMethods};
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; 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::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::window::Window; use crate::dom::window::Window;
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AudioParamMethods;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use servo_media::audio::param::{ParamDir, ParamType}; use servo_media::audio::param::{ParamDir, ParamType};
use std::f32; use std::f32;
@ -121,6 +125,7 @@ impl AudioListener {
f32::MIN, // min value f32::MIN, // min value
f32::MAX, // max value f32::MAX, // max value
); );
AudioListener { AudioListener {
reflector_: Reflector::new(), reflector_: Reflector::new(),
position_x: Dom::from_ref(&position_x), position_x: Dom::from_ref(&position_x),
@ -181,4 +186,36 @@ impl AudioListenerMethods for AudioListener {
fn UpZ(&self) -> DomRoot<AudioParam> { fn UpZ(&self) -> DomRoot<AudioParam> {
DomRoot::from_ref(&self.up_z) 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);
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))
}
} }

View file

@ -17,6 +17,6 @@ interface AudioListener {
readonly attribute AudioParam upX; readonly attribute AudioParam upX;
readonly attribute AudioParam upY; readonly attribute AudioParam upY;
readonly attribute AudioParam upZ; readonly attribute AudioParam upZ;
// void setPosition (float x, float y, float z); [Throws] AudioListener setPosition (float x, float y, float z);
// void setOrientation (float x, float y, float z, float xUp, float yUp, float zUp); [Throws] AudioListener setOrientation (float x, float y, float z, float xUp, float yUp, float zUp);
}; };

View file

@ -5,9 +5,6 @@
[StereoPannerNode interface: attribute pan] [StereoPannerNode interface: attribute pan]
expected: FAIL expected: FAIL
[AudioListener interface: calling setPosition(float, float, float) on context.listener with too few arguments must throw TypeError]
expected: FAIL
[AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam)" with the proper type] [AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam)" with the proper type]
expected: FAIL expected: FAIL
@ -353,9 +350,6 @@
[AudioNode interface: new IIRFilterNode(context, {feedforward: [1\], feedback: [1\]}) must inherit property "disconnect(AudioNode)" with the proper type] [AudioNode interface: new IIRFilterNode(context, {feedforward: [1\], feedback: [1\]}) must inherit property "disconnect(AudioNode)" with the proper type]
expected: FAIL expected: FAIL
[AudioListener interface: calling setOrientation(float, float, float, float, float, float) on context.listener with too few arguments must throw TypeError]
expected: FAIL
[ScriptProcessorNode interface: existence and properties of interface prototype object's "constructor" property] [ScriptProcessorNode interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL expected: FAIL
@ -422,9 +416,6 @@
[AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect()" with the proper type] [AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect()" with the proper type]
expected: FAIL expected: FAIL
[AudioListener interface: operation setOrientation(float, float, float, float, float, float)]
expected: FAIL
[AudioNode interface: new StereoPannerNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type] [AudioNode interface: new StereoPannerNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type]
expected: FAIL expected: FAIL
@ -719,9 +710,6 @@
[OfflineAudioContext interface: new OfflineAudioContext(1, 1, sample_rate) must inherit property "suspend(double)" with the proper type] [OfflineAudioContext interface: new OfflineAudioContext(1, 1, sample_rate) must inherit property "suspend(double)" with the proper type]
expected: FAIL expected: FAIL
[AudioListener interface: operation setPosition(float, float, float)]
expected: FAIL
[AudioNode interface: new ConvolverNode(context) must inherit property "channelCount" with the proper type] [AudioNode interface: new ConvolverNode(context) must inherit property "channelCount" with the proper type]
expected: FAIL expected: FAIL
@ -1310,9 +1298,6 @@
[AudioNode interface: new IIRFilterNode(context, {feedforward: [1\], feedback: [1\]}) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type] [AudioNode interface: new IIRFilterNode(context, {feedforward: [1\], feedback: [1\]}) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type]
expected: FAIL expected: FAIL
[AudioListener interface: context.listener must inherit property "setOrientation(float, float, float, float, float, float)" with the proper type]
expected: FAIL
[WaveShaperNode interface object name] [WaveShaperNode interface object name]
expected: FAIL expected: FAIL
@ -1541,9 +1526,6 @@
[AudioNode interface: new ConvolverNode(context) must inherit property "context" with the proper type] [AudioNode interface: new ConvolverNode(context) must inherit property "context" with the proper type]
expected: FAIL expected: FAIL
[AudioListener interface: context.listener must inherit property "setPosition(float, float, float)" with the proper type]
expected: FAIL
[ConvolverNode interface: new ConvolverNode(context) must inherit property "normalize" with the proper type] [ConvolverNode interface: new ConvolverNode(context) must inherit property "normalize" with the proper type]
expected: FAIL expected: FAIL

View file

@ -1,8 +1,10 @@
[panner-equalpower.html] [panner-equalpower.html]
expected: ERROR
[X Number of impulses found is not equal to 100. Got 0.] [X Number of impulses found is not equal to 100. Got 0.]
expected: FAIL expected: FAIL
[< [test\] 1 out of 4 assertions were failed.] [< [test\] 1 out of 4 assertions were failed.]
expected: FAIL expected: FAIL
[# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.]
expected: FAIL