TChannel woes

BlitzMax Forums/BlitzMax Programming/TChannel woes

Czar Flavius(Posted 2011) [#1]
The assert fails. What am I doing wrong? I want to play different sounds on the same channel one after the other, and use channel.playing() to determine when to start the next sound. The channel returned by Play is different to the channel I provide. I can hear the sound being played, so no problems that end.

Local sound:TSound = TSound.Load("NoMoney.ogg", False)
Local channel:TChannel = New TChannel
sound.Play(channel)
Assert channel.Playing()
Delay 3000


Last edited 2011


Czar Flavius(Posted 2011) [#2]
This fixed it.

Local sound:TSound = TSound.Load("NoMoney.ogg", False)
Local channel:TChannel = AllocChannel()
sound.Play(channel)
Assert channel.Playing()
Delay 3000



Taron(Posted 2011) [#3]
I should try it, but I'm too lazy right now. Is that tight enough for a circular buffer? Meaning, have two or more buffers and tie them back to back in such a play loop.
It works just fine in openAL, but the latency drives me nuts.


Czar Flavius(Posted 2011) [#4]
I don't understand.

I have fixed my problem by creating the buffer I want to use with AllocChannel.


Taron(Posted 2011) [#5]
Eh, in openAL you can queue up several buffers in one channel. You can then check if a buffers has finished and write new data into it, while the next are playing. Then queue the new buffer back in and so on. I just remembered that freeaudio and directaudio seemed to offer no obvious way to achieve that without a little gap between the plays, resulting in a loud crackle.

Last edited 2011


Czar Flavius(Posted 2011) [#6]
What is openAL? Should I be using it instead?

I don't need the next sound effect to play immediately after. It's for a voice over system. If you run out of power and an attack is approaching at the same time, I want it to play one announcement followed by the other. A brief pause between the two is ok. A loud crackle would not.


Taron(Posted 2011) [#7]
AH, you didn't see my "realtime synthesis" thread?
http://www.blitzmax.com/Community/posts.php?topic=95529

Hehehe, that was a real breakthrough for me and I think it's been a first with blitzmax. Anyway, openAL is the openGL equivalent in the audio world, so to say "Open Audio Language" I suppose?

Last edited 2011