PLAYMUSIC

Previous topic - Next topic

MrTAToad

For some reason, PLAYMUSIC on Windows is generating a

*** Unhandled exception ***
   EXCEPTION_ACCESS_VIOLATION

error

Placed before a SLEEP 1000

PLAYMUSIC "Media/Music/Movement_Proposition.mp3",FALSE

plays fine, but put after it causes the error.  Removing the SLEEP command also causes the problem.

The odd thing is it has been working fine...  I suspect the project file is causing the trouble so will need to create a new one and see what happens...

It looks like a Debug Mode problem - compile in Release mode and all seems okay...

Code that makes it go dodgy :

Code (glbasic) Select
LOCAL mx%,my%,b1%,b2%

SLEEP 1000

LOCAL file$="Media/music.mp3"
PLAYMUSIC file$, TRUE

WHILE TRUE
MOUSESTATE mx, my, b1, b2
PRINT "Music: "+file$, 0, 120
PRINT "Mouse" ,mx, my
IF b1=1 THEN GOTO stop
SHOWSCREEN
WEND

stop:
STOPMUSIC
END


Another way :

Code (glbasic) Select
LOCAL mx%,my%,b1%,b2%

SETSCREEN 1024,768,1

LOCAL file$="Media/music.mp3"
PLAYMUSIC file$, TRUE

WHILE TRUE
MOUSESTATE mx, my, b1, b2
PRINT "Music: "+file$, 0, 120
PRINT "Mouse" ,mx, my
IF b1=1 THEN GOTO stop
SHOWSCREEN
WEND

stop:
STOPMUSIC
END


(All in debug mode, by the way).