I cannot get music to play at all

Blitz3D Forums/Blitz3D Beginners Area/I cannot get music to play at all

Captain Wicker (crazy hillbilly)(Posted 2011) [#1]
I cant get the sound to play and loop in my code please help.
;Eddie Tech V2.x
; ---------------- 

Graphics3D 800,600,32,2
SetBuffer BackBuffer() 

Global sndMusicLoop

camera=CreateCamera() 

light=CreateLight() 
RotateEntity light,90,0,0 


;load bgm
sndMusicLoop=LoadSound("Back_In_Black.MID")

; Load mesh 
pob=LoadMesh("idle.x") 

PositionEntity pob,0,-10,MeshDepth(pob)*2
ScaleEntity pob,0.5,0.5,0.5
RotateEntity pob,0,180,0




Repeat
	
 	
	FPS = 50
	
	period = 1000 / FPS
	time = MilliSecs () - period
	
	;loop music1	
	SoundVolume sndMusicLoop,0.50
	LoopSound sndMusicLoop
	PlaySound sndMusicLoop 
	
	
	
	; Keys
	If KeyDown (200) Then MoveEntity pob,0,0,-1
	If KeyDown (208) Then MoveEntity pob,0,0,1
	If KeyDown (203) Then MoveEntity pob,1,0,0
	If KeyDown (205) Then MoveEntity pob,-1,0,0
	
	
	
	
	RenderWorld 
	Flip
Until KeyDown (1)



Thanks guys

Last edited 2011


GaryV(Posted 2011) [#2]
For MID files, you have to use the PlayMusic command and you can't loop it. See an example here:


http://blitzmax.com/b3ddocs/command.php?name=PlayMusic&ref=2d_cat