Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game sounds fail to load, causing a crash #1

Closed
ghost opened this issue Jul 7, 2014 · 9 comments
Closed

Game sounds fail to load, causing a crash #1

ghost opened this issue Jul 7, 2014 · 9 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 7, 2014

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 added a commit that referenced this issue Jul 8, 2014
- Explicitly supply the AudioFormat when creating a Clip.
- Disable Master Gain if unsupported (e.g. in PulseAudio).
- Do not try to play uninitialized sounds (e.g. LineUnavailableException during creation, seems to happen regularly with PulseAudio).

Other changes:
- Errors replaced with debugs in 'getTrackLength()' if audio fields inaccessible.
- Do not log ThreadDeath exceptions (it's a known issue, and only clutters the log file).

Signed-off-by: Jeffrey Han <[email protected]>
@itdelatrisu
Copy link
Owner

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
Copy link
Author

ghost commented Jul 8, 2014

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

@ghost ghost closed this as completed Jul 8, 2014
@ghost
Copy link
Author

ghost commented Jul 8, 2014

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...

@ghost ghost reopened this Jul 8, 2014
@itdelatrisu
Copy link
Owner

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
Copy link
Author

ghost commented Jul 9, 2014

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
Copy link
Owner

@ghost
Copy link
Author

ghost commented Jul 10, 2014

Yep, it works fine there. Strange.

itdelatrisu added a commit that referenced this issue Jul 11, 2014
…es issue #1)

- By default, sound effects will be disabled on Linux due to driver issues.

Other changes:
- Minor corner-case fix in song selection. (since 95f969f)

Signed-off-by: Jeffrey Han <[email protected]>
@itdelatrisu
Copy link
Owner

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 pushed a commit that referenced this issue Feb 14, 2015
Full implementation of a "weighted" spinner. May need to tweak some constants to make it more like osu!
@itdelatrisu
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant