OpenAL problem - channel limitations

BlitzMax Forums/BlitzMax Programming/OpenAL problem - channel limitations

GfK(Posted 2007) [#1]
I've just started using OpenAL for audio in my game since it seems to be the only thing that works in Vista (i'm coding under XP as I don't have my own copy of Vista).

There seems to be a limit of 14 (0-13) active channels when using OpenAL. Try this code. You'll see I'm using a bank of 24 allocated channels over and over. Using the example below, nothing plays on channel 14 or beyond. Why?:
Graphics 800,600

result = SetAudioDriver("OpenAL")
If Not result Then RuntimeError("Could not open OpenAL driver!")

Global MaxChans% = 24
Global chan:TChannel[MaxChans]
Global chanPtr:Int = 0

initchannels()

Global snd = LoadSound("C:\Program Files\BlitzMax\samples\hitoro\sounds\fall.ogg")
While Not KeyDown(key_escape)
	Cls
	playSnd(snd)
	DrawText "Attempting to play channel " + chanPtr,10,10
	Flip
	Delay 500
Wend

Function initChannels()
	For N = 0 To maxChans-1
		chan[N] = AllocChannel()
	Next
End Function

Function playSnd(hnd:TSound,rate:Float = 1,Pan:Float = 0)
	chanPtr:+1
	If chanPtr>maxChans-1
		chanPtr = 0
	EndIf
	CueSound(hnd,chan[chanPtr])
	SetChannelRate chan[chanPtr],rate
	SetChannelPan chan[chanPtr],Pan
	SetChannelVolume chan[chanPtr],1
	ResumeChannel chan[chanPtr]
End Function


This code works perfectly when using FreeAudio. Is there a way to fix this limitation? Is it a bug with Blitzmax?


JazzieB(Posted 2007) [#2]
I hate to tell you this, but that code actually works on my Vista set-up. When I get a chance I'll test under XP and let you know the results.


GfK(Posted 2007) [#3]
Hmm...

Just tried using "OpenAL Generic Software" instead of "OpenAL" - works fine.

"OpenAL", "OpenAL Generic Hardware", and "OpenAL Default" all stop at channel 13, though.


Yan(Posted 2007) [#4]
Works fine for me too.


GfK(Posted 2007) [#5]
I'm hoping more people with onboard sound are going to test this.

I think this is a potential time bomb. If there are going to be channel limits on certain setups, then it needs checking out.

My PC uses AC97 onboard audio, which is not uncommon.


Yan(Posted 2007) [#6]
I'm using AC97 sound (forgot my sig didn't state that).


Vertex(Posted 2007) [#7]
Yes, channels are limit by hardware. In have read, that 32 or more channels are standard. On software mixers there is normaly no limits, but 256 I think was the range.

Bye the way: I have created for my own OpenAL Module a Ogg Vorbis Class that plays streamed music. So you don't have loading times of 20 or more seconds, and memory ressources of more than 20 MByte. The stream is buffered up to 3 seconds and using only a CPU time of 0 - 2%

cu olli


Paul "Taiphoz"(Posted 2007) [#8]
Why is blitz's normal sound not working in vista? is this something were all goan have to do ? are we all gona have to start using OpenAL?

if so I hope Mark codes it into the default command set to save people a lot of extra work.


smilertoo(Posted 2007) [#9]
the osund is broken on vista because of MS new ethos, if something is broken then remove it...dont fix it.


GfK(Posted 2007) [#10]
Why is blitz's normal sound not working in vista?
As I've said elsewhere on this forum recently - I get an unacceptable one-second "lag" when playing sounds via FreeAudio under Vista.

Using DirectSound I hear nothing at all.

The only solution at this time, appears to be OpenAL.


popcade(Posted 2007) [#11]
In my Vista Setup, I got no significant delay with my AC97, but do happen on Sound Blaster Live, I think there's something to do with Creative.

BTW, I used an OpenAL DLL from Torque, and everything works very fine, you can try to carry your project with that DLL.


RiK(Posted 2007) [#12]
Works fine for me and I tried up to 128 channels.


Gabriel(Posted 2007) [#13]
No problem for me using onboard sound, but I'm running it under XP.


Damien Sturdy(Posted 2007) [#14]
It's worth pointing out that with my Hi-Def toshiba laptop, I get these sound delays in *XP* too.