Hiya, the code below runs but no sound is made when space is pressed.
If you change the playsound to be PlaySound(Bang) i.e not using a channel it's fine, except you get many of the same sound on different channels.
If you change the play sound to be ChannelBang = PlaySound(Bang) it works, but aren't I just making a new TChannel eveytime Space is pressed and isn't this wasteful?
Finally, if you change the play sound to be ChannelBang = PlaySound(Bang,ChannelBang), the first time you press space there is no sound! Then it works after that. Note that the channel is reused so you do not get many of the same sound.
What's going on?
All I can guess is that the channel made at the start with New is somehow not set or ready to play sounds and needs to be configured first somehow, but how?
Thanks in advance for any info.
If you change the playsound to be PlaySound(Bang) i.e not using a channel it's fine, except you get many of the same sound on different channels.
If you change the play sound to be ChannelBang = PlaySound(Bang) it works, but aren't I just making a new TChannel eveytime Space is pressed and isn't this wasteful?
Finally, if you change the play sound to be ChannelBang = PlaySound(Bang,ChannelBang), the first time you press space there is no sound! Then it works after that. Note that the channel is reused so you do not get many of the same sound.
What's going on?
All I can guess is that the channel made at the start with New is somehow not set or ready to play sounds and needs to be configured first somehow, but how?
Thanks in advance for any info.
Graphics 800,600,0 'test variables Global Bang:TSound = LoadSound("explosion.wav",False) Global ChannelBang:TChannel = New TChannel Repeat Cls If KeyHit(KEY_SPACE) Then PlaySound(Bang,ChannelBang) EndIf Flip Until KeyHit(KEY_ESCAPE)