From bde00a3fcb12e777c6efe3ebaf99ce9691deb67a Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Wed, 3 Jun 2015 12:36:12 +0100 Subject: [PATCH] add support for AL_EXT_float32 --- src/library_openal.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/library_openal.js b/src/library_openal.js index 463873e40..8d93a1985 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -781,6 +781,14 @@ var LibraryOpenAL = { bytes = 2; channels = 2; break; + case 0x10010 /* AL_FORMAT_MONO_FLOAT32 */: + bytes = 4; + channels = 1; + break; + case 0x10011 /* AL_FORMAT_STEREO_FLOAT32 */: + bytes = 4; + channels = 2; + break; default: #if OPENAL_DEBUG console.error("alBufferData called with invalid format " + format); @@ -809,6 +817,9 @@ var LibraryOpenAL = { var val = {{{ makeGetValue('data', '2*(i*channels+j)', 'i16') }}}; buf[j][i] = val/32768; break; + case 4: + buf[j][i] = {{{ makeGetValue('data', '4*(i*channels+j)', 'float') }}}; + break; } } } @@ -1300,6 +1311,10 @@ var LibraryOpenAL = { }, alIsExtensionPresent: function(extName) { + extName = Pointer_stringify(extName); + + if (extName == "AL_EXT_float32") return 1; + return 0; }, @@ -1339,7 +1354,7 @@ var LibraryOpenAL = { ret = 'WebAudio'; break; case 0xB004 /* AL_EXTENSIONS */: - ret = ''; + ret = 'AL_EXT_float32'; break; default: AL.currentContext.err = 0xA002 /* AL_INVALID_ENUM */; @@ -1425,6 +1440,11 @@ var LibraryOpenAL = { }, alGetEnumValue: function(name) { + name = Pointer_stringify(name); + + if (name == "AL_FORMAT_MONO_FLOAT32") return 0x10010; + if (name == "AL_FORMAT_STEREO_FLOAT32") return 0x10011; + AL.currentContext.err = 0xA003 /* AL_INVALID_VALUE */; return 0; },