Using more OpenAL features for dynamic mixing


#1

Hi,

I am looking to use OpenAL features besides the few ones already implemented by lime. The thing is, I absolutely can’t figure out how to do that. OpenAL looks a bit obscure to me, and the “bridging” between Haxe and OpenAL is mysterious too. If someone can help me set something like this up, I’d be happy to add this properly to the core API :slight_smile:

Also, is the OpenAL Effects Extension already present in openFL? It’s the filters and the reverbs I’d like to use.

Thanks!


#2

We expose OpenAL (at least, most of the API?) for native targets, under lime.media.openal.*, for example:

http://api.openfl.org/lime/media/openal/AL.html

You can use all of this directly for advanced use, or we implement it internally for the lime.media.AudioSource API. If you look at our source code (https://github.com/openfl/lime/blob/develop/lime/_backend/native/NativeAudioSource.hx) you can see an example of using the OpenAL API. If you have ideas for making our AudioSource API easier to use, or interfacing better with advanced features, or if the OpenAL API needs additions, let me know :slight_smile:


#3

Thanks for the tips! I’ll definitely have to dive in there!

Doesn’t look like the OpenAL Effects Extension is in there though… Can you confirm that? If it’s not there, adding it is going to be one more challenge I’ll have to overcome :muscle: just have to mimic what’s happening in NativeAudioSource.hx I suppose.

It’s especially the Effects Extension I want, it contains all the actual audio effects: reverbs, ambient occlusions, delays, filters, choruses… All the bread and butter effects of the sound designer. Using these in real time in connection with the already very reactive audio in OpenFL would be great!

By the way, audio in OpenFL, although a bit basic, is a breeze to use! After 2 years of scripting for the clumsy audio system in Unity, I was very happy and surprised at the flexibility of audio in OpenFL :slight_smile:


#4

I believe we are compiling OpenAL-Soft with support for effects, here:

…so I think this is really a matter of exposing the API, not anything more complicated :slight_smile:

Have you used OpenAL effects before? Do we need to define extra string constants to use it, or are there additional APIs we are missing?

Thanks :slight_smile:


#5

Awesome! Thanks for the tips. I haven’t used openAL before, I’ll keep you updated !


#6

Sorry, double post. But I actually managed to expose something!! Namely, the pitch. Whoop whoop!! :yum:

Now, I’m trying to get into the effects stuff. Can you tell me where you get the 0x0000 thingies? There’s a bunch of them in AL.hx, and I found some similar-looking #define in alMain.h, but it’s not even the same ones… Where do you get the thingies from? (sorry for the terrible lack of vocabulary :confounded: I’m self-taught and my self-teaching has some holes in it).
It looks like all the ones relative to the alSource are defined, but there are none from the Effects, like a certain AL_DIRECT_FILTER one.

EDIT: I guess the thingies are those same string constants you were talking about ^^’


#7

Yeah, we re-define some of the static values that are in the C++ *.h header file for Haxe, so that you can easily and nicely refer to the same values from your code. However, they are really just numbers, so without modifying the Haxe sources, it should be possible to drop in another constant to give it a try :slight_smile:


#8

Hey! A few weeks ago I actually managed to expose the whole OpenAL FX Extensions! :smiley: That involved diging through the lime C++ side, which was pretty scary, but now it’s all nice and working. Maybe incomplete, because there’s A LOT of stuff and I might have missed some of it. Anyway, thanks a lot for your help :slight_smile:

Should I make a pull request? Even knowing that, although bugless I believe, the work I’ve done is not finished?


#9

Sure! Any step forward is a step forward :slight_smile:


#10

Hi!

I went and did a pull request :slight_smile: it’s my first time contributing to something this big, so it’s kind of my first serious pull request ^^ Here it is. I have no idea how long validation should take, or if there’s a proper way to do the pull request. Any recommendation to help make these changes go through woud be welcome :slight_smile: