Playing Tracks on the Vmusic2 module with no pauses

djmikeys

New Member
Hi,
I am using the Vmusic2 module and I have got it playing the track ok. The way it works right now is that it reads the command in the code to play track 1 then immedietly after this I need a pause to allow the track to be played out in its entireity. This means that the program is suspended and cant really do anything until the track is finished, this means you cant skip track, pause etc. Here is the code, it is based on code already posted on the forum. Does anyone know of how to avoid this pause?

-----------------------------------------------------------------

symbol first_byte = b0
symbol point = b1
symbol temp = b2
symbol loopcounter = b3
; set picaxe type
#picaxe 28x1
setfreq m4
; set COM port used for download
;#com 4
; open terminal after download
; This is to view the 'sertxd' debugging comments
#terminal 4800

setup:

; setup serial hardware
; at 9600 with background receive
hsersetup b9600_4,%01
low 0 ; ensure CTS is low
init:
; Send Es until the unit responds correctly
sertxd ("<Sent> E",CR,LF)
hserout 0,("E",CR)

gosub get_response
if first_byte <> "E" then init


main:



; check to see if a drive is actually inserted
; response will start D for yes and N for no
sertxd ("<Sent> Check Drive",CR,LF)
hserout 0,(CR)

gosub get_response
if first_byte <> "D" then main
; play track 1.mp3
; response will start D if ok, C if not

track1:

sertxd ("<Sent> Play track 1",CR,LF)
hserout 0,("vpf 1.mp3",CR)

gosub get_response
if first_byte <> "D" then main
;now playing a track
playing1:

sertxd ("Playing x seconds of track 1",CR,LF)
pause 60000
pause 60000
pause 57000






; Sub procedure to receive background bytes
get_response:
pause 1000 ; wait a while
sertxd ("<Response> ")
point = 0 ; reset local pointer
get point,first_byte ; Save the first reply byte
do
get point,temp ; get returned byte
sertxd (temp) ; transmit it
inc point ; increment pointer
loop while temp <> CR ; if not CR loop
sertxd (LF) ; Add a LF to the received CR
sertxd (CR,LF) ; Do another blank line

hserptr = 0 ; reset the background receive pointer


return



track2:

sertxd ("<Sent> Play track 2",CR,LF)
hserout 0,("vpf 2.mp3",CR)
gosub get_response
if first_byte <> "D" then main
;now playing a track
playing2:
sertxd ("Playing x seconds of track 2",CR,LF)
pause 60000
pause 60000
pause 20000


track3:

sertxd ("<Sent> Play track 3",CR,LF)
hserout 0,("vpf 3.mp3",CR)
gosub get_response
if first_byte <> "D" then main
;now playing a track
playing3:
sertxd ("Playing x seconds of track 3",CR,LF)
pause 60000
pause 60000
pause 20000

goto main

-----------------------------------------------------------

Cheers,
Mike
 

Andrew Cowan

Senior Member
I haven't used the Vmusic, but I presume it sends out its status when it is playing?

You can make your post neater by putting {code} before your code, and {/code} after the code. However, use straight brackets [], not curly ones.

A
 
Top