Sound Error

Blitz3D Forums/Blitz3D Beginners Area/Sound Error

Q(Posted 2005) [#1]
When I use StopChannel I get a 'Memory access violation' error. How do I fix this?

Here's the code:

	If PLAYING% = False
		PlaySound MAIN
		LoopSound MAIN
		PLAYING% = True
	EndIf
	
	DrawImage cursor, MouseX(), MouseY()
	
	If ImagesOverlap(CURSOR2, MouseX(), MouseY(), PLAY, 235, 180)
		If MouseDown(1) = True Then PLAY = True
		If MouseDown(1) = True Then StopChannel MAIN
	EndIf


While i'm on the subject, how do you play MIDI files? I used playsound but it doesn't work.


Sledge(Posted 2005) [#2]
MAIN isn't a channel, it's a sound. For MIDI, PlayMusic()


Q(Posted 2005) [#3]
Ooooh.. Thanks.