November 21, 2024, 05:03:00 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.


SFX additions

Started by aquawilly54, October 24, 2015, 08:16:10 PM

Previous topic - Next topic

aquawilly54

Good evening all.
    I've been creating different versions of the program posted below with small changes as a base for my learning curve.  It works just fine.  I can put 1 file, 4 files, 6 files, and so on up to 9 and it works great using the SFX.00.WAV thru SFX09.WAV format. 

I thought I'd try to add SFX10.WAV to the mix but I can't.  I get nothing when the prop is triggered except a split second output at P0 and the AP stays steady green.  Here's what I've tried:

  -    Put audio select on "A" and Changed the address from ("!AP16", %00, "P?", 9, 1) to ("!AP16", %00, "P?", 10, 1) and  ("!AP16", %01, "P?", 10, 1).  Each one loaded to the prop 1, but no go.   
I also changed  ("!AP16", %00, "G") to ("!AP16", %01, "G") figuring they had to match.  Still no go.


I've spent a couple of hours ghosting on the forum trying to find a similar issue, so I could learn from that, but it didn't pan out, so here I am.

Just hoping someone can get me over this hurdle.

Thanks much.
Steve





' =========================================================================
'
'   File......      Witch jumper
'   Purpose...      Jump up with sound (witch's cackle)
'   Author....      Steve
'   E-mail....
'   Started...      10/20/2015
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------



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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Cylinder        = PIN0                  ' activate air cylinder


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  status          = B0                    ' status (B0 for bit access)
SYMBOL   playing        = BIT7                  ' 0 = idle, 1 = playing

SYMBOL  timer           = B2                    ' for debounce loop


' -----[ Initialization ]--------------------------------------------------

Power_Up:
  PAUSE 3000                                    ' let AP-16+ initialize

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs

  PAUSE 30000                                   ' PIR warm-up/delay


' -----[ Program Code ]----------------------------------------------------

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

   SEROUT Sio, Baud, ("!AP16", %00, "P?", 9, 1) ' randomize SFX00..SFX09

  Cylinder = IsOn                               ' activate cylinder

Audio_Wait:
  PAUSE 50
  SEROUT Sio, Baud, ("!AP16", %00, "G")         ' request status
  SERIN  Sio, Baud, status                      ' get it from AP-16+
  IF playing = Yes THEN Audio_Wait              ' check playing bit
    GOTO Reset

JonnyMac

This is the correct syntax to play a random file between SFX00.WAV and SFX10.WAV

  SEROUT Sio, Baud, ("!AP16", %00, "P?", 10, 1)

...but SFX10.WAV must be on the card else the command will be ignored. Turn the selector knob on the AP-16+ to the "A" (10) position and press the play button to verify that it plays properly.
Jon McPhalen
EFX-TEK Hollywood Office

aquawilly54

...but SFX10.WAV must be on the card else the command will be ignored. Turn the selector knob on the AP-16+ to the "A" (10) position and press the play button to verify that it plays properly.

Yup, that's what I've done...3 times, so I guess I'm on the right path at least.

The card has been formatted at least 4 times
The proper syntax has been put in three times
Audio select has been changed in accordance with the above.

I just don't see why it's working with 0-9, but not 10 or more.

No sweat.  I will figure it out thru play and learn.

Thanks much Jonny Mac.

Steve

JonnyMac

October 25, 2015, 04:24:09 PM #3 Last Edit: October 25, 2015, 04:29:21 PM by JonnyMac
Well... I just hooked up an AP-16+ to a Prop-1 that has SFX00.WAV through SFFX15.WAV, and the audio is the name of the file. For example, SFX00.WAV plays my voice saying "Ess Eff Ecks Zero."  I just let it run in a loop that randomly plays all the files, including 10 and above.

I also ran your code through and it works as expected. I'm not sure what's happening on your end. Sorry.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

BTW... the SELECT dial position has no effect on the ability to remotely play a random file; that only applies when pressing the Play button.
Jon McPhalen
EFX-TEK Hollywood Office