Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Faux Clef

#1
my type
Code (glbasic) Select

TYPE TTrack
artist$
songtitle$
filename$
graphics$
ENDTYPE


Creates a array of the type TTrack
aSongs[] AS TTrack
pushes stuff into the array.



my player function:

Code (glbasic) Select

GLOBAL i%
LET i%=0
FUNCTION play: track[] AS TTrack
LOCAL currvolume=0.5, volume
MUSICVOLUME currvolume
init(resx, resy,"16.jpg",1)
SLEEP 5000

//Spill av uforstyrret
nexttrack:
PLAYMUSIC track[i%].filename$, FALSE
WHILE (ISMUSICPLAYING()=TRUE)
curplay:
draw(track[i%], i%, resx,resy)
IF KEY(203)=1
GOTO prev //prevtrack
ELSEIF KEY(205)=1
GOTO skip //nexttrack right arrow
ELSEIF KEY(57)=1
GOTO ablab //about Space hold
ELSEIF KEY(200)=1
GOSUB greetScroller //Alternative greeter down arrow
ELSEIF KEY(28)=1
GOSUB pause //pause return
ELSEIF KEY(1)=1
END
ENDIF

WEND
STOPMUSIC

i%=i%+1
IF i%>11 THEN END

SLEEP 100
GOTO nexttrack


prev:
IF i%<1
i%=0
GOTO curplay
ELSE
STOPMUSIC
i%=i%-1
GOTO nexttrack
ENDIF
GOTO curplay


skip:
STOPMUSIC
IF i%>11
i%=12
GOTO curplay
ELSE
i%=i%+1
GOTO nexttrack
ENDIF
GOTO curplay


I was looking for a way to do this without the labels and still having a functional commandloop, but this works fine
Thanks for all the help  :)
#2
and it didn't work  :(
is it any way to read the timelength of a mp3 in GLB?
#3
Thank you very much, so thats why ISMUSICPLAYING() allways was true, even though the track didn't loop
#4
doesn't seem to work...
#5
I'm pretty new to GLbasic, and I am writing a musicplayer.
i have a array containing all the music to be played, it works fine. But I want the player to automatically jump to the next. I have tried with

Code (glbasic) Select

PLAYMUSIC track[0].filename$, TRUE
draw(track[0], 0, resx,resy)
IF ISMUSICPLAYING()=0
SLEEP 100
i%=i%+1
PLAYMUSIC track[i%].filename$, TRUE
draw(track[i%], i%, resx,resy)
SHOWSCREEN
ENDIF