AGS Development > Engine Development

3D/Positional Audio using OpenAL

<< < (2/3) > >>

Crimson Wizard:
TBH I'm starting having doubts that using OpenAL interface in general is a good idea for AGS project. It came as a part of the SDL port done by Nick Sonneveld, and which we decided to use, and I trusted this choice; but the more i looked into it on my own, the more potential problems I saw. I think the biggest is that it's another layer of complexity which we cannot fully control. Good example is playback "Speed" property: it appeared OpenAL does not have a direct equivalent for it, so I had to implement it on top by resampling the sound data. The sound is "sped up" before passing into openal, but because we must buffer at least couple chunks of data there all time, there's a delay at which the "speed" parameter is applied to the output sound, and that delay depends on the size of this buffering. In Allegro4 it was applied for the very next played chunk perhaps at the very end of the data chain before it goes out to the sound driver, so almost immediately. I'm having concerns that situation may become worse if we decide to implement more sophisticated sound system in AGS script, with mixers, and so on.

Note that mojoAL uses SDL2 internally, which we also use directly in the engine, so the question to ponder is, what use is OpenAL for us, and how it will work in perspective.
If it's actually useful, perhaps there's a proper way to "extend" it ourselves and let us control the sound closer to the final output.

Personally, i used ffmpeg before and liked its "filter" design, where sound transformations may be applied freely at any stage of the data processing. Compared to that, OpenAL is a "black box" with everything which connects directly to the output.

eri0o:
MojoAL is just an OpenAL implementation. It uses Sdl2 to make everything work. Like SDL_Sound has received lots of updates recently, I believe MojoAl will receive too. The advantage of it is license (not every license is compatible with Apple devices) and easy of building it, and easy of porting if needed. Additionally, we can use a different OpenAl implementation if needed - the Emscripten port doesn't use MojoAl, and neither does the Android port, they use their own platforms OpenAL implementation and interfaces - they could use MojoAL too, but I thought since a native platform specific version was available it was alright to use that instead.

The sound decoding we use is separated in SDL_Sound and the sound sink (actual playback) is through SDL2 (except in Android and Emscripten). The OpenAL gives both control to the sound playback as to the final device that plays it. So if a different solution is used these are the points that need to be done in it.

About MojoAL it's better to not think of what it does and does not support, but if OpenAL supports it in some standard, and then notify the developer and figure how to support that if needed.

vga256:

--- Quote from: eri0o on 22 Apr 2022, 10:38 ---
About MojoAL it's better to not think of what it does and does not support, but if OpenAL supports it in some standard, and then notify the developer and figure how to support that if needed.

--- End quote ---

OK that makes a lot of sense, thanks! I'll save this wishlist item for Unity :)

eri0o:

--- Quote from: vga256 on 22 Apr 2022, 14:31 ---
--- Quote from: eri0o on 22 Apr 2022, 10:38 ---
About MojoAL it's better to not think of what it does and does not support, but if OpenAL supports it in some standard, and then notify the developer and figure how to support that if needed.

--- End quote ---

OK that makes a lot of sense, thanks! I'll save this wishlist item for Unity :)

--- End quote ---

I was answering CW, your approach of identifying HRTF in OpenAL spec is what I meant as the correct approach towards getting the feature in MojoAL.

Summary: there are no perfect libraries.

Crimson Wizard:

--- Quote from: eri0o on 22 Apr 2022, 15:21 ---I was answering CW, your approach of identifying HRTF in OpenAL spec is what I meant as the correct approach towards getting the feature in MojoAL.

Summary: there are no perfect libraries.

--- End quote ---

Sigh, I was in doubts to whom you were answering, so deleted my next reply.

The reply was this:

---


--- Quote from: eri0o on 22 Apr 2022, 10:38 ---About MojoAL it's better to not think of what it does and does not support, but if OpenAL supports it in some standard, and then notify the developer and figure how to support that if needed.

--- End quote ---

In my previous post I specifically mentioned "using OpenAL interface in general", not MojoAL. MojoAl's own problems is an issue on its own, but I was talking about using the OpenAL interface. I'm questioning the convenience of that interface in the context of AGS engine.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version