My first code ever

Miscellaneous Forums/General Discussion/My first code ever

You're not actually creating any channels to play your sounds, nor are you looping them.

This should work, although I haven't tested it I'm afraid as at work.

;;;;;sirenbox by David;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Edited by Yo! Wazzup?;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
AppTitle "Sirens"
Graphics 800,600,24,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
ClsColor 255,255,255
Cls
;Load the image.
sirenimage = LoadImage("sirenbox.bmp")
DrawImage sirenimage,20,100

;load the sounds.
Global CHANNELyelp = CHANNELcreate( LoadSound("audio/yelp1.wav") )
Global CHANNELairhorn = CHANNELcreate( LoadSound("audio/air1.wav") )
Global CHANNELwail = CHANNELcreate( LoadSound("audio/wail1.wav") )
Global CHANNELphaser = CHANNELcreate( LoadSound("audio/ph1.wav") )
Global CHANNELhilo = CHANNELcreate( LoadSound("audio/hilo1.wav") )
Global CHANNELmanual= CHANNELcreate( LoadSound("audio/manual.mp3") )

Repeat

	If KeyHit(2) CHANNELtoggle( CHANNELyelp )
	If KeyHit(3) CHANNELtoggle( CHANNELairhorn )
	If KeyHit(4) CHANNELtoggle( CHANNELwail )
	If KeyHit(5) CHANNELtoggle( CHANNELphaser )
	If KeyHit(6) CHANNELtoggle( CHANNELhilo )
	If KeyHit(7) CHANNELtoggle( CHANNELmanual )

Until KeyHit(1)

Flip
End

;=========================================================
;=========================================================

Function CHANNELcreate( Sound )

	;loops sound , creates channel, pauses channel
	LoopSound Sound
	Channel = PlaySound( Sound )
	PauseChannel Channel
	Return Channel
	
End Function

;=========================================================
;=========================================================

Function CHANNELtoggle( Channel )

	;pauses / resumes channel
	If Not ChannelPlaying( Channel )
		ResumeChannel Channel
	Else
		PauseChannel Channel
	EndIf
	
End Function

;=========================================================
;=========================================================