sound - can someone explain why this doesn't work

BlitzMax Forums/BlitzMax Beginners Area/sound - can someone explain why this doesn't work

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Cos you're doing it wrong. ;op
Strict

Local bmxPath$ = getenv_("BMXPATH")

Local snd:TSound = LoadSound(bmxPath$ + "/samples/hitoro/sounds/gameover.ogg")

Graphics 800, 600, 0

Local chn:TChannel = PlaySound(snd)
Repeat
	If Not(ChannelPlaying(chn))
		StopChannel(chn)
		chn = PlaySound(snd)
	EndIf
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

End
...or...
Strict

Local bmxPath$ = getenv_("BMXPATH")

Local snd:TSound = LoadSound(bmxPath$ + "/samples/hitoro/sounds/gameover.ogg")

Graphics 800, 600, 0

Local chn:TChannel = PlaySound(snd)
Repeat
	If Not(ChannelPlaying(chn))
		PlaySound(snd, chn)
	EndIf
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

End
...or...
Strict

Local bmxPath$ = getenv_("BMXPATH")

Local snd:TSound = LoadSound(bmxPath$ + "/samples/hitoro/sounds/gameover.ogg")
Local chn:TChannel = AllocChannel()

Graphics 800, 600, 0

PlaySound(snd, chn)
Repeat
	If Not(ChannelPlaying(chn)) Then PlaySound(snd, chn)
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

End
...or...
Strict

Local bmxPath$ = getenv_("BMXPATH")

Local snd:TSound = LoadSound(bmxPath$ + "/samples/hitoro/sounds/gameover.ogg")
Local chn:TChannel = AllocChannel()

CueSound(snd, chn)
SetChannelVolume(chn, Rnd(0, 1))
SetChannelPan(chn, Rnd(0, 2) - 1)

Graphics 800, 600, 0

ResumeChannel(chn)
Repeat
	If Not(ChannelPlaying(chn))
		CueSound(snd, chn)
		SetChannelVolume(chn, Rnd(0, 1))
		SetChannelPan(chn, Rnd(0, 2) - 1)
		ResumeChannel(chn)
	EndIf
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

End
...and all the other possible combinations, but you get the idea... :o)