Hello Guest

[CLOSED] Mono audio only plays in right ear

  • 8 Replies
  • 11295 Views
[CLOSED] Mono audio only plays in right ear
« on: June 28, 2012, 23:30:10 »
I don't use LWJGL directly. I use Slick2d, but I was told this is an LWJGL issue. If I play any audio (whether it's streaming or a quick sound effect) that is mono (1-channel), it only plays in my right ear. If I play stereo audio, it plays in both ears. In LWJGL 2.7.1 (the version I am upgrading from), mono audio would still play in both ears.

I am using LWJGL 2.8.4 and my headset is the Logitech G35 with fake 7.1.
EDIT: I just tried it with the 2.8.5 1714 nightly and the problem is still there.



On a semi-related note (and possibly another bug), when I changed one of my sound effects from mono to stereo, I got an IndexOutOfBoundsException when it tried to load the sound. The mono version still worked fine (except the 1-ear bug mentioned above). When I changed another one of my mono sound effects to stereo, it played just fine. The only difference I can see between the 2 sound effect files is length. The shorter one is the one that didn't work in stereo.

This is the error I got when I changed the shorter sound effect to stereo:
Code: [Select]
Thu Jun 28 18:21:38 CDT 2012 ERROR:Failure reading in vorbis
Thu Jun 28 18:21:38 CDT 2012 ERROR:null
java.lang.IndexOutOfBoundsException
at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
at org.newdawn.slick.openal.OggInputStream.getPageAndPacket(OggInputStream.java:154)
at org.newdawn.slick.openal.OggInputStream.readPCM(OggInputStream.java:294)
at org.newdawn.slick.openal.OggInputStream.read(OggInputStream.java:446)
at org.newdawn.slick.openal.OggDecoder.getData(OggDecoder.java:315)
at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:835)
at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:793)
at org.newdawn.slick.Sound.<init>(Sound.java:58)
at pkg30clicks.MainMenuState.init(MainMenuState.java:123)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at pkg30clicks.Main30Clicks.main(Main30Clicks.java:86)
« Last Edit: June 29, 2012, 06:22:25 by cmasupra »

*

Offline princec

  • *****
  • 1933
    • Puppygames
Re: [BUG] Mono audio only plays in right ear
« Reply #1 on: June 29, 2012, 09:42:48 »
I've had several sounds fail to load properly using the available Ogg libraries (all Jorbis based I believe). There's a bug somewhere in that code but what it is, I have no idea. I keep forgetting to do this, but it'd be great if you could send your ogg to the Jorbis guys and see if they understand what the problem is (http://www.jcraft.com) and report back.

Cas :)

*

Offline princec

  • *****
  • 1933
    • Puppygames
Re: [BUG] Mono audio only plays in right ear
« Reply #2 on: June 29, 2012, 09:44:05 »
Regarding the mono issue - have you set the listener to the appropriate position, and the sound effect itself? Because I'm using the latest LWJGL here and all my mono stuff plays as expected (Vista64, stereo setup, Realtek)

Cas :)

*

Online kappa

  • *****
  • 1316
Re: [BUG] Mono audio only plays in right ear
« Reply #3 on: June 29, 2012, 09:57:02 »
In relation to the first bug report, could this potentially be a problem with OpenAL-Soft?

@cmasupra if possible, since you have a reproducible test case, could you try replacing the OpenAL32.dll/OpenAL64.dll files in latest LWJGL 2.8.4+ with the same files from LWJGL 2.7.1 to see if it fixes the issue for you?

Re: [BUG] Mono audio only plays in right ear
« Reply #4 on: June 29, 2012, 15:20:13 »
Update: I tricked Windows into thinking my headset is stereo and not fake 7.1, and then the mono sounds played correctly in both ears. When I changed the Windows settings for my headset back to 7.1, the sound played only in my right ear again. This was done on 2.8.5 1714 nightly.

I keep forgetting to do this, but it'd be great if you could send your ogg to the Jorbis guys and see if they understand what the problem is (http://www.jcraft.com) and report back.
Done. I just emailed them all 4 files (a mono and stereo version of each sound effect). We'll see what they come back with.


Regarding the mono issue - have you set the listener to the appropriate position, and the sound effect itself? Because I'm using the latest LWJGL here and all my mono stuff plays as expected (Vista64, stereo setup, Realtek)
I don't know of any way to change the position of any listener. I just load the sound in Slick using
Code: [Select]
click = new Sound("data/sounds/click_cut.ogg"); and then play it using
Code: [Select]
click.play(pitch, volume);

@cmasupra if possible, since you have a reproducible test case, could you try replacing the OpenAL32.dll/OpenAL64.dll files in latest LWJGL 2.8.4+ with the same files from LWJGL 2.7.1 to see if it fixes the issue for you?
I have now tested this. Using the 2.7.1 OpenAL dll files and LWJGL 2.8.5 files for everything else, the mono sounds played correctly in both ears. As soon as I switched back to the 2.8.5 1714 nightly OpenAL dll files, the mono sounds only played in my right ear.

Also worthy of note, I posted in the OpenAL crashing thread here because I am getting the "Deleting 64 source(s)" error with 2.8.4 and 2.8.5. When I tested the 2.7.1 OpenAL dll files just now, I didn't get the error. I'm only mentioning this here because it may somehow be related.

*

Online kappa

  • *****
  • 1316
Re: [BUG] Mono audio only plays in right ear
« Reply #5 on: June 30, 2012, 10:40:57 »
I have now tested this. Using the 2.7.1 OpenAL dll files and LWJGL 2.8.5 files for everything else, the mono sounds played correctly in both ears. As soon as I switched back to the 2.8.5 1714 nightly OpenAL dll files, the mono sounds only played in my right ear.
Sounds like an issue with the OpenAL-Soft library and not an LWJGL one, better to report it to them.

Also worthy of note, I posted in the OpenAL crashing thread here because I am getting the "Deleting 64 source(s)" error with 2.8.4 and 2.8.5. When I tested the 2.7.1 OpenAL dll files just now, I didn't get the error. I'm only mentioning this here because it may somehow be related.
This is not really a serious error, just a notification which lets you know that some of the sound sources used were not cleaned up before the program exited (by either your app or Slick) and therefore OpenAL-Soft has had to do it for you.

Re: [BUG] Mono audio only plays in right ear
« Reply #6 on: July 01, 2012, 02:02:38 »
JCraft hasn't responded to my email yet about the error that happened when I switched 1 of my sound files from mono to stereo.

About the 1-ear bug, I talked to someone from OpenAL-Soft. We figured out the issue was that in version 1.14 of OpenAL-Soft, released March 28, 2012, OpenAL-Soft switched from using a dsound backend to an mmdevapi backend. The issue was the difference in the way the 2 backends detect the audio settings.

Dsound uses the driver, while mmdevapi uses the Windows settings. My headset is detected by Windows as a 7.1 headset, even if the headset driver is set as stereo. So in the older version of OpenAL-Soft, my headset was detected as a stereo headset and mono sounds upscaled to both ears. In the newer version of OpenAL-Soft, my headset is detected as a 7.1 device, so sounds only play in the right ear. If I set my headset driver to 7.1, the mono sounds play in both ears in the latest version of OpenAL-Soft, and thus the latest version of LWJGL. If I set Windows to think my headset is stereo and I set my headset driver to stereo, mono sounds play in both my ears.

In the end, it's not even OpenAL-Soft, it's dsound vs mmdevapi.

*

Offline princec

  • *****
  • 1933
    • Puppygames
Re: [BUG] Mono audio only plays in right ear
« Reply #7 on: July 01, 2012, 11:26:18 »
... or is it just that you've configured your headphones wrongly?

Cas :)

Re: [BUG] Mono audio only plays in right ear
« Reply #8 on: July 01, 2012, 14:38:12 »
No. It's a known issue with the headset. It is technically set up incorrectly half the time, but that's because the Logitech driver doesn't work as expected.

I have to deal with the same issue in some AAA games. I just thought it was a bug in this case because it used to work fine.