i dont know who would need such a thing really but here it is.
setup: load any mp3 you want but keep it a short one for testing
find the total length of mp3 in seconds in windows media player or anywhere else
change variable "mp3$" as to your files name
change variable "mp3Length" to the seconds you just found out
Usage: press space key to play and pause music
Exam: find your own way to implement stop music 1
Rem Project: Mp3LengthFinder
Rem Created: 02.03.2005 13:00:55
Rem ***** Main Source File *****
mp3$ = "ambCliffWind.mp3"
mp3Length = 35
load music mp3$, 1
GOSUB timers_Setup
BACKDROP ON
SYNC ON
DO
if spacekey() > 0 and PLAY_IT = 0 then PLAY_IT = 1
if PLAY_IT = 1
PLAY_IT = 2
loopMilSecStart = TIMER()
inc PLAY, 1
if PLAY > 1 then PLAY = 0
endif
if spacekey() = 0 then PLAY_IT = 0
REMSTARt
text 0,140, str$(PLAY)
text 0,150, str$(PLAY_IT)
text 0,160, str$(txtSec)
text 0,170, str$(mp3Seconds)
text 0,180, str$(pauseMp3Seconds)
REMEND
ink rgb(100,100,100),0
box 10,300,100+(mp3Length*10),310
ink rgb(250,0,0),0
circle 10+(mp3Seconds*10),305,5
if PLAY = 1
PLAY MUSIC 1
GOSUB timer_Game_Loop
mp3Seconds = txtSec + pauseMp3Seconds
if mp3Seconds => mp3Length
PLAY = 0
endif
else
PAUSE MUSIC 1
pauseMp3Seconds = mp3Seconds
if pauseMp3Seconds => mp3Length-1 then pauseMp3Seconds = 0 : STOP MUSIC 1
endif
SYNC
LOOP
timers_Setup:
`------------------
#CONSTANT loopSecStart = loopMilSecStart / 60
#CONSTANT loopMinStart = loopSecStart / 60
#CONSTANT loopHourStart = loopMinStart / 60
`------------------
RETURN
timer_Game_Loop:
`------------------
rem set timer
gloopMilSec = TIMER ()
gloopSec = gloopMilSec / 60
gloopMin = gloopSec / 60
gloopHour = gloopMin / 60
`------------------
gMilSec = (gloopMilSec - loopMilSecStart)
gSec = gMilSec / 1000
gMin = gSec / 60
gHour = gMin / 60
`------------------
txtMilSec = gMilSec mod 60
txtSec = gSec mod 60
txtMin = gMin mod 60
txtHour = gHour mod 60
`------------------
RETURN