Skip to content

Commit 69192b1

Browse files
committed
Merge pull request #4092 from TannerRogalsky/openal_global_gain_bugs
`alListenerf` bug fix and tests.
2 parents a54bb4d + 4a99cc4 commit 69192b1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/library_openal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ var LibraryOpenAL = {
12501250
}
12511251
switch (param) {
12521252
case 0x100A /* AL_GAIN */:
1253-
AL.currentContext.gain.value = value;
1253+
AL.currentContext.gain.gain.value = value;
12541254
break;
12551255
default:
12561256
#if OPENAL_DEBUG

tests/openal_playback.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ int main() {
5959
alListenerfv(AL_VELOCITY, listenerVel);
6060
alListenerfv(AL_ORIENTATION, listenerOri);
6161

62+
// check getting and setting global gain
63+
ALfloat volume;
64+
alGetListenerf(AL_GAIN, &volume);
65+
assert(volume == 1.0);
66+
alListenerf(AL_GAIN, 0.0);
67+
alGetListenerf(AL_GAIN, &volume);
68+
assert(volume == 0.0);
69+
70+
alListenerf(AL_GAIN, 1.0); // reset gain to default
71+
6272
ALuint buffers[1];
6373

6474
alGenBuffers(1, buffers);

0 commit comments

Comments
 (0)