//-----------------------------------------------------------------------------
//------------ Copyright (c)2003-2018 Xylio. All Rights Reserved. -------------
//-----------------------------------------------------------------------------
// file implementing MIDI controller 'Hercules DJ Control Air'
//-----------------------------------------------------------------------------
function getLanguageVersion()
{
	return 1;// do not modify this, this should be 1 for all scripts
}
//-----------------------------------------------------------------------------
function getFileVersion()
{
	return 2;// update this as needed
}
//-----------------------------------------------------------------------------
// return a user friendly name for the controller supported
function getControllerUserFriendlyName()
{
	return "Hercules DJ Control Air";
}
//-----------------------------------------------------------------------------
// return the communication type that the controller supports
// this can be either 'midi' or 'hid' (please return only one of them in case the controller supports both)
function getControllerType()
{
	return 'midi';
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// preferred way to identify the controller (using the USB device VID and PID -- vendor and product id)
// return false if the controller does not support this kind of identification
// osId -- 0 Windows; 1 MacOSX; 2 Linux; -1 unknown
function getSupportedHidDeviceVID(osId)
{
	return false;
}
//-----------------------------------------------------------------------------
function getSupportedHidDevicePID(osId)
{
	return false;
}
//-----------------------------------------------------------------------------
// this is NOT the preferred way to identify the controller but you should use
// it if the controller does not support standard USB VID and PID identification
// return false if the controller does not support this kind of identification
// osId -- 0 Windows; 1 MacOSX; 2 Linux; -1 unknown
function getSupportedHidDeviceName(osId)
{
	return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// preferred way to identify the controller (using the USB device VID and PID -- vendor and product id)
// return false if the controller does not support this kind of identification
// osId -- 0 Windows; 1 MacOSX; 2 Linux; -1 unknown
function getSupportedMidiDeviceVID(osId)
{
	return 0x06f8;
}
//-----------------------------------------------------------------------------
function getSupportedMidiDevicePID(osId)
{
	return 0xb10f;// DJ Control Air
}
//-----------------------------------------------------------------------------
// preferred way to identify the controller (if it supports MIDI SysEx)
// return false if the controller does not support this kind of identification
function getSupportedMidiSysExIdString(osId)
{
	// sysex response to 'F0 7E 7F 06 01 F7' (identification request sysex)
	// please note that the response contains 5 bytes in hex format containing
	// the Manufacturer ID (3 bytes) and Model Number (2 bytes)
	// ATTN: the returned value should omit the standard 'F0 7E 00 06 02' message start
	//if(osId==1) return false;
	return "00014E02000B";
	// F0 7E 00 06 02 00 01 4E 02 00 02 00 01 00 00 00 F7 -- Hercules DJ Console MK2 complete sysex
	// F0 7E 00 06 02 00 01 4E 01 00 03 00 01 00 00 00 F7 -- Hercules DJ Control MP3 complete sysex
	// F0 7E 00 06 02 00 01 4E 02 00 04 00 01 00 00 00 F7 -- Hercules DJ Console RMX complete sysex
	// F0 7E 00 06 02 00 01 4E 01 00 05 00 01 00 00 00 F7 -- Hercules DJ Control Steel complete sysex
	// F0 7E 00 06 02 00 01 4E 01 00 07 00 01 00 00 00 F7 -- Hercules DJ Control MP3e2 complete sysex
	// F0 7E 00 06 02 00 01 4E 02 00 08 00 01 00 00 00 F7 -- Hercules DJ Console MK4 complete sysex
	// F0 7E 00 06 02 00 01 4E 02 00 0B 00 01 00 00 00 F7 -- Hercules DJ Control Air complete sysex
	// F0 7E 00 06 02 00 01 4E 02 00 0C 00 01 00 00 00 F7 -- Hercules DJ Control Instinct complete sysex
}
//-----------------------------------------------------------------------------
// this is NOT the preferred way to identify the controller but you should use
// it if the controller does not support standard MIDI SysEx identification
// return false if the controller does not support this kind of identification
// osId -- 0 Windows; 1 MacOSX; 2 Linux; -1 unknown
function getSupportedMidiDeviceNameForInput(osId)
{
	//if(osId==1) return "DJ Control Air";
	return false;
}
//-----------------------------------------------------------------------------
function getSupportedMidiDeviceNameForOutput(osId)
{
	//if(osId==1) return "DJ Control Air";
	return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// some variables necessary only for this particular script
var jogWheelsInScratchMode=0;
var previousAutoLoopLightLed=[-1,-1];// 2 decks leds
var samplerBlinkLedStatus=[0,0,0,0,0,0,0,0];// 2 decks leds, each with 4 samplers // 0 means off; 1 means on; 2 means blink on; 3 means blink off;
var lastBeatPos=[0,0];// 1,2,3,4 (0 is disabled)
//-----------------------------------------------------------------------------
// this shuts off the previous led and sets to on the new one
function setBeatPosLed(uniqueId,deck,beatpos)
{
	if(lastBeatPos[deck] == beatpos) return;// nothing to do
	// shuts off the previous led
	switch(lastBeatPos[deck])
	{
	case 1: sendMidi(uniqueId,0x90,0,(deck==0)?0x44:0x4C,0x00); break;
	case 2: sendMidi(uniqueId,0x90,0,(deck==0)?0x45:0x4D,0x00); break;
	case 3: sendMidi(uniqueId,0x90,0,(deck==0)?0x46:0x4E,0x00); break;
	case 4: sendMidi(uniqueId,0x90,0,(deck==0)?0x47:0x4F,0x00); break;
	}
	// save the last pos
	lastBeatPos[deck] = beatpos;
	// power on the new one
	switch(lastBeatPos[deck])
	{
	case 1: sendMidi(uniqueId,0x90,0,(deck==0)?0x44:0x4C,0x7F); break;
	case 2: sendMidi(uniqueId,0x90,0,(deck==0)?0x45:0x4D,0x7F); break;
	case 3: sendMidi(uniqueId,0x90,0,(deck==0)?0x46:0x4E,0x7F); break;
	case 4: sendMidi(uniqueId,0x90,0,(deck==0)?0x47:0x4F,0x7F); break;
	}
}
//-----------------------------------------------------------------------------
// this is called when the controller is initialized and the control is passed to this script
// use this to initialize any variables you might need, the controller' leds, etc
// uniqueId is a unique integer between 0..15 that is guaranteed not to change for
// a certain opened controller -- please note that there can be many controllers
// of the same type in use at the same time ! Use uniqueId to identify between them
function controllerInit(uniqueId)
{
	debug('controllerInit Hercules DJ Control Air ['+uniqueId+']');// this outputs a string to DebugView app on Win
	// setting audio (the actual routing is done automatically for this controller so
	// we don't need to manually set "RoutingOutHeadphones", "RoutingOutDeckA", etc
	// ATTN: none of the following audio device names have been tested/confirmed!
	if(setAudioDevice("Hercules DJ Control AIR ASIO|||DJControl Air ASIO|||Hercules DJ Control Air|||Hercules DJControl Air|||DJ Control Air|||Speakers (Hercules DJControl Air)|||Speakers (Hercules DJ Control Air)"))
	{
		//debug('AudioDevice was set OK');
		setSetting('AudioDevice2', "NO AUDIO");
	}
	//sendMidi(uniqueId, status, channel, data1, data2);
	sendMidi(uniqueId,0x90,0,0x2D,(jogWheelsInScratchMode ? 0x7F : 0x00));// scratch mode
	sendMidi(uniqueId,0x90,0,0x39,0x7F);// cue
	sendMidi(uniqueId,0x90,0,0x3A,0x7F);// mix
	sendMidi(uniqueId,0x90,0,0x2E,(getValue('autoDj') ? 0x7F : 0x00));// automix
	sendMidi(uniqueId,0x90,0,0x30,0x00);// record
	//------------------------------------
	callSendAllNotifications(uniqueId, true);// send all notifications to the controller (so that we don't have to manually init all leds/lcd screens)
}
//-----------------------------------------------------------------------------
// called just before the controller will be deinitialized and the control will go away from the script
// use to power off any powered leds, etc
function controllerDeinit(uniqueId)
{
	debug('controllerDeinit ['+uniqueId+']');
	// set leds off
	sendMidi(uniqueId,0x90,0,0x2D,0x00);// scratch mode
	sendMidi(uniqueId,0x90,0,0x39,0x00);// cue
	sendMidi(uniqueId,0x90,0,0x3A,0x00);// mix
	sendMidi(uniqueId,0x90,0,0x2E,0x00);// automix
	//------------------------------------
	callSendAllNotifications(uniqueId, false);// send all notifications to the controller (so that we don't have to manually de-init all leds/lcd screens)
	setBeatPosLed(uniqueId,0,0);
	setBeatPosLed(uniqueId,1,0);
}
//-----------------------------------------------------------------------------
// this is your main target function to implement the controller -- this is called
// for each and every MIDI message that comes from the controller itself
// return true if the message was processed by the script and false to let it
// pass thru the software (eg. so it can be assigned by the user using the LEARN function)
function messageReceived(uniqueId,status,channel,data1,data2)
{
	var messageNotProcessed=false;
	switch(status)
	{
	//-----------------------------------------------
	// controllers: sliders, knobs, jog-wheels, encoders ('moving' things)
	case 0xB0:
		switch(data1)
		{
		// global
		case 0x3A: call('setCrossfader', data2); break;
		//case 0x3D: call('setCuePgmMix', data2); break;
		case 0x3F: // IR proximity sensor (global)
			call('deckFxFlangerDW', 0, data2);
			call('deckFxFlangerDW', 1, data2);
			break;
		// per deck
		// deck A
		case 0x39: call('setDeckEqLow', 0, data2); break;
		case 0x38: call('setDeckEqMid', 0, data2); break;
		case 0x37: call('setDeckEqHigh', 0, data2); break;
		case 0x36: call('setDeckVolume', 0, data2); break;
		case 0x34: call('setDeckPitch', 0, data2); break;
		case 0x30: // params: (deck, increment, total positions per complete revolution)
		case 0x32:
			var val1 = (data2>0x40 ? data2-0x80 : data2);
			if(jogWheelsInScratchMode) call('scratchDeckJW', 0, val1, 128);else call('moveDeckJogWheel', 0, val1, 128);
			break;

		// deck B
		case 0x3E: call('setDeckEqLow', 1, data2); break;
		case 0x3D: call('setDeckEqMid', 1, data2); break;
		case 0x3C: call('setDeckEqHigh', 1, data2); break;
		case 0x3B: call('setDeckVolume', 1, data2); break;
		case 0x35: call('setDeckPitch', 1, data2); break;

		case 0x31: // params: (deck, increment, total positions per complete revolution)
		case 0x33:
			var val1 = (data2>0x40 ? data2-0x80 : data2);
			if(jogWheelsInScratchMode) call('scratchDeckJW', 1, val1, 128);else call('moveDeckJogWheel', 1, val1, 128);
			break;

		default: messageNotProcessed = true;
		}
		break;
	//-----------------------------------------------
	// note on/off: buttons, switches ('pressing' things)
	case 0x80:
	case 0x90:
		switch(data1)
		{
		// global
		case 0x39: // mix only
			if(data2>0x3F)
			{
				call('setCuePgmMix', 127);
				sendMidi(uniqueId,0x90,0,0x39,0x7F);
				sendMidi(uniqueId,0x90,0,0x3A,0x00);
			}
			break;
		case 0x3A: // cue only
			if(data2>0x3F)
			{
				call('setCuePgmMix', 0);
				sendMidi(uniqueId,0x90,0,0x39,0x00);
				sendMidi(uniqueId,0x90,0,0x3A,0x7F);
			}
			break;
		case 0x3B:// headphone volume -/+
		case 0x3C:
			if(data2>0x3F)
			{
				var monValue = getValue('monitorGain');
				if(data1==0x3B) monValue -= 2;else monValue += 2;
				if(monValue<-40) monValue = -40;
				if(monValue>0) monValue = 0;
				// we need to convert from -40..0dB to 0..127 (MIDI)
				call('setMonitorGain', Math.round((monValue+40)*3.175));
			}
			break;
		case 0x33: if(data2>0x3F) call('lbMoveCursor', -1); break;
		case 0x34: if(data2>0x3F) call('lbMoveCursor', +1); break;
		case 0x35: if(data2>0x3F) call('lbListSelect', 1); break;
		case 0x36: if(data2>0x3F) call('lbBrowserSelect', 1); break;
		case 0x2D: if(data2>0x3F){ jogWheelsInScratchMode = (jogWheelsInScratchMode+1)%2; sendMidi(uniqueId,0x90,0,0x2D,(jogWheelsInScratchMode ? 0x7F : 0x00));} break;
		case 0x2E: call('setAutoDj', data2); break;
		case 0x30: call('record', data2); break;

		// deck A
		case 0x01: call('deckFxFlanger', 0, data2); break;
		case 0x02: call('deckFxEcho', 0, data2); break;
		case 0x03: call('deckFxBeatwaw', 0, data2); break;
		case 0x04: call('deckFxReverb', 0, data2); break;
		case 0x05: call('samplerPlay', 1, data2); break;
		case 0x06: call('samplerPlay', 2, data2); break;
		case 0x07: call('samplerPlay', 3, data2); break;
		case 0x08: call('samplerPlay', 4, data2); break;
		case 0x09: call('deckLoop1', 0, data2); break;
		case 0x0A: call('deckLoop2', 0, data2); break;
		case 0x0B: call('deckLoop4', 0, data2); break;
		case 0x0C: call('deckLoop8', 0, data2); break;
		//case 0x0D: call('deckCuePos1', 0, data2); break;
		//case 0x0E: call('deckCuePos2', 0, data2); break;
		//case 0x0F: call('deckCuePos3', 0, data2); break;
		//case 0x10: call('deckCuePos4', 0, data2); break;

		case 0x0D: call('deckBendDown', 0, data2); break;
		case 0x0E: call('deckBendUp', 0, data2); break;
		case 0x0F: call('deckSearchLeft', 0, data2); break;
		case 0x10: call('deckSearchRight', 0, data2); break;
		case 0x11: call('deckCue', 0, data2); break;
		case 0x12: call('deckPlayPause', 0, data2); break;
		case 0x13: call('deckSync', 0, data2); break;
		case 0x14: call('deckMonitor', 0, data2); break;
		case 0x15: if(data2>0x3F) call('deckLBLoad', 0, data2); break;
		//case 0x1A: if(jogWheelsInScratchMode) call('holdDeckJogWheel', 0, data2); break;
		case 0x16: call('holdDeckJogWheel', 0, data2); break;
		//case 0x13: call('deckKeyLock', 0, data2); break;

		// deck B
		case 0x17: call('deckFxFlanger', 1, data2); break;
		case 0x18: call('deckFxEcho', 1, data2); break;
		case 0x19: call('deckFxBeatwaw', 1, data2); break;
		case 0x1A: call('deckFxReverb', 1, data2); break;
		case 0x1B: call('samplerPlay', 5, data2); break;
		case 0x1C: call('samplerPlay', 6, data2); break;
		case 0x1D: call('samplerPlay', 7, data2); break;
		case 0x1E: call('samplerPlay', 8, data2); break;
		case 0x1F: call('deckLoop1', 1, data2); break;
		case 0x20: call('deckLoop2', 1, data2); break;
		case 0x21: call('deckLoop4', 1, data2); break;
		case 0x22: call('deckLoop8', 1, data2); break;
		//case 0x27: call('deckCuePos1', 1, data2); break;
		//case 0x28: call('deckCuePos2', 1, data2); break;
		//case 0x29: call('deckCuePos3', 1, data2); break;
		//case 0x2A: call('deckCuePos4', 1, data2); break;

		case 0x23: call('deckBendDown', 1, data2); break;
		case 0x24: call('deckBendUp', 1, data2); break;
		case 0x25: call('deckSearchLeft', 1, data2); break;
		case 0x26: call('deckSearchRight', 1, data2); break;
		case 0x27: call('deckCue', 1, data2); break;
		case 0x28: call('deckPlayPause', 1, data2); break;
		case 0x29: call('deckSync', 1, data2); break;
		case 0x2A: call('deckMonitor', 1, data2); break;
		case 0x2B: if(data2>0x3F) call('deckLBLoad', 1, data2); break;
		case 0x2C: call('holdDeckJogWheel', 1, data2); break;
		//case 0x27: call('deckKeyLock', 1, data2); break;

		default: messageNotProcessed = true;
		}
		break;
	//-----------------------------------------------
	default: messageNotProcessed = true;
	}
	if(messageNotProcessed) debug('messageReceived ['+uniqueId+'] - status:'+status+' channel:'+channel+' data1:'+data1+' data2:'+data2);
	return !messageNotProcessed;
}
//-----------------------------------------------------------------------------
// this is called by the software whenever something important changes (eg. play status, song changed, etc)
// depending on the notification type it may refer to a global event (deck is -1) or a specific deck (deck >= 0)
// and can contain any/all of the parameters: param 1 is an integer, param 2 is a float, param 3 is a string
function notificationReceived(uniqueId,name,deck,param1,param2,param3)
{
	//debug('notif ['+uniqueId+'] name='+name + ' deck='+deck + ' p1(int)='+param1 + ' p2(float)='+param2 + ' p3(str)='+param3);
	if(deck>=2) return;
	var nameLen = name.length;
	if(name=='beatPos'){ setBeatPosLed(uniqueId, deck, param1); return;}

	if(name=='fxFlanger') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x01:0x17,(param1 ? 0x7F : 0x00));
	if(name=='fxEcho') 		sendMidi(uniqueId,0x90,0,(deck==0)?0x02:0x18,(param1 ? 0x7F : 0x00));
	if(name=='fxBeatwaw') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x03:0x19,(param1 ? 0x7F : 0x00));
	if(name=='fxReverb') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x04:0x1A,(param1 ? 0x7F : 0x00));

	//if(name=='cuepos1') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x0D:0x27,(param1 ? 0x7F : 0x00));
	//if(name=='cuepos2') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x0E:0x28,(param1 ? 0x7F : 0x00));
	//if(name=='cuepos3') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x0F:0x29,(param1 ? 0x7F : 0x00));
	//if(name=='cuepos4') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x10:0x2A,(param1 ? 0x7F : 0x00));

	if(name=='cue') 		sendMidi(uniqueId,0x90,0,(deck==0)?0x11:0x27,(param1 ? 0x7F : 0x00));
	if(name=='play') 		sendMidi(uniqueId,0x90,0,(deck==0)?0x12:0x28,(param1 ? 0x7F : 0x00));
	if(name=='onbeat') 		sendMidi(uniqueId,0x90,0,(deck==0)?0x13:0x29,(param1 ? 0x7F : 0x00));
	if(name=='monitor') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x14:0x2A,(param1 ? 0x7F : 0x00));
	//if(name=='keyLock') 	sendMidi(uniqueId,0x90,0,(deck==0)?0x13:0x27,(param1 ? 0x7F : 0x00));
	if(name=='loopSize')
	{
		// turn off last led (if any is on)
		if(previousAutoLoopLightLed[deck]>-1)
			sendMidi(uniqueId,0x90,0,previousAutoLoopLightLed[deck],0x00);
		// calculate the new led to power on
		switch(param1)
		{
		case   64: previousAutoLoopLightLed[deck] = (deck==0)?0x09:0x1F; break;// 1 beat
		case  128: previousAutoLoopLightLed[deck] = (deck==0)?0x0A:0x20; break;// 2 beats
		case  256: previousAutoLoopLightLed[deck] = (deck==0)?0x0B:0x21; break;// 4 beats
		case  512: previousAutoLoopLightLed[deck] = (deck==0)?0x0C:0x22; break;// 8 beats
		default:   previousAutoLoopLightLed[deck] = -1;
		}
		// actually light the led
		if(previousAutoLoopLightLed[deck]>-1)
			sendMidi(uniqueId,0x90,0,previousAutoLoopLightLed[deck],0x7F);
	}
	if(name=='autoDj') 		sendMidi(uniqueId,0x90,0,0x2E,(param1 ? 0x7F : 0x00));// automix
	//var samplerBlinkLedStatus=[0,0,0,0,0,0,0,0];// 2 decks leds, each with 4 samplers // 0 means off; 1 means on; 2 means blink on; 3 means blink off;
	if(nameLen==8)
	{
		var name1 = name.substr(0, nameLen-1);
		if(name1=='sampler')
		{
			var samplerIdx = parseInt(name.charAt(nameLen-1))-1;
			//debug('notif sampler strLen='+nameLen+' idx='+samplerIdx + ' char='+name.charAt(nameLen-1));
			if(!param1)
			{
				samplerBlinkLedStatus[samplerIdx] = 0;
				if(name=='sampler1') sendMidi(uniqueId,0x90,0,0x05,0x00);
				if(name=='sampler2') sendMidi(uniqueId,0x90,0,0x06,0x00);
				if(name=='sampler3') sendMidi(uniqueId,0x90,0,0x07,0x00);
				if(name=='sampler4') sendMidi(uniqueId,0x90,0,0x08,0x00);
				if(name=='sampler5') sendMidi(uniqueId,0x90,0,0x1B,0x00);
				if(name=='sampler6') sendMidi(uniqueId,0x90,0,0x1C,0x00);
				if(name=='sampler7') sendMidi(uniqueId,0x90,0,0x1D,0x00);
				if(name=='sampler8') sendMidi(uniqueId,0x90,0,0x1E,0x00);
				// instead of Math.floor(19/4), parseInt(19/4) = 4 can also be used
			}else
			{
				if(name=='sampler1') sendMidi(uniqueId,0x90,0,0x05,0x7F);
				if(name=='sampler2') sendMidi(uniqueId,0x90,0,0x06,0x7F);
				if(name=='sampler3') sendMidi(uniqueId,0x90,0,0x07,0x7F);
				if(name=='sampler4') sendMidi(uniqueId,0x90,0,0x08,0x7F);
				if(name=='sampler5') sendMidi(uniqueId,0x90,0,0x1B,0x7F);
				if(name=='sampler6') sendMidi(uniqueId,0x90,0,0x1C,0x7F);
				if(name=='sampler7') sendMidi(uniqueId,0x90,0,0x1D,0x7F);
				if(name=='sampler8') sendMidi(uniqueId,0x90,0,0x1E,0x7F);
				if(param2>0) samplerBlinkLedStatus[samplerIdx] = 2;else samplerBlinkLedStatus[samplerIdx] = 1;
			}
		}
	}
}
//-----------------------------------------------------------------------------
// this is called from time to time by the software (several times per second)
// (it is guaranteed that 'timerTick' will get executed ALWAYS right after notificationReceived)
function timerTick(uniqueId)
{
	//debug('timerTick ['+uniqueId+']');
	// sampler leds
	//var samplerBlinkLedStatus=[0,0,0,0,0,0,0,0];// 2 decks leds, each with 4 samplers // 0 means off; 1 means on; 2 means blink on; 3 means blink off;
	for(var i=0; i<8; i++)
	{
		// test if blinking is active
		if(samplerBlinkLedStatus[i]>1)
		{
			if(samplerBlinkLedStatus[i]==2) samplerBlinkLedStatus[i] = 3;else samplerBlinkLedStatus[i] = 2;
			switch(i)
			{
			case 0: sendMidi(uniqueId,0x90,0,0x05,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 1: sendMidi(uniqueId,0x90,0,0x06,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 2: sendMidi(uniqueId,0x90,0,0x07,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 3: sendMidi(uniqueId,0x90,0,0x08,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 4: sendMidi(uniqueId,0x90,0,0x1B,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 5: sendMidi(uniqueId,0x90,0,0x1C,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 6: sendMidi(uniqueId,0x90,0,0x1D,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			case 7: sendMidi(uniqueId,0x90,0,0x1E,((samplerBlinkLedStatus[i]==2) ? 0x7F : 0x00)); break;
			}
		}
	}
}
//-----------------------------------------------------------------------------
