Updated Howler to enable sound position (#1243)
Updated Howler to version 2.0.15 For what we use, we could use the "stereo()" function but as we already generated the coordinates, I settled for the "pos()" function. My knowledge of sound isn't enough to understand where the "w" variable of the position goes (as "pos()" uses only x, y and z). My guess is that "pannerAttr()" might have the access to what we are looking for, but again I don't fully understand sound.
This commit is contained in:
committed by
Joshua Granick
parent
e10fdf0afc
commit
14f12a41da
6
dependencies/howler.min.js
vendored
6
dependencies/howler.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -279,9 +279,15 @@ class HTML5AudioSource {
|
||||
public function getPosition ():Vector4 {
|
||||
|
||||
#if lime_howlerjs
|
||||
|
||||
// TODO: Use 3D audio plugin
|
||||
|
||||
|
||||
//This should work, but it returns null (But checking the inside of the howl, the _pos is actually null... so ¯\_(ツ)_/¯)
|
||||
/*
|
||||
var arr = parent.buffer.__srcHowl.pos())
|
||||
position.x = arr[0];
|
||||
position.y = arr[1];
|
||||
position.z = arr[2];
|
||||
*/
|
||||
|
||||
#end
|
||||
|
||||
return position;
|
||||
@@ -297,9 +303,10 @@ class HTML5AudioSource {
|
||||
position.w = value.w;
|
||||
|
||||
#if lime_howlerjs
|
||||
|
||||
// TODO: Use 3D audio plugin
|
||||
|
||||
|
||||
parent.buffer.__srcHowl.pos (position.x, position.y, position.z, id);
|
||||
//There are more settings to the position of the sound on the "pannerAttr()" function of howler. Maybe somebody who understands sound should look into it?
|
||||
|
||||
#end
|
||||
|
||||
return position;
|
||||
|
||||
@@ -236,11 +236,35 @@ class Howl {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.
|
||||
* @param x The x-position of the audio source.
|
||||
* @param y The y-position of the audio source.
|
||||
* @param z The z-position of the audio source.
|
||||
* @param id The sound ID. If none is passed, all in group will be updated.
|
||||
* @return Returns self or the current 3D spatial position: [x, y, z].
|
||||
*/
|
||||
public function pos (?x:Float, ?y:Float, ?z:Float, ?id:Int):Dynamic {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get/set the stereo panning of the audio source for this sound or all in the group.
|
||||
* @param pan A value of -1.0 is all the way left and 1.0 is all the way right.
|
||||
* @param id (optional) The sound ID. If none is passed, all in group will be updated.
|
||||
* @return Returns self or the current stereo panning value.
|
||||
*/
|
||||
public function stereo (?pan:Float, ?id:Int):Dynamic {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -299,6 +323,15 @@ extern class Howl {
|
||||
@:overload(function(vol:Float, id:Int):Howl {})
|
||||
public function volume ():Float;
|
||||
|
||||
@:overload(function(pan:Float):Howl {})
|
||||
@:overload(function(pan:Float, id:Int):Howl {})
|
||||
public function stereo():Float;
|
||||
|
||||
@:overload(function(x:Float):Howl {})
|
||||
@:overload(function(x:Float,y:Float):Howl {})
|
||||
@:overload(function(x:Float,y:Float,z:Float):Howl {})
|
||||
@:overload(function(x:Float,y:Float,z:Float,id:Int):Howl {})
|
||||
public function pos():Array<Float>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user