Paulscode SoundSystem for LWJGL 3

I’m trying to use Paulscode’s SoundSystem for a game I’m making using LWJGL 3, but it hasn’t been updated in years, and I can’t seem to get it to work. Does anyone have any alternatives or ported versions that I could use? I’ve found some that have been posted previously in other topics, but all the links seem to be dead.

1 Like

Are the audio functions of LWJGL 3 not working for you, or are there specific capabilities that aren’t supported by LWJGL 3 that your hoping to accomplish?

Two “pure” Java libraries that have been used in games with some success are TinySound and AudioCue. Both rely on the core javax.sounds.sampled library. Neither is a 3D system, though its plausible you could implement pseudo-3D with AudioCue with its real-time volume, pitch and panning capabilities.

@gouessej has implemented some form of PaulsCode on his 3D Java game framework, but IDK if that would be able to interact with LWJGL, if you are committed to that.

I’ve got a lot on my plate at the moment, but if there was someone with OpenAL and LWJGL experience willing to collaborate, I’d happily put aside some time to make a wrapper for AudioCue (or something derived from it) for LWJGL.

1 Like

Thanks for the reply!

I can’t really seem to figure out how to port over the OpenAL stuff as AL.create() doesn’t exist anymore (rather unless I use lwjglx, but I think it’d be better to stick with no deprecated stuff), and all the resources I’ve found online are either really old, confusing, or don’t seem to work (I might be doing it wrong, though).

I’ll look into AudioCue, but if anyone does happen to have paulscode stuff that works with LWJGL 3, that’d be great and save me some time.

1 Like

If you run into any snags with AudioCue, let me know. I wish I’d been able to figure out how to put it on Maven. So much to learn!

1 Like

Paul Lamb’s Sound System has a plugin based on JOAL, it should be quite straightforward to port this plugin to LWJGL 3.

1 Like

I’m pretty new to OpenAL stuff, so I don’t really know all the ins and outs of it yet.
I’m not sure which plugin you’re specifically referring to, but if it’s the “LWJGL OpenAL Library Plug-in” listed on paulscode.com then that’s the one I’ve been trying to port over and failing at. I think it’s mostly a problem with the fact that I barely know what I’m doing when dealing with AL.create(). Apologies if any of that comes off as rude.

1 Like

It’s not rude but are the OpenAL bindings in LWJGL 2 & 3 very different?

1 Like

Well AL.create() hasn’t existed since 2015 as seen in this forum. The solution in the forum, though, is also outdated since ALContext hasn’t existed since 2016, and all the links below are dead.

So now, I’m at this point where there’s ALC (which has create(), but doesn’t seem to work for me), AL10, AL11, and AL, and I have no idea which one to go for.

The rest of it seems to be pretty easy to switch (for example alListener() just changes to alListenerfv()), but it’s really the AL.create() in the init() method that’s killing me.

1 Like

I’ve just compared a class using this feature before and after the port from LWJGL 2 to LWJGL 3:


https://github.com/jMonkeyEngine/jmonkeyengine/blob/5e8f5e6a1f8f181b3d70a416a667659154091830/jme3-lwjgl3/src/main/java/com/jme3/audio/lwjgl/LwjglALC.java

It should help you. I thank DuckDuckGo :slight_smile:

2 Likes

I got it working!

Turns out on top of being a LWJGL 3 issue, it was also a folder and resources issue (Stupidly, I didn’t notice my sound effect files weren’t there).

But, I did figure it out. Unfortunately, it looks like that J-Monkey Engine link still uses old LWJGL stuff (cause ALDevice, and ALContext don’t exist anymore), but it still helped a lot in realising another method works. Instead, what you have to do it create two different long variables, and use this block instead of using Al.create() in the init() method:

   device = alcOpenDevice((ByteBuffer) null);
    if (device == 0) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    context = alcCreateContext(device, (IntBuffer) null);
    if (context == 0) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);

I’m gonna upload the updated SoundSystem after I format it properly and figure out one more small error with “alc_cleanup”. It’s probably just a System.exit(0) thing.
Thanks so much for you help.

2 Likes

You’re welcome. Good job :slight_smile:

2 Likes

It seems my account on here isn’t old enough yet to upload files, so in the meantime I’ll leave this dropbox link below, then upload the file as a backup incase the link goes down.
Thanks again for the help.

https://www.dropbox.com/s/nz1c9h78bmmgsiv/paulscodeSoundSystem.zip?dl=0
Edit: Here’s the uploaded ZIP file: paulscodeSoundSystem.zip (466.5 KB)

Why don’t you use versioning? Git?

I don’t have a git account anymore as I never really used it and I’ve had issues with it in the past. Namely, when I created a new account it locked me out for like a week. I wanted to upload the updated SoundSystem here within the day and not forget about uploading it.

Don’t hesitate to ask for help. I stopped using Github several years ago, I use Git on Sourceforge and Gitlab. I’ll probably host my Git repositories in my own server. Versioning is something that you have to learn, it’s very important.