November 22, 2024, 02:46:26 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Prop-1, Vmusic, Mat Switch

Started by uncle, June 24, 2008, 02:16:30 PM

Previous topic - Next topic

uncle

Jon-

The following simple program is based on the work of Scary Terry and The Garage of Evil.  I have left in all the Vmusic commands just as a reminder to myself . 

It is definitely not as refined as the one you posted for use with the Vmusic player.  But it has an odd quirk that I haven't figured out; after the mat switch is activated, there is approximately a 20 second delay before the Ghost Host file plays.  The file itself only has a couple seconds of silence at the beginning.

Can you tell me what is causing this odd delay?

' =========================================================================
'
'   File....... Ghost Host.bs1
'   Purpose.... Play file on VMusic2 driven by a Prop-1
'   Author..... Mark Parry
'   Started.... 5/31/2008
'   Updated.... 5/31/2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
' Sends serial commands to the VMusic2 via the RXD input.  The following are the individual commands
' (note that 13 is a "carriage return):
' VPF file 13   Plays single file where "file" is MP3 name, MAXIMUM 8 CHARACTERS PLUS EXTENSION (8.3)
' VST 13           Stops play
' V3A 13           Plays all MP3 files
' VRA 13          Repeatedly plays all MP3 files
' VRR 13          Repeatedly plays random MP3 files
' VSF 13           Skip forward one track
' VSB 13           Skip back one track
' VP 13            Pause
' VSV byte 13   Sets playback volume, 0 loud, 256 off


' -----[ Revision History ]------------------------------------------------

' -----[ I/O Definitions ]-------------------------------------------------

' -----[ Constants ]-------------------------------------------------------
SYMBOL Baud      = T2400                       'The baud rate we'll be using is TRUE 2400
SYMBOL MatSw   = PIN6                         'mat switch Red and White wires on pin 6

SYMBOL No      = 0

' -----[ Variables ]-------------------------------------------------------

' -----[ EEPROM Data ]-----------------------------------------------------


' -----[ Initialization ]--------------------------------------------------
PAUSE 5000                                        'allow VMusic2 to initialize
SEROUT 0,Baud, ("VST",13)                          'stop anything that's playing
' -----[ Program Code ]----------------------------------------------------

Main:
IF MatSw = No THEN Main                             ' wait for "victim"
PAUSE 3000                                          ' 3 second pre-delay

SEROUT 0,Baud, ("VSV 0",13)                      'Set volume to full
PAUSE 5000                                          '5 second delay
SEROUT 0,Baud,("VPF g_host2.mp3",13)             'Play file named "g_host2.mp3"
PAUSE 30000                                         '30 second delay to allow play of file
PAUSE 20000                                         '20 second post-delay

GOTO Main
END
' -----[ Subroutines ]-----------------------------------------------------

JonnyMac

June 24, 2008, 03:02:52 PM #1 Last Edit: June 24, 2008, 03:04:38 PM by JonnyMac
Well, you have eight seconds of delay built in, the rest could be in the file.  Make sure that you don't have an ID0 data in your MP3 file and remove silence at the beginning of the MP3 audio.

Also, no need to reset the volume to max every time -- do that at the beginning of the program and be done with it.

Please note that you should use P7 to send the data, with the SETUP jumper set to UP, and the ULN removed.  Using another pin means that the ULN is weighing on the serial signal and could be causing the MP3 player to go into pause mode -- this may be accounting for some of the delay.
Jon McPhalen
EFX-TEK Hollywood Office