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?:
This code works perfectly when using FreeAudio. Is there a way to fix this limitation? Is it a bug with Blitzmax?
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?