OpenAL failure on MacOS?
BlitzMax Forums/BlitzMax Programming/OpenAL failure on MacOS?
| ||
Its only playing sounds a couple of times then it completely dies. I'm also having problems with FreeAudio, in that it intermittently fails to play a sound when I ask it to. I'm not 100% certain but I think tchannel.playing() doesn't always tell the truth. The upshot is that I'm currently without any reliable audio driver whatsoever! Solutions? |
| ||
Can you make a quick bit of code that fails and others can test? I'm not sure how the sound stuff works in BlitzMax, so I'd be curious to see if it happens on my system as well. |
| ||
Not on me mac atm, but the code was as simple as this:setaudiodriver("OpenAL") graphics 800,600 local sound:tsound = loadsound("sound.ogg") while not keydown(key_escape) if keyhit(key_space) playsound(sound) endif wend endHit space a few times, it works. Then... nothing. Haven't really done any major investigation into FreeAudio as yet. Intermittent problems are always the worst to track down, but at least the OpenAL one is consistent here. |
| ||
Well... shifted over to FreeAudio on Mac now. The problem I had with FreeAudio is now fixed. This works: myChannel:TChannel = AllocChannel() CueSound(mySound,myChannel) ...while this [intermittently and quite rarely] does not: myChannel:TChannel = CueSound(mySound) Don't know or care why that is, but it works now. :) |
| ||
Hi Dave, is your project multithreaded? Will look into testing CueSound as I was not aware of any issues in FreeAudio on Mac til now. |
| ||
No. I have an array of TChannels and cycle through them each time a sound is played. That basically has the effect of keeping a cap on how many sounds are playing at once. If more than X sounds are playing, older ones are stopped in favour of ones that have started playing more recently. Here's part of my audio class code which handles the playing of sounds: Method playSnd(sound:TSound,volume:Float = 1,rate:Float = 1) If Self.chan[Self.chanPtr].channel If Self.chan[Self.chanPtr].channel.Playing() Self.chan[Self.chanPtr].channel.Stop Self.chan[Self.chanPtr].channel = Null EndIf EndIf Self.chan[Self.chanPtr].channel = CueSound(sound) 'THIS IS THE PROBLEM LINE Self.chan[Self.chanPtr].channel.SetVolume(volume * Self.masterVolume()) Self.chan[Self.chanPtr].channel.SetRate rate Self.chan[Self.chanPtr]._rate = rate ResumeChannel(Self.chan[Self.chanPtr].channel) Self.chanPtr:+1 If Self.chanPtr > Self.maxChannels-1 Self.chanPtr = 0 EndIf End Method The code is quite simple. First it checks the current channel (indicated by Self.chanPtr) to see if anything's playing on there. If it is, it stops it. It then plays the new sound, and increases Self.ChanPtr + 1. I replaced the marked line with AllocChannel, then used CueSound after that. That way everything works as expected. I didn't look into it any further than that so I'm not sure if there's an underlying issue somewhere. |