
; simple_SFX_trigger.EZ
; Foxonix / Metre Ideas and Design
; www.foxonix.com

; Program: Will Sakran
; Created: 02.26.14
; Public - Modify and share this program as you wish.

; Program description
;	Press button1 to hear the sound effect (interruptable)
;	Press button2 to hear the sound effect (not interruptable)

; Hardware INPUTS
; 	One button connected to pin P1.0
;	One button connected to pin P1.1

; Hardware OUTPUTS
; 	Speaker connected to PWM speaker output


; Set the device name
[device]
SNC21030


; Specify the number of pins to be used as inputs.
; At lease one input must be defined even if it is not used.
[key]
direct=2


[files]
lasershot1_12k.wav


; Define the various input states for the program.
; This describes which pins will have buttons, switches, or
; other inputs attached to them, and defines when those
; inputs will be active and inactive. At least one input
; state must be defined even if it is not used.
[input_states]
; Port.Pin		P1.0	P1.1
locked_out:		x	x
enabled:		button1 button2


; Define the routines (paths) that the program will use.
; The init path is always called first on power up and reset.
[paths]
init:
	& locked_out		; ignore inputs during init
	& freq=12k		; set sample playback rate to 12 kHz
	& enabled		; enable the inputs
	& end			; stop the program and enter low power mode


; when P1.0 is triggered, the button1: label is called.
button1:
	& lasershot1_12k.wav	; play sound effect file
	& end			; stop the program and enter low power mode


; when P1.1 is triggered, the button2: label is called.
button2:
	& locked_out		; ingore inputs while sound effect is playing
	& lasershot1_12k.wav	; play sound effect file
	& enabled		; enable the inputs
	& end