OpenAL

BlitzMax Forums/BlitzMax Programming/OpenAL

Ked(Posted 2008) [#1]
I was wondering if OpenAL let you skip around in a song by clicking on various spots on a time line or something?

Thanks.


JazzieB(Posted 2008) [#2]
If you mean the BlitzMax driver then no. If you mean OpenAL generally, then I'm not sure, although I also suspect that the answer is again no, as it, like DirectSound, is simply an API to access sound hardware.

In order to do what you want, you're probably looking for a sound engine similar to FMod and suchlike.


REDi(Posted 2008) [#3]
Yes openal can do this (as can directsound), use AL_SAMPLE_OFFSET with the alsourcei function.


Ked(Posted 2008) [#4]
@REDi:
Can you show me an example? I don't think I understand.


REDi(Posted 2008) [#5]
Hi Ked

Do you have MaxGUI? if so I'll knock you up an example using that.


REDi(Posted 2008) [#6]
Dont worry I've done a little 2D example for ya.



Yan(Posted 2008) [#7]
I know you asked specifically about OpenAL but, just for fun, I went all native...

...Obviously a bit 'brute force' and inelegant but seems to work reasonably well.


Ked(Posted 2008) [#8]
REDi,
Sorry about not getting back to you sooner. I wasn't able to get on yesterday.

I compiled your example and it gave me an "unable to open buffer" error.


REDi(Posted 2008) [#9]
Interesting, what OS are you on?

really this should only happen if LoadAudioSample is returning null, could you try somthing like...
EnableOpenALAudio()
SetAudioDriver "openal"

Local AS:TAudioSample = LoadAudioSample(RequestFile(""))
If Not AS RunTimeError("unable to open buffer")
Print "Okay."

Just to see what happens.


Ked(Posted 2008) [#10]
I am on Windows XP. I tried that example you posted and it returned "unable to open buffer."


Ked(Posted 2008) [#11]
Yan's example works when I use the path to the OGG. I've been selecting MP3's. Do they not work with LoadAudioSample?


Dreamora(Posted 2008) [#12]
MP3 are license fee bound when you use them in your program (ie have code for load and playback). BM does not support mp3 due to that


Ked(Posted 2008) [#13]
MP3 are license fee bound when you use them in your program (ie have code for load and playback). BM does not support mp3 due to that

But why can I play MP3's using LoadSound if BlitzMax doesn't support it?


plash(Posted 2008) [#14]
You can?


Ked(Posted 2008) [#15]
Yes.


Ked(Posted 2008) [#16]
I was going to make a music player, so I wasn't going to include MP3's. Would that still need a license?


Dreamora(Posted 2008) [#17]
you don't need to play for including MP3. You need to pay to use the technology to decompress them and playbeck them!
And music players are actually expensive (compared to games with their around 3000 USD fixed fee per title)


kenshin(Posted 2008) [#18]
I'm looking at getting 3D audio going, as in position/listener, so I was looking for some code to get me started with understanding the OpenAL library and come across the example posted here by REDi. It's not working though. I keep getting "Unhandled exception : Attempt to call uninitialized function pointer" on the following line:

alGenBuffers(1, Varptr(This.Buffer) )


I'm using windoze bmax 1.30. I think something has changed in bmax which broke this example. Any help getting this working would be much appreciated.

Oh yeah, Happy New Year!

Edit - Ok fixed. Helps if I have OpenAL installed. Doh.