diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-03-19 17:19:35 -0700 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-03-19 17:19:35 -0700 |
commit | d5da0b014725afe7e81256b3cf69e9c62a978ad7 (patch) | |
tree | 863c38b95a65de07071714cf47ad75e09c2b6964 | |
parent | 616d4a7da0f323ec28f2e5061d4935f7942414d1 (diff) | |
parent | e06e22ee99391af0f161743676611dc37889e270 (diff) |
Merge pull request #977 from ehsan/openal
Initial support for positional audio
-rw-r--r-- | src/library_openal.js | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/library_openal.js b/src/library_openal.js index 271ae5ae..11ef1fbb 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -57,6 +57,7 @@ var LibraryOpenAL = { } if (ctx) { + ctx.listener.panningModel = "equalpower"; AL.contexts.push({ctx: ctx, err: 0, src: [], buf: []}); return AL.contexts.length; } else { @@ -517,9 +518,43 @@ var LibraryOpenAL = { }, alListenerfv: function(param, values) { + if (!AL.currentContext) { #if OPENAL_DEBUG - console.log("alListenerfv is not supported yet"); + console.error("alListenerfv called without a valid context"); #endif + return; + } + switch (param) { + case 0x1004 /* AL_POSITION */: + AL.currentContext.ctx.listener.setPosition( + {{{ makeGetValue('values', '0', 'float') }}}, + {{{ makeGetValue('values', '1', 'float') }}}, + {{{ makeGetValue('values', '2', 'float') }}} + ); + break; + case 0x1006 /* AL_VELOCITY */: + AL.currentContext.ctx.listener.setVelocity( + {{{ makeGetValue('values', '0', 'float') }}}, + {{{ makeGetValue('values', '1', 'float') }}}, + {{{ makeGetValue('values', '2', 'float') }}} + ); + break; + case 0x100F /* AL_ORIENTATION */: + AL.currentContext.ctx.listener.setOrientation( + {{{ makeGetValue('values', '0', 'float') }}}, + {{{ makeGetValue('values', '1', 'float') }}}, + {{{ makeGetValue('values', '2', 'float') }}}, + {{{ makeGetValue('values', '3', 'float') }}}, + {{{ makeGetValue('values', '4', 'float') }}}, + {{{ makeGetValue('values', '5', 'float') }}} + ); + break; + default: +#if OPENAL_DEBUG + console.log("alListenerfv with param " + param + " not implemented yet"); +#endif + break; + } }, alIsExtensionPresent: function(extName) { |