// Example showing how to implement changing behavior for an event
// Arguments:  
//		(no argument)
//
// Author: LoopToGo
//
// Description  : 	Start recording if the song is stopped otherwise, starts the Jam mode
//					This is an example of how to setup a midi pedal with different behaviors
//					A double click (calling this script twice within 500 msec), will resume JamMode					

loadScript aliases.txt


if $isRecording
	
	// Check for double click
	variable deltaClick $sysTime  - $gLastSysTime
	variable deltaclick $deltaClick/$tempo
	
	if $deltaClick < 500
		outOfJamMode	// The user doubled clicked we go out of jam mode
	else
		jamMode	// Togle JamMode
	endIf
else
	record
endIf	

globalVariable gLastSysTime $sysTime	// We use gloval variable because we want the next script to use this variable.