itdelatrisu / opsu

opsu! ~ an open-source osu! client
https://itdelatrisu.github.io/opsu/
GNU General Public License v3.0
763 stars 123 forks source link

Game sounds fail to load, causing a crash #1

Closed ghost closed 9 years ago

ghost commented 10 years ago
c at suzu in ~/Downloads/opsu
% cat .opsu.log
Tue Jul 08 11:35:06 NZST 2014 ERROR:Failed to load file 'combobreak.wav'.
Tue Jul 08 11:35:06 NZST 2014 ERROR:line with format PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame,  not supported.
javax.sound.sampled.LineUnavailableException: line with format PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame,  not supported.
    at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:513)
    at com.sun.media.sound.DirectAudioDevice$DirectClip.implOpen(DirectAudioDevice.java:1304)
    at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:121)
    at com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1085)
    at com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1175)
    at itdelatrisu.opsu.SoundController.loadClip(SoundController.java:158)
    at itdelatrisu.opsu.SoundController.init(SoundController.java:174)
    at itdelatrisu.opsu.states.Splash$1.run(Splash.java:137)
[several repeats of the above error for each sound file]

Tue Jul 08 11:36:52 NZST 2014 ERROR:** Uncaught Exception! **
Tue Jul 08 11:36:52 NZST 2014 ERROR:null
java.lang.NullPointerException
    at itdelatrisu.opsu.SoundController.playClip(SoundController.java:223)
    at itdelatrisu.opsu.SoundController.playSound(SoundController.java:247)
    at itdelatrisu.opsu.states.MainMenu.mousePressed(MainMenu.java:317)
    at org.newdawn.slick.state.StateBasedGame.mousePressed(StateBasedGame.java:499)
    at org.newdawn.slick.Input.poll(Input.java:1217)
    at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:641)
    at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:411)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:321)
    at itdelatrisu.opsu.Opsu.main(Opsu.java:149)
c at suzu in ~/Downloads/opsu
% java -version 
java version "1.7.0_60"
OpenJDK Runtime Environment (IcedTea 2.5.0) (Arch Linux build 7.u60_2.5.0-2-x86_64)
OpenJDK 64-Bit Server VM (build 24.60-b09, mixed mode)

The NullPointerException occurs when clicking on the opsu! star on the main menu, causing the game to crash (probably because it's trying to play a sound even though it failed to load?)

itdelatrisu commented 10 years ago

Does 83c475c fix the crashes? (binary here) From what I could find about this issue, it seems that Java Sound in Linux is a lost cause, so this is about all I can come up with without switching to another media framework altogether. I'm getting moderately fed up with searching for a low-latency sound library for Java, but please let me know if you have any suggestions and I'll be glad to give them a shot.

ghost commented 10 years ago

Yep, that fixes it, and the sounds play. Cheers!

ghost commented 10 years ago

Oops, spoke too soon. Now the beatmap audio doesn't play on the title screen or when I try to play a map. Previously the beatmap audio would play up until the game crashed. .opsu.log appears to be empty, too...

itdelatrisu commented 10 years ago

Interesting. If you look at the diff, I didn't touch MusicController (which handles beatmap audio through OpenAL). Maybe SoundController's initialization is interfering with OpenAL... anyhow, I'm really clueless about how to solve this (as I'm unable to test this myself). x.x

If disabling the SoundController module altogether (i.e. deleting the code inside the init and sound-playing methods) fixes the issue, I can just write in a switch to turn off JavaSound for Linux for now. Are you able to compile the project yourself? If not, I can upload another binary for you when I get a chance.

ghost commented 10 years ago

It could fix the issue? I can't compile it here, I don't have any Java development knowhow, so a binary would be appreciated.

itdelatrisu commented 10 years ago

Here you go: http://www.mediafire.com/download/ri22ikobnsh3nyc/5a1972a-nosound.jar

ghost commented 10 years ago

Yep, it works fine there. Strange.

itdelatrisu commented 10 years ago

This is resolved in the 0.3.1 release -- sound effects are not loaded in Linux by default, with a switch in the options in case it happens to work for somebody. I'll leave this issue open since disabling sound altogether isn't a proper fix by any means, but at least it's no longer critical.

Thanks for your help!

itdelatrisu commented 9 years ago

Closing this as it's pretty outdated, and #89 addresses a similar issue.