PlayMusic(), bug report + question

Blitz3D Forums/Blitz3D Bug Reports/PlayMusic(), bug report + question

Only in the PlayMusic() command, the extension of the file
name must be in lowercase, if not, the file is not loaded,

*.mp3 ->works
*.Mp3 or *.mP3 or *.MP3 -> it doesn't

Ok, and a question,
when you call the PlayMusic(), does anyone note a freezing for
an instant?, this doesn't happen to me but I think I heard that
it depends on the HardDrive speed or something, isn't it?

Thanks!
Paolo.

Yes, i can second that. Strange it doesn't matter if the actual file's extension name is uppercase, just the string in Blitz3d.

You can of course easily get around it by doing.
chnBackground=PlayMusic(Lower("yourname.WAV"))
There is an explanation (and solution) for the freeze/pause feature in the docs.

You can't 'preload' the audio like you can a sound sample via the LoadSound command. Every time you call the PlayMusic command, the file is reloaded and played. This means that if you use the command while some graphics are moving on-screen, you may get a slight pause when the hard drive seeks and grabs the music file. To avoid this, you might want to use the PlaySound/LoopSound commands instead.

i tried to reproduce this freezing feature but couldn't, even though i tried playing a 5 minute wave file. Maybe you need a lot of stuff going on in the scene, or maybe it only happens with certain filetypes?

Also, here is some quick test code i wrote as the PlayMusic example in the docs was only one line.

; Load and play the background music

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera() ;init scene
light=CreateLight()
RotateEntity light,90,0,0
cube=CreateCube()
PositionEntity cube,0,0,5

iniTime=MilliSecs() ;init timer

chnBackground=PlayMusic("media\example.wav") ;load music file

While Not KeyHit(1)

 tempTime=MilliSecs()-iniTime ;time sound has been playing

 If MilliSecs()>iniTime+8000 ;time in millisecs to reload file
  iniTime=MilliSecs() ;update timer
  chnBackground=PlayMusic("media\example.wav")
 EndIf

 If KeyHit(31) ;S key
  StopChannel chnBackground
 EndIf

 If KeyHit(25) ;P key
  PauseChannel chnBackground
 EndIf

 If KeyHit(19) ;R key
  ResumeChannel chnBackground
 EndIf

 TurnEntity cube,0.4,0.3,0.2 ;spin cube

 RenderWorld

 Text 0,0,"chnBackground="+chnBackground
 Text 0,12,"iniTime="+iniTime+" tempTime="+tempTime
 Text 0,24,"Press S to Stop, P to Pause, R to Resume"

 Flip
Wend