Skip to content

Commit

Permalink
Remove panner and listener .setVelocity() calls, which got forcibly r…
Browse files Browse the repository at this point in the history
…emoved from the WebAudio spec. Closes emscripten-core#4587. See WebAudio/web-audio-api#372.
  • Loading branch information
juj committed Dec 8, 2016
1 parent 5043eac commit 1e9e18c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/library_openal.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ var LibraryOpenAL = {
this._velocity[0] = val[0];
this._velocity[1] = val[1];
this._velocity[2] = val[2];
if (this.panner) this.panner.setVelocity(val[0], val[1], val[2]);
// TODO: The velocity values are not currently used to implement a doppler effect.
// If support for doppler effect is reintroduced, compute the doppler
// speed pitch factor and apply it here.
},
get direction() {
return this._direction;
Expand Down Expand Up @@ -504,7 +506,8 @@ var LibraryOpenAL = {
panner.maxDistance = src.maxDistance;
panner.rolloffFactor = src.rolloffFactor;
panner.setPosition(src.position[0], src.position[1], src.position[2]);
panner.setVelocity(src.velocity[0], src.velocity[1], src.velocity[2]);
// TODO: If support for doppler effect is reintroduced, compute the doppler
// speed pitch factor and apply it here.
panner.connect(AL.currentContext.gain);

// Disconnect from the default source.
Expand Down Expand Up @@ -1367,7 +1370,9 @@ var LibraryOpenAL = {
AL.currentContext.ctx.listener._velocity[0] = v1;
AL.currentContext.ctx.listener._velocity[1] = v2;
AL.currentContext.ctx.listener._velocity[2] = v3;
AL.currentContext.ctx.listener.setVelocity(v1, v2, v3);
// TODO: The velocity values are not currently used to implement a doppler effect.
// If support for doppler effect is reintroduced, compute the doppler
// speed pitch factor and apply it here.
break;
default:
#if OPENAL_DEBUG
Expand Down Expand Up @@ -1402,7 +1407,9 @@ var LibraryOpenAL = {
AL.currentContext.ctx.listener._velocity[0] = x;
AL.currentContext.ctx.listener._velocity[1] = y;
AL.currentContext.ctx.listener._velocity[2] = z;
AL.currentContext.ctx.listener.setVelocity(x, y, z);
// TODO: The velocity values are not currently used to implement a doppler effect.
// If support for doppler effect is reintroduced, compute the doppler
// speed pitch factor and apply it here.
break;
case 0x100F /* AL_ORIENTATION */:
var x = {{{ makeGetValue('values', '0', 'float') }}};
Expand Down

0 comments on commit 1e9e18c

Please sign in to comment.