// Example on how to gerate a  Led effects on a Launchpad Mini MkIII from LoopToGo (from script button, script marker, etc)
//			It should be seen as a demo, not a perfect solution. 
//			The led effects are from the library LoopToGo\Libs\Novation\novationLaunchPadMiniLedEffects.ltgl
//			For now, this library is quite limited but will eventually grow. If you are interested to add your own effects to this library, please contact us
//			You should adapt it to your own needs and modify and/or cerate other Led Effects
//
// Arguments:  
//		arg1: Fx 
//			1: ledFxColumn (default)
//			2: ledFxRow 
//			3: ledFxRowColumn 
//			4: ledFxGow 
//			5: ledFxGrow2
//			6: ledFxGrow3 
//			7: ledFxGrowFromCenter 
//			8: ledFxGrowFromContour 
//		arg2: note
//		arg3: color
//		arg4: delay	
//
// Author: LoopToGo



// We enable script concurrency because event can occur again even if the script has not completed!!!!
setScriptConcurrencyMode 0			// if the script is already running, it will launch another script. In other words, 2 instances of the same script can run together

alias aDevice LaunchPadMini		// Should be set to your own LaunchPad Mini MkIII mapped name (Preferences/MIDI)


ifNot $gCurrentMode = 0
	endScriptDynamic	// We must be in Session mode to run this script!!!!
endIf


ifNot $gLaunchPadCurrentPage = 3
	endScriptDynamic	// We must be on page 3 to run this script!!!!
endIf



loadScript LoopToGo\Libs\Novation\novationLaunchPadMiniLedEffects.ltgl

if $nbArgs > 1
	variable note $arg2
else
	variable note 44
endIf	

if $nbArgs > 2
	variable color $arg3
else
	variable color 34
endIf	

if $nbArgs > 3
	variable delay $arg4
else
	variable delay .16
endIf

variable effectsFunction ledFxColumn  // Default FX function


callFunction setEffectsFunction $arg1

//print effectsFunction : $effectsFunction

if $arg1 < 6

	callFunction $effectsFunction aDevice 1 $note $color 
	waitDelta $delay
	callFunction $effectsFunction aDevice 0 $note $color
else
	callFunction $effectsFunction aDevice $delay $color
endIf	

function setEffectsFunction // fxNo [in]

	if $arg1 = 1
		parentVariable effectsFunction ledFxColumn  
		exitFunction
	endIf

	if $arg1 = 2
		parentVariable effectsFunction ledFxRow  
		exitFunction
	endIf

	if $arg1 = 3
		parentVariable effectsFunction ledFxRowColumn  
		exitFunction
	endIf

	if $arg1 = 4
		parentVariable effectsFunction ledFxGrow  
		exitFunction
	endIf

	if $arg1 = 5		
		parentVariable effectsFunction ledFxGrow2  
		exitFunction
	endIf
	
	if $arg1 = 6		
		parentVariable effectsFunction ledFxGrow3  
		exitFunction
	endIf
	
	if $arg1 = 7		
		parentVariable effectsFunction ledFxGrowFromCenter  
		exitFunction
	endIf

	if $arg1 = 8		
		parentVariable effectsFunction ledFxGrowFromContour  
		exitFunction
	endIf	

endFunction


	

