[Gambas-user] OpenAL (gb.openal) example code

Kevin Fishburne kevinfishburne at ...1887...
Sun Aug 23 06:29:44 CEST 2015


On 08/22/2015 10:56 AM, Kevin Fishburne wrote:
> Heh, yes I will. I test; you fix. :) Thanks everyone for the responses 
> and fix to the code. Now that I got the very basics working (can load 
> and play a sound) I'll start working on getting 3D positioning, 
> doppler, etc. working and will put together a nice demo. When it's 
> polished I'll upload it to the farm so others may benefit. Once that's 
> done I'll begin replacing the SDL audio code in Sylph and put a video 
> up on YouTube to show off the new audio capabilities. 

Okay, after searching through tons of shitty old web examples, actually 
reading the frakking manual from 2001 (not the movie) and some 
experimentation I've made a little progress. Here's the link to the new 
project revision:

http://eightvirtues.com/misc/OpenAL.tar.gz

To a limited degree I can get 3D positional audio and doppler based on 
velocity working, but only by changing the relevant parameters for the 
audio source and not the listener. I also have to set this to TRUE, not 
FALSE:

Al.Sourcei(AudioSource[0], Al.SOURCE_RELATIVE, Al.TRUE)

Ideally it should be FALSE as the "camera" (listener) moves as well as 
the audio sources (space ships and such), and having audio source 
positions calculated relative to the listener position doesn't allow me 
to use global/scene coordinates for both and would be unnatural for most 
3D games.

I'm wondering if the line:

Al.Listenerfv(Al.ORIENTATION, [0, 0, -1])

may be incorrect, as the Gambas documentation says it should have more 
parameters but online docs say otherwise.

Right now I'm testing this using two-channel stereo. Once that's working 
I'll test it on a 5.1 system.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list