Hardlly, but getting sounds
So, today asides from bugfixes I have added the first sound to the game - the alien death sound.
I have been thinking about adding sound to the game back at the beginning of the Java rewrite, maybe some days before then.
So while working on LibRLImg I was trying to get it to play sound using Raylib's sound library. Unfortunately the binding I am using (Jaylib by Electronstudio) seems to be kind of broken at this point, with the JVM itself crashing on a try to play a sound. Weirdly enough the crash happens only when it's inside a jarfile, extraced it works as expected.
So, the remaining options were to use one of Java's absolutely broken sound APIs, or to use an external library (which I want to avoid due to filesize, that is 8mb more than I want because of JavaCPP).
Java's Clip and SourceDataLine APIs are absolutely broken. I have tried working with them in one of my past projects (AWS), and it went so bad that I entirely removed audio from that game.
So I went for search for a working external library. There does not seem to be many options out there. The JLayer thing is recommended by many, but I have bad experience with it. I also though on using Paulscode's SoundSystem (the one used by Minecraft), but I found no documentation on it, and decompiling Minecraft just to see its usage would be unworthy the result.
And I was thinking that it's over, that this game won't have sound at all. But happily, I stood over an 8 yo StackOverFlow question [1], that explained the usage of the long outdated (it got removed in Java 11) java.applet.AudioClip API.
And it worked! Yes, this is incompatible with Java >=11, but hey everyone uses Java 8, and it is the one listed on their website.
The first sound was made in BeepBox (beepbox.co), and for some reason it inserted a long pause after the sound itself, and I had to sign in to a bloated webapp just to remove this damned pause.
Files
Get PixelAbyss
PixelAbyss
Defeat the Alien Leader in a classical space shooter
Status | In development |
Author | glowiak |
Genre | Shooter |
Tags | Singleplayer |
More posts
- What next?Dec 09, 2023
- Full feature parity! (kind of)Nov 29, 2023
- Java EditionNov 27, 2023
Leave a comment
Log in with itch.io to leave a comment.