You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dist/melonjs.mjs/audio/audio.js
+13-9
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*!
2
-
* melonJS Game Engine - v17.1.0
2
+
* melonJS Game Engine - v17.2.0
3
3
* http://www.melonjs.org
4
4
* melonjs is licensed under the MIT License.
5
5
* http://www.opensource.org/licenses/mit-license
@@ -283,14 +283,15 @@ function rate(sound_name, ...args) {
283
283
* @memberof audio
284
284
* @param {string} sound_name - audio clip name - case sensitive
285
285
* @param {number} [pan] - the panning value - A value of -1.0 is all the way left and 1.0 is all the way right.
286
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
286
287
* @return {number} the current panning value
287
288
* @example
288
289
* me.audio.stereo("cling", -1);
289
290
*/
290
-
functionstereo(sound_name,pan){
291
+
functionstereo(sound_name,pan,id){
291
292
letsound=audioTracks[sound_name];
292
293
if(sound&&typeofsound!=="undefined"){
293
-
returnsound.stereo(pan);
294
+
returnsound.stereo(pan,id);
294
295
}else{
295
296
thrownewError("audio clip "+sound_name+" does not exist");
296
297
}
@@ -303,12 +304,13 @@ function stereo(sound_name, pan) {
303
304
* @param {Number} x - the x-position of the audio source.
304
305
* @param {Number} y - the y-position of the audio source.
305
306
* @param {Number} z - the z-position of the audio source.
307
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
306
308
* @return {Array} the current 3D spatial position: [x, y, z]
307
309
*/
308
-
functionposition(sound_name,x,y,z){
310
+
functionposition(sound_name,x,y,z,id){
309
311
letsound=audioTracks[sound_name];
310
312
if(sound&&typeofsound!=="undefined"){
311
-
returnsound.pos(x,y,z);
313
+
returnsound.pos(x,y,z,id);
312
314
}else{
313
315
thrownewError("audio clip "+sound_name+" does not exist");
314
316
}
@@ -322,12 +324,13 @@ function position(sound_name, x, y, z) {
322
324
* @param {Number} x - the x-orientation of the audio source.
323
325
* @param {Number} y - the y-orientation of the audio source.
324
326
* @param {Number} z - the z-orientation of the audio source.
327
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
325
328
* @return {Array} the current 3D spatial orientation: [x, y, z]
326
329
*/
327
-
functionorientation(sound_name,x,y,z){
330
+
functionorientation(sound_name,x,y,z,id){
328
331
letsound=audioTracks[sound_name];
329
332
if(sound&&typeofsound!=="undefined"){
330
-
returnsound.orientation(x,y,z);
333
+
returnsound.orientation(x,y,z,id);
331
334
}else{
332
335
thrownewError("audio clip "+sound_name+" does not exist");
333
336
}
@@ -347,6 +350,7 @@ function orientation(sound_name, x, y, z) {
347
350
* @param {string} [settings.refDistance=1] - A reference distance for reducing volume as source moves further from the listener. This is simply a variable of the distance model and has a different effect depending on which model is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
348
351
* @param {string} [settings.rolloffFactor=1] - How quickly the volume reduces as source moves from listener. This is simply a variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` with `inverse` and `exponential`.
349
352
* @param {string} [settings.panningModel="HRTF"] - Determines which spatialization algorithm is used to position audio. Can be `HRTF` or `equalpower`.
353
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
350
354
* @return {Object} current panner attributes.
351
355
* @example
352
356
* me.audio.panner("cling", {
@@ -356,10 +360,10 @@ function orientation(sound_name, x, y, z) {
356
360
* distanceModel: 'exponential'
357
361
* });
358
362
*/
359
-
functionpanner(sound_name,attributes){
363
+
functionpanner(sound_name,attributes,id){
360
364
letsound=audioTracks[sound_name];
361
365
if(sound&&typeofsound!=="undefined"){
362
-
returnsound.pannerAttr(attributes);
366
+
returnsound.pannerAttr(attributes,id);
363
367
}else{
364
368
thrownewError("audio clip "+sound_name+" does not exist");
0 commit comments