PannerNode.webidl (2670B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://webaudio.github.io/web-audio-api/ 8 * 9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13 enum PanningModelType { 14 "equalpower", 15 "HRTF" 16 }; 17 18 enum DistanceModelType { 19 "linear", 20 "inverse", 21 "exponential" 22 }; 23 24 dictionary PannerOptions : AudioNodeOptions { 25 PanningModelType panningModel = "equalpower"; 26 DistanceModelType distanceModel = "inverse"; 27 float positionX = 0; 28 float positionY = 0; 29 float positionZ = 0; 30 float orientationX = 1; 31 float orientationY = 0; 32 float orientationZ = 0; 33 double refDistance = 1; 34 double maxDistance = 10000; 35 double rolloffFactor = 1; 36 double coneInnerAngle = 360; 37 double coneOuterAngle = 360; 38 double coneOuterGain = 0; 39 }; 40 41 [Pref="dom.webaudio.enabled", 42 Exposed=Window] 43 interface PannerNode : AudioNode { 44 [Throws] 45 constructor(BaseAudioContext context, optional PannerOptions options = {}); 46 47 // Default for stereo is equalpower 48 attribute PanningModelType panningModel; 49 50 // Uses a 3D cartesian coordinate system 51 [Throws] 52 undefined setPosition(double x, double y, double z); 53 [Throws] 54 undefined setOrientation(double x, double y, double z); 55 56 // Cartesian coordinate for position 57 readonly attribute AudioParam positionX; 58 readonly attribute AudioParam positionY; 59 readonly attribute AudioParam positionZ; 60 61 // Cartesian coordinate for orientation 62 readonly attribute AudioParam orientationX; 63 readonly attribute AudioParam orientationY; 64 readonly attribute AudioParam orientationZ; 65 66 // Distance model and attributes 67 attribute DistanceModelType distanceModel; 68 [SetterThrows] 69 attribute double refDistance; 70 [SetterThrows] 71 attribute double maxDistance; 72 [SetterThrows] 73 attribute double rolloffFactor; 74 75 // Directional sound cone 76 attribute double coneInnerAngle; 77 attribute double coneOuterAngle; 78 [SetterThrows] 79 attribute double coneOuterGain; 80 81 }; 82 83 // Mozilla extension 84 PannerNode includes AudioNodePassThrough;