Jump to content

Getting the OpenAL Source ID for EFX


EvilTurtleProductions
 Share

Recommended Posts

I'm playing with the OpenAL-soft EFX library, already compiled the game with the latest version of OpenAL-soft and it all seems to work well so far.

To make effects work I need to configure the OpenAL source to send the audio signal to the EFX aux, but I have no clue how to fetch the ID of the source?
Basically like this:

Source* mysource;
ALuint uiSource = mysource->OpenALID;
alSource3i(uiSource, AL_AUXILIARY_SEND_FILTER, effectslot, 0, NULL);

@Joshis this in any way possible? I see no (exposed) member or method in the various audio-related classes for this.

Link to comment
Share on other sites

I sent you some code.

I would be extremely wary of importing a replacement version of OpenAL when it's already been compiled into the engine. You may have random memory overwrites causing untraceable crashes, or who knows what else.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Something to look for is that a Leadwerks source does not have a 1:1 relationship with an OpenAL source. The AL source is dynamically assigned depending on distance from the listener. The Channel is where the alsource is stored.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

2 hours ago, Josh said:

Something to look for is that a Leadwerks source does not have a 1:1 relationship with an OpenAL source. The AL source is dynamically assigned depending on distance from the listener. The Channel is where the alsource is stored.

Yeah I noticed this looking at the code you send me. I was under the wrong impression that the LW source contain the AL source too. This also explains why I had issues with my custom sound manager. Learning so much today :P

Link to comment
Share on other sites

Yeah, from what I understood OpenAL-soft does software mixing, i.e. uses actual software DSP to mix all playing sources together into one final output. Much like an actual DAW does. With how powerful CPU's are nowadays (counting the past 5 years) you can easily have something like 100+ playing sources in a game, I'd say based on my experience with programming DSP & DAW plugins. Of course it also depends on how heavy the game already is CPU-wise, might be more or less :P

The old OpenAL actually uses the (rather limited) hardware of your soundcard, which from what I've read & observed often boils down to 16 to 64 maximum sources playing until things go awry (usually with a crash caused by OpenAL), even if OpenAL reports something like 255 as the max. Hardware mixing has been outdated for so long now.

Link to comment
Share on other sites

  • 2 weeks later...

Okay, I've experimented a bit with OpenAL EFX, but it doesn't work so well on old OpenAL. I think I'll wait for the LeadWerks update to OpenAL-soft, so I can do things a bit more proper haha

For now I've implemented a very basic "dynamic" sound system which just uses two versions of the same sound, one muffled and with reverb and the other without those effects. This works well enough for now :)

Definitely going to look into a proper EFX implementation when the time comes though, I just love DSP stuff haha, plus it might help others too.

Link to comment
Share on other sites

6 hours ago, EvilTurtleProductions said:

Okay, I've experimented a bit with OpenAL EFX, but it doesn't work so well on old OpenAL. I think I'll wait for the LeadWerks update to OpenAL-soft, so I can do things a bit more proper haha

You're probably going to be waiting for a while. I still recommend FMOD Studio and if you want, you can integrate Steam Audio on top of it.

Although the code is a bit outdated, you can follow it for a basic implementation.

Leadwerks + FMOD Studio - reepblue's Blog - Ultra Engine Community - Best game engine for VR optimized for fastest virtual reality performance

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...