package com.domemusictechnologies.polyperformancecontroller;


import voltage.controllers.*;
import voltage.core.*;
import voltage.core.Jack.JackType;
import voltage.sources.*;
import voltage.utility.*;
import voltage.processors.*;
import voltage.effects.*;
import java.awt.*;

//[user-imports]   Add your own imports here

import static java.lang.Math.exp;   // e to the power x method, used for RC time constant calc

//[/user-imports]


public class PolyPerformanceController extends VoltageModule
//[user-inheritance]
//[/user-inheritance]
{

public PolyPerformanceController( long moduleID, VoltageObjects voltageObjects )
{
   super( moduleID, voltageObjects, "Poly Performance Controller", ModuleType.ModuleType_PolyphonicUtilities, 3.0 );

   InitializeControls();
   InitializeControls2();


   canBeBypassed = true;
   SetSkin( "2073c8697dd143289dce935eacd25845" );
}

void InitializeControls()
{

   externalControllerInputJack = new VoltageAudioJack( "External Controller CV input", "External Controller CV input", this, JackType.JackType_AudioInput );
   AddComponent( externalControllerInputJack );
   externalControllerInputJack.SetWantsMouseNotifications( false );
   externalControllerInputJack.SetPosition( 25, 98 );
   externalControllerInputJack.SetSize( 25, 25 );
   externalControllerInputJack.SetSkin( "Jack Round Dark Blue Ring" );

   controllerSourceSwitch = new VoltageSwitch( "Controller Source", "Controller Source", this, 3 );
   AddComponent( controllerSourceSwitch );
   controllerSourceSwitch.SetWantsMouseNotifications( false );
   controllerSourceSwitch.SetPosition( 4, 42 );
   controllerSourceSwitch.SetSize( 15, 51 );
   controllerSourceSwitch.SetSkin( "4-State Slide Vertical" );

   textLabel1 = new VoltageLabel( "textLabel1", "textLabel1", this, "Aftertouch" );
   AddComponent( textLabel1 );
   textLabel1.SetWantsMouseNotifications( false );
   textLabel1.SetPosition( 20, 42 );
   textLabel1.SetSize( 47, 13 );
   textLabel1.SetEditable( false, false );
   textLabel1.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel1.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel1.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel1.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel1.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel1.SetBorderSize( 1 );
   textLabel1.SetMultiLineEdit( false );
   textLabel1.SetIsNumberEditor( false );
   textLabel1.SetNumberEditorRange( 0, 100 );
   textLabel1.SetNumberEditorInterval( 1 );
   textLabel1.SetNumberEditorUsesMouseWheel( false );
   textLabel1.SetHasCustomTextHoverColor( false );
   textLabel1.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel1.SetFont( "Verdana", 10, false, false );

   textLabel2 = new VoltageLabel( "textLabel2", "textLabel2", this, "Mod Wheel" );
   AddComponent( textLabel2 );
   textLabel2.SetWantsMouseNotifications( false );
   textLabel2.SetPosition( 19, 54 );
   textLabel2.SetSize( 52, 13 );
   textLabel2.SetEditable( false, false );
   textLabel2.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel2.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel2.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel2.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel2.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel2.SetBorderSize( 1 );
   textLabel2.SetMultiLineEdit( false );
   textLabel2.SetIsNumberEditor( false );
   textLabel2.SetNumberEditorRange( 0, 100 );
   textLabel2.SetNumberEditorInterval( 1 );
   textLabel2.SetNumberEditorUsesMouseWheel( false );
   textLabel2.SetHasCustomTextHoverColor( false );
   textLabel2.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel2.SetFont( "Verdana", 10, false, false );

   textLabel3 = new VoltageLabel( "textLabel3", "textLabel3", this, "Pitch Bend" );
   AddComponent( textLabel3 );
   textLabel3.SetWantsMouseNotifications( false );
   textLabel3.SetPosition( 19, 67 );
   textLabel3.SetSize( 52, 12 );
   textLabel3.SetEditable( false, false );
   textLabel3.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel3.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel3.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel3.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel3.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel3.SetBorderSize( 1 );
   textLabel3.SetMultiLineEdit( false );
   textLabel3.SetIsNumberEditor( false );
   textLabel3.SetNumberEditorRange( 0, 100 );
   textLabel3.SetNumberEditorInterval( 1 );
   textLabel3.SetNumberEditorUsesMouseWheel( false );
   textLabel3.SetHasCustomTextHoverColor( false );
   textLabel3.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel3.SetFont( "Verdana", 10, false, false );

   textLabel4 = new VoltageLabel( "textLabel4", "textLabel4", this, "External" );
   AddComponent( textLabel4 );
   textLabel4.SetWantsMouseNotifications( false );
   textLabel4.SetPosition( 19, 122 );
   textLabel4.SetSize( 41, 12 );
   textLabel4.SetEditable( false, false );
   textLabel4.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel4.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel4.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel4.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel4.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel4.SetBorderSize( 1 );
   textLabel4.SetMultiLineEdit( false );
   textLabel4.SetIsNumberEditor( false );
   textLabel4.SetNumberEditorRange( 0, 100 );
   textLabel4.SetNumberEditorInterval( 1 );
   textLabel4.SetNumberEditorUsesMouseWheel( false );
   textLabel4.SetHasCustomTextHoverColor( false );
   textLabel4.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel4.SetFont( "Verdana", 10, false, false );

   textLabel5 = new VoltageLabel( "textLabel5", "textLabel5", this, "Controller" );
   AddComponent( textLabel5 );
   textLabel5.SetWantsMouseNotifications( false );
   textLabel5.SetPosition( 10, 25 );
   textLabel5.SetSize( 55, 15 );
   textLabel5.SetEditable( false, false );
   textLabel5.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel5.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel5.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel5.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel5.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel5.SetBorderSize( 1 );
   textLabel5.SetMultiLineEdit( false );
   textLabel5.SetIsNumberEditor( false );
   textLabel5.SetNumberEditorRange( 0, 100 );
   textLabel5.SetNumberEditorInterval( 1 );
   textLabel5.SetNumberEditorUsesMouseWheel( false );
   textLabel5.SetHasCustomTextHoverColor( false );
   textLabel5.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel5.SetFont( "Verdana", 12, false, false );

   polyGateInputJack = new VoltagePolyJack( "Poly Gate Input", "Poly Gate Input", this, JackType.JackType_PolyInput );
   AddComponent( polyGateInputJack );
   polyGateInputJack.SetWantsMouseNotifications( false );
   polyGateInputJack.SetPosition( 75, 43 );
   polyGateInputJack.SetSize( 25, 25 );
   polyGateInputJack.SetSkin( "Poly Jack Straight" );

   textLabel6 = new VoltageLabel( "textLabel6", "textLabel6", this, "Poly Inputs" );
   AddComponent( textLabel6 );
   textLabel6.SetWantsMouseNotifications( false );
   textLabel6.SetPosition( 78, 25 );
   textLabel6.SetSize( 61, 15 );
   textLabel6.SetEditable( false, false );
   textLabel6.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel6.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel6.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel6.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel6.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel6.SetBorderSize( 1 );
   textLabel6.SetMultiLineEdit( false );
   textLabel6.SetIsNumberEditor( false );
   textLabel6.SetNumberEditorRange( 0, 100 );
   textLabel6.SetNumberEditorInterval( 1 );
   textLabel6.SetNumberEditorUsesMouseWheel( false );
   textLabel6.SetHasCustomTextHoverColor( false );
   textLabel6.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel6.SetFont( "Verdana", 12, false, false );

   polyPitchInputJack = new VoltagePolyJack( "Poly Pitch Input", "Poly Pitch Input", this, JackType.JackType_PolyInput );
   AddComponent( polyPitchInputJack );
   polyPitchInputJack.SetWantsMouseNotifications( false );
   polyPitchInputJack.SetPosition( 115, 43 );
   polyPitchInputJack.SetSize( 25, 25 );
   polyPitchInputJack.SetSkin( "Poly Jack Straight" );

   textLabel7 = new VoltageLabel( "textLabel7", "textLabel7", this, "Gate" );
   AddComponent( textLabel7 );
   textLabel7.SetWantsMouseNotifications( false );
   textLabel7.SetPosition( 76, 68 );
   textLabel7.SetSize( 26, 10 );
   textLabel7.SetEditable( false, false );
   textLabel7.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel7.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel7.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel7.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel7.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel7.SetBorderSize( 1 );
   textLabel7.SetMultiLineEdit( false );
   textLabel7.SetIsNumberEditor( false );
   textLabel7.SetNumberEditorRange( 0, 100 );
   textLabel7.SetNumberEditorInterval( 1 );
   textLabel7.SetNumberEditorUsesMouseWheel( false );
   textLabel7.SetHasCustomTextHoverColor( false );
   textLabel7.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel7.SetFont( "Verdana", 10, false, false );

   textLabel8 = new VoltageLabel( "textLabel8", "textLabel8", this, "Pitch" );
   AddComponent( textLabel8 );
   textLabel8.SetWantsMouseNotifications( false );
   textLabel8.SetPosition( 116, 68 );
   textLabel8.SetSize( 25, 10 );
   textLabel8.SetEditable( false, false );
   textLabel8.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel8.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel8.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel8.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel8.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel8.SetBorderSize( 1 );
   textLabel8.SetMultiLineEdit( false );
   textLabel8.SetIsNumberEditor( false );
   textLabel8.SetNumberEditorRange( 0, 100 );
   textLabel8.SetNumberEditorInterval( 1 );
   textLabel8.SetNumberEditorUsesMouseWheel( false );
   textLabel8.SetHasCustomTextHoverColor( false );
   textLabel8.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel8.SetFont( "Verdana", 10, false, false );

   textLabel9 = new VoltageLabel( "textLabel9", "textLabel9", this, "Dome Music Technologies" );
   AddComponent( textLabel9 );
   textLabel9.SetWantsMouseNotifications( false );
   textLabel9.SetPosition( 8, 342 );
   textLabel9.SetSize( 200, 18 );
   textLabel9.SetEditable( false, false );
   textLabel9.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel9.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel9.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel9.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel9.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel9.SetBorderSize( 1 );
   textLabel9.SetMultiLineEdit( true );
   textLabel9.SetIsNumberEditor( false );
   textLabel9.SetNumberEditorRange( 0, 100 );
   textLabel9.SetNumberEditorInterval( 1 );
   textLabel9.SetNumberEditorUsesMouseWheel( false );
   textLabel9.SetHasCustomTextHoverColor( false );
   textLabel9.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel9.SetFont( "Verdana", 10, false, false );

   textLabel10 = new VoltageLabel( "textLabel10", "textLabel10", this, "Poly Performance Controller" );
   AddComponent( textLabel10 );
   textLabel10.SetWantsMouseNotifications( false );
   textLabel10.SetPosition( 9, 0 );
   textLabel10.SetSize( 199, 16 );
   textLabel10.SetEditable( false, false );
   textLabel10.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel10.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel10.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel10.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel10.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel10.SetBorderSize( 1 );
   textLabel10.SetMultiLineEdit( true );
   textLabel10.SetIsNumberEditor( false );
   textLabel10.SetNumberEditorRange( 0, 100 );
   textLabel10.SetNumberEditorInterval( 1 );
   textLabel10.SetNumberEditorUsesMouseWheel( false );
   textLabel10.SetHasCustomTextHoverColor( false );
   textLabel10.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel10.SetFont( "Verdana", 14, false, false );

   knobAttack = new VoltageKnob( "Attack Time", "Attack Time", this, 1, 20000, 10 );
   AddComponent( knobAttack );
   knobAttack.SetWantsMouseNotifications( false );
   knobAttack.SetPosition( 50, 143 );
   knobAttack.SetSize( 37, 37 );
   knobAttack.SetSkin( "Plastic White" );
   knobAttack.SetRingSkin( "Ramp Blue3/White" );
   knobAttack.SetRange( 1, 20000, 10, false, 0 );
   knobAttack.SetKnobParams( 215, 145 );
   knobAttack.DisplayValueInPercent( false );
   knobAttack.SetKnobAdjustsRing( true );
   knobAttack.SetMidpointValue( 1000 );

   textLabel12 = new VoltageLabel( "textLabel12", "textLabel12", this, "Attack" );
   AddComponent( textLabel12 );
   textLabel12.SetWantsMouseNotifications( false );
   textLabel12.SetPosition( 51, 175 );
   textLabel12.SetSize( 35, 12 );
   textLabel12.SetEditable( false, false );
   textLabel12.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel12.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel12.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel12.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel12.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel12.SetBorderSize( 1 );
   textLabel12.SetMultiLineEdit( false );
   textLabel12.SetIsNumberEditor( false );
   textLabel12.SetNumberEditorRange( 0, 100 );
   textLabel12.SetNumberEditorInterval( 1 );
   textLabel12.SetNumberEditorUsesMouseWheel( false );
   textLabel12.SetHasCustomTextHoverColor( false );
   textLabel12.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel12.SetFont( "Verdana", 10, false, false );

   textLabel13 = new VoltageLabel( "textLabel13", "textLabel13", this, "Release" );
   AddComponent( textLabel13 );
   textLabel13.SetWantsMouseNotifications( false );
   textLabel13.SetPosition( 101, 175 );
   textLabel13.SetSize( 37, 12 );
   textLabel13.SetEditable( false, false );
   textLabel13.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel13.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel13.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel13.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel13.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel13.SetBorderSize( 1 );
   textLabel13.SetMultiLineEdit( false );
   textLabel13.SetIsNumberEditor( false );
   textLabel13.SetNumberEditorRange( 0, 100 );
   textLabel13.SetNumberEditorInterval( 1 );
   textLabel13.SetNumberEditorUsesMouseWheel( false );
   textLabel13.SetHasCustomTextHoverColor( false );
   textLabel13.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel13.SetFont( "Verdana", 10, false, false );

   knobRelease = new VoltageKnob( "Release Time", "Release Time", this, 1, 20000, 10 );
   AddComponent( knobRelease );
   knobRelease.SetWantsMouseNotifications( false );
   knobRelease.SetPosition( 101, 143 );
   knobRelease.SetSize( 37, 37 );
   knobRelease.SetSkin( "Plastic White" );
   knobRelease.SetRingSkin( "Ramp Blue3/White" );
   knobRelease.SetRange( 1, 20000, 10, false, 0 );
   knobRelease.SetKnobParams( 215, 145 );
   knobRelease.DisplayValueInPercent( false );
   knobRelease.SetKnobAdjustsRing( true );
   knobRelease.SetMidpointValue( 1000 );

   attackModeSwitch = new VoltageSwitch( "Attack Mode", "Attack Mode", this, 0 );
   AddComponent( attackModeSwitch );
   attackModeSwitch.SetWantsMouseNotifications( false );
   attackModeSwitch.SetPosition( 48, 191 );
   attackModeSwitch.SetSize( 15, 39 );
   attackModeSwitch.SetSkin( "3-State Slide Vertical" );

   textLabel14 = new VoltageLabel( "textLabel14", "textLabel14", this, "Voice" );
   AddComponent( textLabel14 );
   textLabel14.SetWantsMouseNotifications( false );
   textLabel14.SetPosition( 63, 192 );
   textLabel14.SetSize( 29, 13 );
   textLabel14.SetEditable( false, false );
   textLabel14.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel14.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel14.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel14.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel14.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel14.SetBorderSize( 1 );
   textLabel14.SetMultiLineEdit( false );
   textLabel14.SetIsNumberEditor( false );
   textLabel14.SetNumberEditorRange( 0, 100 );
   textLabel14.SetNumberEditorInterval( 1 );
   textLabel14.SetNumberEditorUsesMouseWheel( false );
   textLabel14.SetHasCustomTextHoverColor( false );
   textLabel14.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel14.SetFont( "Verdana", 10, false, false );

   textLabel15 = new VoltageLabel( "textLabel15", "textLabel15", this, "Current" );
   AddComponent( textLabel15 );
   textLabel15.SetWantsMouseNotifications( false );
   textLabel15.SetPosition( 63, 204 );
   textLabel15.SetSize( 38, 13 );
   textLabel15.SetEditable( false, false );
   textLabel15.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel15.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel15.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel15.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel15.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel15.SetBorderSize( 1 );
   textLabel15.SetMultiLineEdit( false );
   textLabel15.SetIsNumberEditor( false );
   textLabel15.SetNumberEditorRange( 0, 100 );
   textLabel15.SetNumberEditorInterval( 1 );
   textLabel15.SetNumberEditorUsesMouseWheel( false );
   textLabel15.SetHasCustomTextHoverColor( false );
   textLabel15.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel15.SetFont( "Verdana", 10, false, false );

   textLabel49 = new VoltageLabel( "textLabel49", "textLabel49", this, "Key & Out" );
   AddComponent( textLabel49 );
   textLabel49.SetWantsMouseNotifications( false );
   textLabel49.SetPosition( 166, 314 );
   textLabel49.SetSize( 47, 13 );
   textLabel49.SetEditable( false, false );
   textLabel49.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel49.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel49.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel49.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel49.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel49.SetBorderSize( 1 );
   textLabel49.SetMultiLineEdit( false );
   textLabel49.SetIsNumberEditor( false );
   textLabel49.SetNumberEditorRange( 0, 100 );
   textLabel49.SetNumberEditorInterval( 1 );
   textLabel49.SetNumberEditorUsesMouseWheel( false );
   textLabel49.SetHasCustomTextHoverColor( false );
   textLabel49.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel49.SetFont( "Verdana", 10, false, false );

   textLabel50 = new VoltageLabel( "textLabel50", "textLabel50", this, "Key Only" );
   AddComponent( textLabel50 );
   textLabel50.SetWantsMouseNotifications( false );
   textLabel50.SetPosition( 166, 302 );
   textLabel50.SetSize( 47, 13 );
   textLabel50.SetEditable( false, false );
   textLabel50.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel50.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel50.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel50.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel50.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel50.SetBorderSize( 1 );
   textLabel50.SetMultiLineEdit( false );
   textLabel50.SetIsNumberEditor( false );
   textLabel50.SetNumberEditorRange( 0, 100 );
   textLabel50.SetNumberEditorInterval( 1 );
   textLabel50.SetNumberEditorUsesMouseWheel( false );
   textLabel50.SetHasCustomTextHoverColor( false );
   textLabel50.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel50.SetFont( "Verdana", 10, false, false );

   textLabel16 = new VoltageLabel( "textLabel16", "textLabel16", this, "Zero" );
   AddComponent( textLabel16 );
   textLabel16.SetWantsMouseNotifications( false );
   textLabel16.SetPosition( 63, 216 );
   textLabel16.SetSize( 29, 13 );
   textLabel16.SetEditable( false, false );
   textLabel16.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel16.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel16.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel16.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel16.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel16.SetBorderSize( 1 );
   textLabel16.SetMultiLineEdit( false );
   textLabel16.SetIsNumberEditor( false );
   textLabel16.SetNumberEditorRange( 0, 100 );
   textLabel16.SetNumberEditorInterval( 1 );
   textLabel16.SetNumberEditorUsesMouseWheel( false );
   textLabel16.SetHasCustomTextHoverColor( false );
   textLabel16.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel16.SetFont( "Verdana", 10, false, false );

   releaseModeSwitch = new VoltageSwitch( "Release Mode", "Release Mode", this, 0 );
   AddComponent( releaseModeSwitch );
   releaseModeSwitch.SetWantsMouseNotifications( false );
   releaseModeSwitch.SetPosition( 102, 191 );
   releaseModeSwitch.SetSize( 15, 39 );
   releaseModeSwitch.SetSkin( "3-State Slide Vertical" );

   textLabel17 = new VoltageLabel( "textLabel17", "textLabel17", this, "Zero" );
   AddComponent( textLabel17 );
   textLabel17.SetWantsMouseNotifications( false );
   textLabel17.SetPosition( 118, 216 );
   textLabel17.SetSize( 23, 13 );
   textLabel17.SetEditable( false, false );
   textLabel17.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel17.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel17.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel17.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel17.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel17.SetBorderSize( 1 );
   textLabel17.SetMultiLineEdit( false );
   textLabel17.SetIsNumberEditor( false );
   textLabel17.SetNumberEditorRange( 0, 100 );
   textLabel17.SetNumberEditorInterval( 1 );
   textLabel17.SetNumberEditorUsesMouseWheel( false );
   textLabel17.SetHasCustomTextHoverColor( false );
   textLabel17.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel17.SetFont( "Verdana", 10, false, false );

   textLabel18 = new VoltageLabel( "textLabel18", "textLabel18", this, "Hold" );
   AddComponent( textLabel18 );
   textLabel18.SetWantsMouseNotifications( false );
   textLabel18.SetPosition( 118, 204 );
   textLabel18.SetSize( 24, 13 );
   textLabel18.SetEditable( false, false );
   textLabel18.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel18.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel18.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel18.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel18.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel18.SetBorderSize( 1 );
   textLabel18.SetMultiLineEdit( false );
   textLabel18.SetIsNumberEditor( false );
   textLabel18.SetNumberEditorRange( 0, 100 );
   textLabel18.SetNumberEditorInterval( 1 );
   textLabel18.SetNumberEditorUsesMouseWheel( false );
   textLabel18.SetHasCustomTextHoverColor( false );
   textLabel18.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel18.SetFont( "Verdana", 10, false, false );

   keyModeSwitch = new VoltageSwitch( "Key Mode", "Key Mode", this, 2 );
   AddComponent( keyModeSwitch );
   keyModeSwitch.SetWantsMouseNotifications( false );
   keyModeSwitch.SetPosition( 4, 191 );
   keyModeSwitch.SetSize( 15, 39 );
   keyModeSwitch.SetSkin( "3-State Slide Vertical" );

   textLabel19 = new VoltageLabel( "textLabel19", "textLabel19", this, "Last" );
   AddComponent( textLabel19 );
   textLabel19.SetWantsMouseNotifications( false );
   textLabel19.SetPosition( 20, 192 );
   textLabel19.SetSize( 22, 13 );
   textLabel19.SetEditable( false, false );
   textLabel19.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel19.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel19.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel19.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel19.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel19.SetBorderSize( 1 );
   textLabel19.SetMultiLineEdit( false );
   textLabel19.SetIsNumberEditor( false );
   textLabel19.SetNumberEditorRange( 0, 100 );
   textLabel19.SetNumberEditorInterval( 1 );
   textLabel19.SetNumberEditorUsesMouseWheel( false );
   textLabel19.SetHasCustomTextHoverColor( false );
   textLabel19.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel19.SetFont( "Verdana", 10, false, false );

   textLabel20 = new VoltageLabel( "textLabel20", "textLabel20", this, "Held" );
   AddComponent( textLabel20 );
   textLabel20.SetWantsMouseNotifications( false );
   textLabel20.SetPosition( 20, 204 );
   textLabel20.SetSize( 24, 13 );
   textLabel20.SetEditable( false, false );
   textLabel20.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel20.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel20.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel20.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel20.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel20.SetBorderSize( 1 );
   textLabel20.SetMultiLineEdit( false );
   textLabel20.SetIsNumberEditor( false );
   textLabel20.SetNumberEditorRange( 0, 100 );
   textLabel20.SetNumberEditorInterval( 1 );
   textLabel20.SetNumberEditorUsesMouseWheel( false );
   textLabel20.SetHasCustomTextHoverColor( false );
   textLabel20.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel20.SetFont( "Verdana", 10, false, false );

   textLabel21 = new VoltageLabel( "textLabel21", "textLabel21", this, "First" );
   AddComponent( textLabel21 );
   textLabel21.SetWantsMouseNotifications( false );
   textLabel21.SetPosition( 20, 216 );
   textLabel21.SetSize( 22, 13 );
   textLabel21.SetEditable( false, false );
   textLabel21.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel21.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel21.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel21.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel21.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel21.SetBorderSize( 1 );
   textLabel21.SetMultiLineEdit( false );
   textLabel21.SetIsNumberEditor( false );
   textLabel21.SetNumberEditorRange( 0, 100 );
   textLabel21.SetNumberEditorInterval( 1 );
   textLabel21.SetNumberEditorUsesMouseWheel( false );
   textLabel21.SetHasCustomTextHoverColor( false );
   textLabel21.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel21.SetFont( "Verdana", 10, false, false );

   controllerLevelKnob = new VoltageKnob( "Controller Output Level", "Controller Output Level", this, 0.0, 60.0, 60.0 );
   AddComponent( controllerLevelKnob );
   controllerLevelKnob.SetWantsMouseNotifications( false );
   controllerLevelKnob.SetPosition( 2, 143 );
   controllerLevelKnob.SetSize( 37, 37 );
   controllerLevelKnob.SetSkin( "Plastic Blue" );
   controllerLevelKnob.SetRingSkin( "Ramp Blue3/White" );
   controllerLevelKnob.SetRange( 0.0, 60.0, 60.0, false, 0 );
   controllerLevelKnob.SetKnobParams( 215, 145 );
   controllerLevelKnob.DisplayValueInPercent( false );
   controllerLevelKnob.SetKnobAdjustsRing( true );
   controllerLevelKnob.SetMidpointValue( 2.0 );

   textLabel22 = new VoltageLabel( "textLabel22", "textLabel22", this, "Level" );
   AddComponent( textLabel22 );
   textLabel22.SetWantsMouseNotifications( false );
   textLabel22.SetPosition( 3, 175 );
   textLabel22.SetSize( 35, 12 );
   textLabel22.SetEditable( false, false );
   textLabel22.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel22.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel22.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel22.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel22.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel22.SetBorderSize( 1 );
   textLabel22.SetMultiLineEdit( false );
   textLabel22.SetIsNumberEditor( false );
   textLabel22.SetNumberEditorRange( 0, 100 );
   textLabel22.SetNumberEditorInterval( 1 );
   textLabel22.SetNumberEditorUsesMouseWheel( false );
   textLabel22.SetHasCustomTextHoverColor( false );
   textLabel22.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel22.SetFont( "Verdana", 10, false, false );

   textLabel23 = new VoltageLabel( "textLabel23", "textLabel23", this, "Poly Outputs" );
   AddComponent( textLabel23 );
   textLabel23.SetWantsMouseNotifications( false );
   textLabel23.SetPosition( 58, 261 );
   textLabel23.SetSize( 70, 15 );
   textLabel23.SetEditable( false, false );
   textLabel23.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel23.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel23.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel23.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel23.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel23.SetBorderSize( 1 );
   textLabel23.SetMultiLineEdit( false );
   textLabel23.SetIsNumberEditor( false );
   textLabel23.SetNumberEditorRange( 0, 100 );
   textLabel23.SetNumberEditorInterval( 1 );
   textLabel23.SetNumberEditorUsesMouseWheel( false );
   textLabel23.SetHasCustomTextHoverColor( false );
   textLabel23.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel23.SetFont( "Verdana", 12, false, false );

   textLabel28 = new VoltageLabel( "textLabel28", "textLabel28", this, "VCA" );
   AddComponent( textLabel28 );
   textLabel28.SetWantsMouseNotifications( false );
   textLabel28.SetPosition( 8, 240 );
   textLabel28.SetSize( 26, 15 );
   textLabel28.SetEditable( false, false );
   textLabel28.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel28.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel28.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel28.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel28.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel28.SetBorderSize( 1 );
   textLabel28.SetMultiLineEdit( false );
   textLabel28.SetIsNumberEditor( false );
   textLabel28.SetNumberEditorRange( 0, 100 );
   textLabel28.SetNumberEditorInterval( 1 );
   textLabel28.SetNumberEditorUsesMouseWheel( false );
   textLabel28.SetHasCustomTextHoverColor( false );
   textLabel28.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel28.SetFont( "Verdana", 12, false, false );

   textLabel30 = new VoltageLabel( "textLabel30", "textLabel30", this, "+" );
   AddComponent( textLabel30 );
   textLabel30.SetWantsMouseNotifications( false );
   textLabel30.SetPosition( 116, 91 );
   textLabel30.SetSize( 12, 15 );
   textLabel30.SetEditable( false, false );
   textLabel30.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel30.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel30.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel30.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel30.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel30.SetBorderSize( 1 );
   textLabel30.SetMultiLineEdit( false );
   textLabel30.SetIsNumberEditor( false );
   textLabel30.SetNumberEditorRange( 0, 100 );
   textLabel30.SetNumberEditorInterval( 1 );
   textLabel30.SetNumberEditorUsesMouseWheel( false );
   textLabel30.SetHasCustomTextHoverColor( false );
   textLabel30.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel30.SetFont( "Verdana", 12, false, false );

   textLabel31 = new VoltageLabel( "textLabel31", "textLabel31", this, "-" );
   AddComponent( textLabel31 );
   textLabel31.SetWantsMouseNotifications( false );
   textLabel31.SetPosition( 91, 91 );
   textLabel31.SetSize( 12, 15 );
   textLabel31.SetEditable( false, false );
   textLabel31.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel31.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel31.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel31.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel31.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel31.SetBorderSize( 1 );
   textLabel31.SetMultiLineEdit( false );
   textLabel31.SetIsNumberEditor( false );
   textLabel31.SetNumberEditorRange( 0, 100 );
   textLabel31.SetNumberEditorInterval( 1 );
   textLabel31.SetNumberEditorUsesMouseWheel( false );
   textLabel31.SetHasCustomTextHoverColor( false );
   textLabel31.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel31.SetFont( "Verdana", 12, false, false );

   textLabel24 = new VoltageLabel( "textLabel24", "textLabel24", this, "Control + Pitch" );
   AddComponent( textLabel24 );
   textLabel24.SetWantsMouseNotifications( false );
   textLabel24.SetPosition( 75, 304 );
   textLabel24.SetSize( 33, 24 );
   textLabel24.SetEditable( false, false );
   textLabel24.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel24.SetJustificationFlags( VoltageLabel.Justification.Top );
   textLabel24.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel24.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel24.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel24.SetBorderSize( 1 );
   textLabel24.SetMultiLineEdit( true );
   textLabel24.SetIsNumberEditor( false );
   textLabel24.SetNumberEditorRange( 0, 100 );
   textLabel24.SetNumberEditorInterval( 1 );
   textLabel24.SetNumberEditorUsesMouseWheel( false );
   textLabel24.SetHasCustomTextHoverColor( false );
   textLabel24.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel24.SetFont( "Verdana", 10, false, false );

   textLabel25 = new VoltageLabel( "textLabel25", "textLabel25", this, "Control Only" );
   AddComponent( textLabel25 );
   textLabel25.SetWantsMouseNotifications( false );
   textLabel25.SetPosition( 108, 304 );
   textLabel25.SetSize( 35, 23 );
   textLabel25.SetEditable( false, false );
   textLabel25.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel25.SetJustificationFlags( VoltageLabel.Justification.Top );
   textLabel25.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel25.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel25.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel25.SetBorderSize( 1 );
   textLabel25.SetMultiLineEdit( false );
   textLabel25.SetIsNumberEditor( false );
   textLabel25.SetNumberEditorRange( 0, 100 );
   textLabel25.SetNumberEditorInterval( 1 );
   textLabel25.SetNumberEditorUsesMouseWheel( false );
   textLabel25.SetHasCustomTextHoverColor( false );
   textLabel25.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel25.SetFont( "Verdana", 10, false, false );

   polyOutputJackControlOnly = new VoltagePolyJack( "Poly Out Control Only", "Poly Out Control Only", this, JackType.JackType_PolyOutput );
   AddComponent( polyOutputJackControlOnly );
   polyOutputJackControlOnly.SetWantsMouseNotifications( false );
   polyOutputJackControlOnly.SetPosition( 114, 279 );
   polyOutputJackControlOnly.SetSize( 25, 25 );
   polyOutputJackControlOnly.SetSkin( "Poly Jack Straight" );

   polyOutputJackPlusPitch = new VoltagePolyJack( "Poly Out Control + Pitch", "Poly Out Control + Pitch", this, JackType.JackType_PolyOutput );
   AddComponent( polyOutputJackPlusPitch );
   polyOutputJackPlusPitch.SetWantsMouseNotifications( false );
   polyOutputJackPlusPitch.SetPosition( 79, 279 );
   polyOutputJackPlusPitch.SetSize( 25, 25 );
   polyOutputJackPlusPitch.SetSkin( "Poly Jack Straight" );

   polyOutputJackVCA = new VoltagePolyJack( "Poly VCA Output", "Poly VCA Output", this, JackType.JackType_PolyOutput );
   AddComponent( polyOutputJackVCA );
   polyOutputJackVCA.SetWantsMouseNotifications( false );
   polyOutputJackVCA.SetPosition( 44, 279 );
   polyOutputJackVCA.SetSize( 25, 25 );
   polyOutputJackVCA.SetSkin( "Poly Jack Straight" );

   textLabel26 = new VoltageLabel( "textLabel26", "textLabel26", this, "VCA Output" );
   AddComponent( textLabel26 );
   textLabel26.SetWantsMouseNotifications( false );
   textLabel26.SetPosition( 39, 304 );
   textLabel26.SetSize( 33, 24 );
   textLabel26.SetEditable( false, false );
   textLabel26.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel26.SetJustificationFlags( VoltageLabel.Justification.Top );
   textLabel26.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel26.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel26.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel26.SetBorderSize( 1 );
   textLabel26.SetMultiLineEdit( true );
   textLabel26.SetIsNumberEditor( false );
   textLabel26.SetNumberEditorRange( 0, 100 );
   textLabel26.SetNumberEditorInterval( 1 );
   textLabel26.SetNumberEditorUsesMouseWheel( false );
   textLabel26.SetHasCustomTextHoverColor( false );
   textLabel26.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel26.SetFont( "Verdana", 10, false, false );

   inputJackVCAMono = new VoltageAudioJack( "VCA Mono Input", "VCA Mono Input", this, JackType.JackType_AudioInput );
   AddComponent( inputJackVCAMono );
   inputJackVCAMono.SetWantsMouseNotifications( false );
   inputJackVCAMono.SetPosition( 7, 298 );
   inputJackVCAMono.SetSize( 25, 25 );
   inputJackVCAMono.SetSkin( "Jack Round Sky Ring" );

   textLabel27 = new VoltageLabel( "textLabel27", "textLabel27", this, "Poly In" );
   AddComponent( textLabel27 );
   textLabel27.SetWantsMouseNotifications( false );
   textLabel27.SetPosition( 3, 281 );
   textLabel27.SetSize( 33, 13 );
   textLabel27.SetEditable( false, false );
   textLabel27.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel27.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel27.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel27.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel27.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel27.SetBorderSize( 1 );
   textLabel27.SetMultiLineEdit( false );
   textLabel27.SetIsNumberEditor( false );
   textLabel27.SetNumberEditorRange( 0, 100 );
   textLabel27.SetNumberEditorInterval( 1 );
   textLabel27.SetNumberEditorUsesMouseWheel( false );
   textLabel27.SetHasCustomTextHoverColor( false );
   textLabel27.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel27.SetFont( "Verdana", 10, false, false );

   textLabel29 = new VoltageLabel( "textLabel29", "textLabel29", this, "Mono In" );
   AddComponent( textLabel29 );
   textLabel29.SetWantsMouseNotifications( false );
   textLabel29.SetPosition( 0, 322 );
   textLabel29.SetSize( 40, 14 );
   textLabel29.SetEditable( false, false );
   textLabel29.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel29.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel29.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel29.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel29.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel29.SetBorderSize( 1 );
   textLabel29.SetMultiLineEdit( false );
   textLabel29.SetIsNumberEditor( false );
   textLabel29.SetNumberEditorRange( 0, 100 );
   textLabel29.SetNumberEditorInterval( 1 );
   textLabel29.SetNumberEditorUsesMouseWheel( false );
   textLabel29.SetHasCustomTextHoverColor( false );
   textLabel29.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel29.SetFont( "Verdana", 10, false, false );

   polyInputVCAJack = new VoltagePolyJack( "VCA Poly Input", "VCA Poly Input", this, JackType.JackType_PolyInput );
   AddComponent( polyInputVCAJack );
   polyInputVCAJack.SetWantsMouseNotifications( false );
   polyInputVCAJack.SetPosition( 7, 257 );
   polyInputVCAJack.SetSize( 25, 25 );
   polyInputVCAJack.SetSkin( "Poly Jack Straight" );

   meterControllerVoltage = new VoltageVUMeter( "Controller Voltage", "Controller Voltage", this );
   AddComponent( meterControllerVoltage );
   meterControllerVoltage.SetWantsMouseNotifications( false );
   meterControllerVoltage.SetPosition( 103, 82 );
   meterControllerVoltage.SetSize( 9, 51 );
   meterControllerVoltage.SetSkin( "Slider Thin Blue Meter" );
   meterControllerVoltage.SetLinearMode( true );

   LEDpositive = new VoltageLED( "Positive LED", "Positive LED", this );
   AddComponent( LEDpositive );
   LEDpositive.SetWantsMouseNotifications( false );
   LEDpositive.SetPosition( 115, 82 );
   LEDpositive.SetSize( 11, 11 );
   LEDpositive.SetSkin( "Green" );

   LEDnegative = new VoltageLED( "Negative LED", "Negative LED", this );
   AddComponent( LEDnegative );
   LEDnegative.SetWantsMouseNotifications( false );
   LEDnegative.SetPosition( 89, 82 );
   LEDnegative.SetSize( 11, 11 );
   LEDnegative.SetSkin( "Red" );

   LEDgate = new VoltageLED( "Gate LED", "Gate LED", this );
   AddComponent( LEDgate );
   LEDgate.SetWantsMouseNotifications( false );
   LEDgate.SetPosition( 102, 50 );
   LEDgate.SetSize( 11, 11 );
   LEDgate.SetSkin( "Blue" );

   textLabel32 = new VoltageLabel( "textLabel32", "textLabel32", this, "Peak" );
   AddComponent( textLabel32 );
   textLabel32.SetWantsMouseNotifications( false );
   textLabel32.SetPosition( 118, 192 );
   textLabel32.SetSize( 24, 13 );
   textLabel32.SetEditable( false, false );
   textLabel32.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel32.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel32.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel32.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel32.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel32.SetBorderSize( 1 );
   textLabel32.SetMultiLineEdit( false );
   textLabel32.SetIsNumberEditor( false );
   textLabel32.SetNumberEditorRange( 0, 100 );
   textLabel32.SetNumberEditorInterval( 1 );
   textLabel32.SetNumberEditorUsesMouseWheel( false );
   textLabel32.SetHasCustomTextHoverColor( false );
   textLabel32.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel32.SetFont( "Verdana", 10, false, false );

   meterOutput3 = new VoltageVUMeter( "Voice Output_5", "Voice Output_5", this );
   AddComponent( meterOutput3 );
   meterOutput3.SetWantsMouseNotifications( false );
   meterOutput3.SetPosition( 185, 67 );
   meterOutput3.SetSize( 9, 33 );
   meterOutput3.SetSkin( "Slider Thin Blue Meter" );
   meterOutput3.SetLinearMode( true );

   meterOutput4 = new VoltageVUMeter( "Voice Output_6", "Voice Output_6", this );
   AddComponent( meterOutput4 );
   meterOutput4.SetWantsMouseNotifications( false );
   meterOutput4.SetPosition( 201, 67 );
   meterOutput4.SetSize( 9, 33 );
   meterOutput4.SetSkin( "Slider Thin Blue Meter" );
   meterOutput4.SetLinearMode( true );

   meterOutput5 = new VoltageVUMeter( "Voice Output_1", "Voice Output_1", this );
   AddComponent( meterOutput5 );
   meterOutput5.SetWantsMouseNotifications( false );
   meterOutput5.SetPosition( 153, 130 );
   meterOutput5.SetSize( 9, 33 );
   meterOutput5.SetSkin( "Slider Thin Blue Meter" );
   meterOutput5.SetLinearMode( true );

   meterOutput6 = new VoltageVUMeter( "Voice Output_7", "Voice Output_7", this );
   AddComponent( meterOutput6 );
   meterOutput6.SetWantsMouseNotifications( false );
   meterOutput6.SetPosition( 169, 130 );
   meterOutput6.SetSize( 9, 33 );
   meterOutput6.SetSkin( "Slider Thin Blue Meter" );
   meterOutput6.SetLinearMode( true );

   meterOutput7 = new VoltageVUMeter( "Voice Output_8", "Voice Output_8", this );
   AddComponent( meterOutput7 );
   meterOutput7.SetWantsMouseNotifications( false );
   meterOutput7.SetPosition( 185, 130 );
   meterOutput7.SetSize( 9, 33 );
   meterOutput7.SetSkin( "Slider Thin Blue Meter" );
   meterOutput7.SetLinearMode( true );

   meterOutput8 = new VoltageVUMeter( "Voice Output_9", "Voice Output_9", this );
   AddComponent( meterOutput8 );
   meterOutput8.SetWantsMouseNotifications( false );
   meterOutput8.SetPosition( 201, 130 );
   meterOutput8.SetSize( 9, 33 );
   meterOutput8.SetSkin( "Slider Thin Blue Meter" );
   meterOutput8.SetLinearMode( true );

   meterOutput9 = new VoltageVUMeter( "Voice Output_2", "Voice Output_2", this );
   AddComponent( meterOutput9 );
   meterOutput9.SetWantsMouseNotifications( false );
   meterOutput9.SetPosition( 153, 193 );
   meterOutput9.SetSize( 9, 33 );
   meterOutput9.SetSkin( "Slider Thin Blue Meter" );
   meterOutput9.SetLinearMode( true );

   meterOutput10 = new VoltageVUMeter( "Voice Output_10", "Voice Output_10", this );
   AddComponent( meterOutput10 );
   meterOutput10.SetWantsMouseNotifications( false );
   meterOutput10.SetPosition( 169, 193 );
   meterOutput10.SetSize( 9, 33 );
   meterOutput10.SetSkin( "Slider Thin Blue Meter" );
   meterOutput10.SetLinearMode( true );

   meterOutput11 = new VoltageVUMeter( "Voice Output_11", "Voice Output_11", this );
   AddComponent( meterOutput11 );
   meterOutput11.SetWantsMouseNotifications( false );
   meterOutput11.SetPosition( 185, 193 );
   meterOutput11.SetSize( 9, 33 );
   meterOutput11.SetSkin( "Slider Thin Blue Meter" );
   meterOutput11.SetLinearMode( true );

   meterOutput12 = new VoltageVUMeter( "Voice Output_12", "Voice Output_12", this );
   AddComponent( meterOutput12 );
   meterOutput12.SetWantsMouseNotifications( false );
   meterOutput12.SetPosition( 201, 193 );
   meterOutput12.SetSize( 9, 33 );
   meterOutput12.SetSkin( "Slider Thin Blue Meter" );
   meterOutput12.SetLinearMode( true );

   meterOutput13 = new VoltageVUMeter( "Voice Output_3", "Voice Output_3", this );
   AddComponent( meterOutput13 );
   meterOutput13.SetWantsMouseNotifications( false );
   meterOutput13.SetPosition( 153, 256 );
   meterOutput13.SetSize( 9, 33 );
   meterOutput13.SetSkin( "Slider Thin Blue Meter" );
   meterOutput13.SetLinearMode( true );

   meterOutput14 = new VoltageVUMeter( "Voice Output_13", "Voice Output_13", this );
   AddComponent( meterOutput14 );
   meterOutput14.SetWantsMouseNotifications( false );
   meterOutput14.SetPosition( 169, 256 );
   meterOutput14.SetSize( 9, 33 );
   meterOutput14.SetSkin( "Slider Thin Blue Meter" );
   meterOutput14.SetLinearMode( true );

   meterOutput15 = new VoltageVUMeter( "Voice Output_14", "Voice Output_14", this );
   AddComponent( meterOutput15 );
   meterOutput15.SetWantsMouseNotifications( false );
   meterOutput15.SetPosition( 185, 256 );
   meterOutput15.SetSize( 9, 33 );
   meterOutput15.SetSkin( "Slider Thin Blue Meter" );
   meterOutput15.SetLinearMode( true );

   meterOutput16 = new VoltageVUMeter( "Voice Output_15", "Voice Output_15", this );
   AddComponent( meterOutput16 );
   meterOutput16.SetWantsMouseNotifications( false );
   meterOutput16.SetPosition( 201, 256 );
   meterOutput16.SetSize( 9, 33 );
   meterOutput16.SetSkin( "Slider Thin Blue Meter" );
   meterOutput16.SetLinearMode( true );

   meterOutput1 = new VoltageVUMeter( "Voice Output", "Voice Output", this );
   AddComponent( meterOutput1 );
   meterOutput1.SetWantsMouseNotifications( false );
   meterOutput1.SetPosition( 153, 67 );
   meterOutput1.SetSize( 9, 33 );
   meterOutput1.SetSkin( "Slider Thin Blue Meter" );
   meterOutput1.SetLinearMode( true );

   meterOutput2 = new VoltageVUMeter( "Voice Output_4", "Voice Output_4", this );
   AddComponent( meterOutput2 );
   meterOutput2.SetWantsMouseNotifications( false );
   meterOutput2.SetPosition( 169, 67 );
   meterOutput2.SetSize( 9, 33 );
   meterOutput2.SetSkin( "Slider Thin Blue Meter" );
   meterOutput2.SetLinearMode( true );

   textLabel11 = new VoltageLabel( "textLabel11", "textLabel11", this, "Voices" );
   AddComponent( textLabel11 );
   textLabel11.SetWantsMouseNotifications( false );
   textLabel11.SetPosition( 164, 25 );
   textLabel11.SetSize( 39, 15 );
   textLabel11.SetEditable( false, false );
   textLabel11.SetJustificationFlags( VoltageLabel.Justification.Left );
   textLabel11.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel11.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel11.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel11.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel11.SetBorderSize( 1 );
   textLabel11.SetMultiLineEdit( false );
   textLabel11.SetIsNumberEditor( false );
   textLabel11.SetNumberEditorRange( 0, 100 );
   textLabel11.SetNumberEditorInterval( 1 );
   textLabel11.SetNumberEditorUsesMouseWheel( false );
   textLabel11.SetHasCustomTextHoverColor( false );
   textLabel11.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel11.SetFont( "Verdana", 12, false, false );

   LEDgate2 = new VoltageLED( "Voice Gate_1", "Voice Gate_1", this );
   AddComponent( LEDgate2 );
   LEDgate2.SetWantsMouseNotifications( false );
   LEDgate2.SetPosition( 168, 53 );
   LEDgate2.SetSize( 11, 11 );
   LEDgate2.SetSkin( "Blue And Red" );

   LEDgate4 = new VoltageLED( "Voice Gate_3", "Voice Gate_3", this );
   AddComponent( LEDgate4 );
   LEDgate4.SetWantsMouseNotifications( false );
   LEDgate4.SetPosition( 200, 53 );
   LEDgate4.SetSize( 11, 11 );
   LEDgate4.SetSkin( "Blue And Red" );

   LEDgate5 = new VoltageLED( "Voice Gate_4", "Voice Gate_4", this );
   AddComponent( LEDgate5 );
   LEDgate5.SetWantsMouseNotifications( false );
   LEDgate5.SetPosition( 152, 116 );
   LEDgate5.SetSize( 11, 11 );
   LEDgate5.SetSkin( "Blue And Red" );

   LEDgate6 = new VoltageLED( "Voice Gate_5", "Voice Gate_5", this );
   AddComponent( LEDgate6 );
   LEDgate6.SetWantsMouseNotifications( false );
   LEDgate6.SetPosition( 168, 116 );
   LEDgate6.SetSize( 11, 11 );
   LEDgate6.SetSkin( "Blue And Red" );

   LEDgate7 = new VoltageLED( "Voice Gate_6", "Voice Gate_6", this );
   AddComponent( LEDgate7 );
   LEDgate7.SetWantsMouseNotifications( false );
   LEDgate7.SetPosition( 184, 116 );
   LEDgate7.SetSize( 11, 11 );
   LEDgate7.SetSkin( "Blue And Red" );

   LEDgate8 = new VoltageLED( "Voice Gate_7", "Voice Gate_7", this );
   AddComponent( LEDgate8 );
   LEDgate8.SetWantsMouseNotifications( false );
   LEDgate8.SetPosition( 200, 116 );
   LEDgate8.SetSize( 11, 11 );
   LEDgate8.SetSkin( "Blue And Red" );
}

void InitializeControls2()
{

   LEDgate9 = new VoltageLED( "Voice Gate_8", "Voice Gate_8", this );
   AddComponent( LEDgate9 );
   LEDgate9.SetWantsMouseNotifications( false );
   LEDgate9.SetPosition( 152, 179 );
   LEDgate9.SetSize( 11, 11 );
   LEDgate9.SetSkin( "Blue And Red" );

   LEDgate10 = new VoltageLED( "Voice Gate_9", "Voice Gate_9", this );
   AddComponent( LEDgate10 );
   LEDgate10.SetWantsMouseNotifications( false );
   LEDgate10.SetPosition( 168, 179 );
   LEDgate10.SetSize( 11, 11 );
   LEDgate10.SetSkin( "Blue And Red" );

   LEDgate11 = new VoltageLED( "Voice Gate_10", "Voice Gate_10", this );
   AddComponent( LEDgate11 );
   LEDgate11.SetWantsMouseNotifications( false );
   LEDgate11.SetPosition( 184, 179 );
   LEDgate11.SetSize( 11, 11 );
   LEDgate11.SetSkin( "Blue And Red" );

   LEDgate12 = new VoltageLED( "Voice Gate_11", "Voice Gate_11", this );
   AddComponent( LEDgate12 );
   LEDgate12.SetWantsMouseNotifications( false );
   LEDgate12.SetPosition( 200, 179 );
   LEDgate12.SetSize( 11, 11 );
   LEDgate12.SetSkin( "Blue And Red" );

   LEDgate13 = new VoltageLED( "Voice Gate_12", "Voice Gate_12", this );
   AddComponent( LEDgate13 );
   LEDgate13.SetWantsMouseNotifications( false );
   LEDgate13.SetPosition( 152, 242 );
   LEDgate13.SetSize( 11, 11 );
   LEDgate13.SetSkin( "Blue And Red" );

   LEDgate14 = new VoltageLED( "Voice Gate_13", "Voice Gate_13", this );
   AddComponent( LEDgate14 );
   LEDgate14.SetWantsMouseNotifications( false );
   LEDgate14.SetPosition( 168, 242 );
   LEDgate14.SetSize( 11, 11 );
   LEDgate14.SetSkin( "Blue And Red" );

   LEDgate15 = new VoltageLED( "Voice Gate_14", "Voice Gate_14", this );
   AddComponent( LEDgate15 );
   LEDgate15.SetWantsMouseNotifications( false );
   LEDgate15.SetPosition( 184, 242 );
   LEDgate15.SetSize( 11, 11 );
   LEDgate15.SetSkin( "Blue And Red" );

   LEDgate16 = new VoltageLED( "Voice Gate_15", "Voice Gate_15", this );
   AddComponent( LEDgate16 );
   LEDgate16.SetWantsMouseNotifications( false );
   LEDgate16.SetPosition( 200, 242 );
   LEDgate16.SetSize( 11, 11 );
   LEDgate16.SetSkin( "Blue And Red" );

   LEDgate1 = new VoltageLED( "Voice Gate", "Voice Gate", this );
   AddComponent( LEDgate1 );
   LEDgate1.SetWantsMouseNotifications( false );
   LEDgate1.SetPosition( 152, 53 );
   LEDgate1.SetSize( 11, 11 );
   LEDgate1.SetSkin( "Blue And Red" );

   LEDgate3 = new VoltageLED( "Voice Gate_2", "Voice Gate_2", this );
   AddComponent( LEDgate3 );
   LEDgate3.SetWantsMouseNotifications( false );
   LEDgate3.SetPosition( 184, 53 );
   LEDgate3.SetSize( 11, 11 );
   LEDgate3.SetSkin( "Blue And Red" );

   textVoice2 = new VoltageLabel( "textLabel37", "textLabel37", this, "2" );
   AddComponent( textVoice2 );
   textVoice2.SetWantsMouseNotifications( false );
   textVoice2.SetPosition( 164, 40 );
   textVoice2.SetSize( 19, 14 );
   textVoice2.SetEditable( false, false );
   textVoice2.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice2.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice2.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice2.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice2.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice2.SetBorderSize( 1 );
   textVoice2.SetMultiLineEdit( false );
   textVoice2.SetIsNumberEditor( false );
   textVoice2.SetNumberEditorRange( 0, 100 );
   textVoice2.SetNumberEditorInterval( 1 );
   textVoice2.SetNumberEditorUsesMouseWheel( false );
   textVoice2.SetHasCustomTextHoverColor( false );
   textVoice2.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice2.SetFont( "Verdana", 10, false, false );

   textVoice4 = new VoltageLabel( "textLabel39", "textLabel39", this, "4" );
   AddComponent( textVoice4 );
   textVoice4.SetWantsMouseNotifications( false );
   textVoice4.SetPosition( 196, 40 );
   textVoice4.SetSize( 19, 14 );
   textVoice4.SetEditable( false, false );
   textVoice4.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice4.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice4.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice4.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice4.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice4.SetBorderSize( 1 );
   textVoice4.SetMultiLineEdit( false );
   textVoice4.SetIsNumberEditor( false );
   textVoice4.SetNumberEditorRange( 0, 100 );
   textVoice4.SetNumberEditorInterval( 1 );
   textVoice4.SetNumberEditorUsesMouseWheel( false );
   textVoice4.SetHasCustomTextHoverColor( false );
   textVoice4.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice4.SetFont( "Verdana", 10, false, false );

   textVoice5 = new VoltageLabel( "textLabel34", "textLabel34", this, "5" );
   AddComponent( textVoice5 );
   textVoice5.SetWantsMouseNotifications( false );
   textVoice5.SetPosition( 148, 103 );
   textVoice5.SetSize( 19, 14 );
   textVoice5.SetEditable( false, false );
   textVoice5.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice5.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice5.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice5.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice5.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice5.SetBorderSize( 1 );
   textVoice5.SetMultiLineEdit( false );
   textVoice5.SetIsNumberEditor( false );
   textVoice5.SetNumberEditorRange( 0, 100 );
   textVoice5.SetNumberEditorInterval( 1 );
   textVoice5.SetNumberEditorUsesMouseWheel( false );
   textVoice5.SetHasCustomTextHoverColor( false );
   textVoice5.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice5.SetFont( "Verdana", 10, false, false );

   textVoice6 = new VoltageLabel( "textLabel40", "textLabel40", this, "6" );
   AddComponent( textVoice6 );
   textVoice6.SetWantsMouseNotifications( false );
   textVoice6.SetPosition( 164, 103 );
   textVoice6.SetSize( 19, 14 );
   textVoice6.SetEditable( false, false );
   textVoice6.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice6.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice6.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice6.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice6.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice6.SetBorderSize( 1 );
   textVoice6.SetMultiLineEdit( false );
   textVoice6.SetIsNumberEditor( false );
   textVoice6.SetNumberEditorRange( 0, 100 );
   textVoice6.SetNumberEditorInterval( 1 );
   textVoice6.SetNumberEditorUsesMouseWheel( false );
   textVoice6.SetHasCustomTextHoverColor( false );
   textVoice6.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice6.SetFont( "Verdana", 10, false, false );

   textVoice7 = new VoltageLabel( "textLabel41", "textLabel41", this, "7" );
   AddComponent( textVoice7 );
   textVoice7.SetWantsMouseNotifications( false );
   textVoice7.SetPosition( 180, 103 );
   textVoice7.SetSize( 19, 14 );
   textVoice7.SetEditable( false, false );
   textVoice7.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice7.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice7.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice7.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice7.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice7.SetBorderSize( 1 );
   textVoice7.SetMultiLineEdit( false );
   textVoice7.SetIsNumberEditor( false );
   textVoice7.SetNumberEditorRange( 0, 100 );
   textVoice7.SetNumberEditorInterval( 1 );
   textVoice7.SetNumberEditorUsesMouseWheel( false );
   textVoice7.SetHasCustomTextHoverColor( false );
   textVoice7.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice7.SetFont( "Verdana", 10, false, false );

   textVoice8 = new VoltageLabel( "textLabel42", "textLabel42", this, "8" );
   AddComponent( textVoice8 );
   textVoice8.SetWantsMouseNotifications( false );
   textVoice8.SetPosition( 196, 103 );
   textVoice8.SetSize( 19, 14 );
   textVoice8.SetEditable( false, false );
   textVoice8.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice8.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice8.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice8.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice8.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice8.SetBorderSize( 1 );
   textVoice8.SetMultiLineEdit( false );
   textVoice8.SetIsNumberEditor( false );
   textVoice8.SetNumberEditorRange( 0, 100 );
   textVoice8.SetNumberEditorInterval( 1 );
   textVoice8.SetNumberEditorUsesMouseWheel( false );
   textVoice8.SetHasCustomTextHoverColor( false );
   textVoice8.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice8.SetFont( "Verdana", 10, false, false );

   textVoice9 = new VoltageLabel( "textLabel35", "textLabel35", this, "9" );
   AddComponent( textVoice9 );
   textVoice9.SetWantsMouseNotifications( false );
   textVoice9.SetPosition( 148, 166 );
   textVoice9.SetSize( 19, 14 );
   textVoice9.SetEditable( false, false );
   textVoice9.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice9.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice9.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice9.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice9.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice9.SetBorderSize( 1 );
   textVoice9.SetMultiLineEdit( false );
   textVoice9.SetIsNumberEditor( false );
   textVoice9.SetNumberEditorRange( 0, 100 );
   textVoice9.SetNumberEditorInterval( 1 );
   textVoice9.SetNumberEditorUsesMouseWheel( false );
   textVoice9.SetHasCustomTextHoverColor( false );
   textVoice9.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice9.SetFont( "Verdana", 10, false, false );

   textVoice10 = new VoltageLabel( "textLabel43", "textLabel43", this, "10" );
   AddComponent( textVoice10 );
   textVoice10.SetWantsMouseNotifications( false );
   textVoice10.SetPosition( 164, 166 );
   textVoice10.SetSize( 19, 14 );
   textVoice10.SetEditable( false, false );
   textVoice10.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice10.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice10.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice10.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice10.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice10.SetBorderSize( 1 );
   textVoice10.SetMultiLineEdit( false );
   textVoice10.SetIsNumberEditor( false );
   textVoice10.SetNumberEditorRange( 0, 100 );
   textVoice10.SetNumberEditorInterval( 1 );
   textVoice10.SetNumberEditorUsesMouseWheel( false );
   textVoice10.SetHasCustomTextHoverColor( false );
   textVoice10.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice10.SetFont( "Verdana", 10, false, false );

   textVoice11 = new VoltageLabel( "textLabel44", "textLabel44", this, "11" );
   AddComponent( textVoice11 );
   textVoice11.SetWantsMouseNotifications( false );
   textVoice11.SetPosition( 180, 166 );
   textVoice11.SetSize( 19, 14 );
   textVoice11.SetEditable( false, false );
   textVoice11.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice11.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice11.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice11.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice11.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice11.SetBorderSize( 1 );
   textVoice11.SetMultiLineEdit( false );
   textVoice11.SetIsNumberEditor( false );
   textVoice11.SetNumberEditorRange( 0, 100 );
   textVoice11.SetNumberEditorInterval( 1 );
   textVoice11.SetNumberEditorUsesMouseWheel( false );
   textVoice11.SetHasCustomTextHoverColor( false );
   textVoice11.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice11.SetFont( "Verdana", 10, false, false );

   textVoice12 = new VoltageLabel( "textLabel45", "textLabel45", this, "12" );
   AddComponent( textVoice12 );
   textVoice12.SetWantsMouseNotifications( false );
   textVoice12.SetPosition( 196, 166 );
   textVoice12.SetSize( 19, 14 );
   textVoice12.SetEditable( false, false );
   textVoice12.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice12.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice12.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice12.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice12.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice12.SetBorderSize( 1 );
   textVoice12.SetMultiLineEdit( false );
   textVoice12.SetIsNumberEditor( false );
   textVoice12.SetNumberEditorRange( 0, 100 );
   textVoice12.SetNumberEditorInterval( 1 );
   textVoice12.SetNumberEditorUsesMouseWheel( false );
   textVoice12.SetHasCustomTextHoverColor( false );
   textVoice12.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice12.SetFont( "Verdana", 10, false, false );

   textVoice13 = new VoltageLabel( "textLabel36", "textLabel36", this, "13" );
   AddComponent( textVoice13 );
   textVoice13.SetWantsMouseNotifications( false );
   textVoice13.SetPosition( 148, 229 );
   textVoice13.SetSize( 19, 14 );
   textVoice13.SetEditable( false, false );
   textVoice13.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice13.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice13.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice13.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice13.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice13.SetBorderSize( 1 );
   textVoice13.SetMultiLineEdit( false );
   textVoice13.SetIsNumberEditor( false );
   textVoice13.SetNumberEditorRange( 0, 100 );
   textVoice13.SetNumberEditorInterval( 1 );
   textVoice13.SetNumberEditorUsesMouseWheel( false );
   textVoice13.SetHasCustomTextHoverColor( false );
   textVoice13.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice13.SetFont( "Verdana", 10, false, false );

   textVoice14 = new VoltageLabel( "textLabel46", "textLabel46", this, "14" );
   AddComponent( textVoice14 );
   textVoice14.SetWantsMouseNotifications( false );
   textVoice14.SetPosition( 164, 229 );
   textVoice14.SetSize( 19, 14 );
   textVoice14.SetEditable( false, false );
   textVoice14.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice14.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice14.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice14.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice14.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice14.SetBorderSize( 1 );
   textVoice14.SetMultiLineEdit( false );
   textVoice14.SetIsNumberEditor( false );
   textVoice14.SetNumberEditorRange( 0, 100 );
   textVoice14.SetNumberEditorInterval( 1 );
   textVoice14.SetNumberEditorUsesMouseWheel( false );
   textVoice14.SetHasCustomTextHoverColor( false );
   textVoice14.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice14.SetFont( "Verdana", 10, false, false );

   textVoice15 = new VoltageLabel( "textLabel47", "textLabel47", this, "15" );
   AddComponent( textVoice15 );
   textVoice15.SetWantsMouseNotifications( false );
   textVoice15.SetPosition( 180, 229 );
   textVoice15.SetSize( 19, 14 );
   textVoice15.SetEditable( false, false );
   textVoice15.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice15.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice15.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice15.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice15.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice15.SetBorderSize( 1 );
   textVoice15.SetMultiLineEdit( false );
   textVoice15.SetIsNumberEditor( false );
   textVoice15.SetNumberEditorRange( 0, 100 );
   textVoice15.SetNumberEditorInterval( 1 );
   textVoice15.SetNumberEditorUsesMouseWheel( false );
   textVoice15.SetHasCustomTextHoverColor( false );
   textVoice15.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice15.SetFont( "Verdana", 10, false, false );

   textVoice16 = new VoltageLabel( "textLabel48", "textLabel48", this, "16" );
   AddComponent( textVoice16 );
   textVoice16.SetWantsMouseNotifications( false );
   textVoice16.SetPosition( 196, 229 );
   textVoice16.SetSize( 19, 14 );
   textVoice16.SetEditable( false, false );
   textVoice16.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice16.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice16.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice16.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice16.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice16.SetBorderSize( 1 );
   textVoice16.SetMultiLineEdit( false );
   textVoice16.SetIsNumberEditor( false );
   textVoice16.SetNumberEditorRange( 0, 100 );
   textVoice16.SetNumberEditorInterval( 1 );
   textVoice16.SetNumberEditorUsesMouseWheel( false );
   textVoice16.SetHasCustomTextHoverColor( false );
   textVoice16.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice16.SetFont( "Verdana", 10, false, false );

   textVoice3 = new VoltageLabel( "textLabel38", "textLabel38", this, "3" );
   AddComponent( textVoice3 );
   textVoice3.SetWantsMouseNotifications( false );
   textVoice3.SetPosition( 180, 40 );
   textVoice3.SetSize( 19, 14 );
   textVoice3.SetEditable( false, false );
   textVoice3.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice3.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice3.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice3.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice3.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice3.SetBorderSize( 1 );
   textVoice3.SetMultiLineEdit( false );
   textVoice3.SetIsNumberEditor( false );
   textVoice3.SetNumberEditorRange( 0, 100 );
   textVoice3.SetNumberEditorInterval( 1 );
   textVoice3.SetNumberEditorUsesMouseWheel( false );
   textVoice3.SetHasCustomTextHoverColor( false );
   textVoice3.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice3.SetFont( "Verdana", 10, false, false );

   textVoice1 = new VoltageLabel( "textLabel33", "textLabel33", this, "1" );
   AddComponent( textVoice1 );
   textVoice1.SetWantsMouseNotifications( false );
   textVoice1.SetPosition( 148, 40 );
   textVoice1.SetSize( 19, 14 );
   textVoice1.SetEditable( false, false );
   textVoice1.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textVoice1.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textVoice1.SetColor( new Color( 255, 255, 255, 255 ) );
   textVoice1.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textVoice1.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textVoice1.SetBorderSize( 1 );
   textVoice1.SetMultiLineEdit( false );
   textVoice1.SetIsNumberEditor( false );
   textVoice1.SetNumberEditorRange( 0, 100 );
   textVoice1.SetNumberEditorInterval( 1 );
   textVoice1.SetNumberEditorUsesMouseWheel( false );
   textVoice1.SetHasCustomTextHoverColor( false );
   textVoice1.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textVoice1.SetFont( "Verdana", 10, false, false );

   switchMonitor = new VoltageSwitch( "Monitor Display", "Monitor Display", this, 0 );
   AddComponent( switchMonitor );
   switchMonitor.SetWantsMouseNotifications( false );
   switchMonitor.SetPosition( 151, 301 );
   switchMonitor.SetSize( 15, 27 );
   switchMonitor.SetSkin( "2-State Slide Vertical" );

   buttonReset = new VoltageButton( "Reset All Outputs", "Reset All Outputs", this );
   AddComponent( buttonReset );
   buttonReset.SetWantsMouseNotifications( false );
   buttonReset.SetPosition( 121, 238 );
   buttonReset.SetSize( 15, 15 );
   buttonReset.SetSkin( "Square Concave Blue-Blue" );
   buttonReset.ShowOverlay( false );
   buttonReset.SetOverlayText( "" );
   buttonReset.SetAutoRepeat( false );

   textLabel33 = new VoltageLabel( "textLabel51", "textLabel51", this, "Reset All Voices" );
   AddComponent( textLabel33 );
   textLabel33.SetWantsMouseNotifications( false );
   textLabel33.SetPosition( 79, 231 );
   textLabel33.SetSize( 43, 28 );
   textLabel33.SetEditable( false, false );
   textLabel33.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel33.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel33.SetColor( new Color( 255, 255, 255, 255 ) );
   textLabel33.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel33.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel33.SetBorderSize( 1 );
   textLabel33.SetMultiLineEdit( true );
   textLabel33.SetIsNumberEditor( false );
   textLabel33.SetNumberEditorRange( 0, 100 );
   textLabel33.SetNumberEditorInterval( 1 );
   textLabel33.SetNumberEditorUsesMouseWheel( false );
   textLabel33.SetHasCustomTextHoverColor( false );
   textLabel33.SetTextHoverColor( new Color( 0, 0, 0, 255 ) );
   textLabel33.SetFont( "Verdana", 10, false, false );
}



//-------------------------------------------------------------------------------
//  public void Initialize()

//  Initialize will get called shortly after your module's constructor runs. You can use it to
//  do any initialization that the auto-generated code doesn't handle.
//-------------------------------------------------------------------------------
@Override
public void Initialize()
{
   //[user-Initialize]   Add your own initialization code here
   SetPolyphony(GetNumberOfPolyVoices());
   
   ResetAllChannels();
   CheckConnections();
   
   ReadControllerSourceSwitch(controllerSourceSwitch.GetValue());
   ReadKeyModeSwitch(keyModeSwitch.GetValue());
   ReadAttackModeSwitch(attackModeSwitch.GetValue());
   ReadReleaseModeSwitch(releaseModeSwitch.GetValue());
   
   ReadDisplayModeSwitch(switchMonitor.GetValue());
   DisplayVoiceChannels();
   
   ReadLevelKnob(controllerLevelKnob.GetValue());
   ReadAttackKnob(knobAttack.GetValue());
   ReadReleaseKnob(knobRelease.GetValue());
   
   StartGuiUpdateTimer();    

   //[/user-Initialize]
}


//-------------------------------------------------------------------------------
//  public void Destroy()

//  Destroy will get called just before your module gets deleted. You can use it to perform any
//  cleanup that's not handled automatically by Java.
//-------------------------------------------------------------------------------
@Override
public void Destroy()
{
   super.Destroy();
   //[user-Destroy]   Add your own module-getting-deleted code here



   //[/user-Destroy]
}


//-------------------------------------------------------------------------------
//  public boolean Notify( VoltageComponent component, ModuleNotifications notification, double doubleValue, long longValue, int x, int y, Object object )

//  Notify will get called when various events occur - control values changing, timers firing, etc.
//-------------------------------------------------------------------------------
@Override
public boolean Notify( VoltageComponent component, ModuleNotifications notification, double doubleValue, long longValue, int x, int y, Object object )
{
   //[user-Notify]   Add your own notification handling code between this line and the notify-close comment
   switch( notification )
   {
      case Knob_Changed:   // doubleValue is the new VoltageKnob value
      {
         if (component == controllerLevelKnob)
         {
            ReadLevelKnob (doubleValue);
         }
         else if (component == knobAttack)
         {
            ReadAttackKnob (doubleValue);
         }
         else if (component == knobRelease)
         {
            ReadReleaseKnob (doubleValue);
         }
      }
      break;
   
      case Slider_Changed:   // doubleValue is the new slider value
      {
      }
      break;
   
      case Button_Changed:   // doubleValue is the new button/toggle button value
      {
         if (component == buttonReset)
         {
            if (doubleValue > 0.5)
            {
               // Perform hard reset on all current and target values.
               ResetAllChannels();
            }
         }
      }
      break;
   
      case Switch_Changed:   // doubleValue is the new switch value
      {
         if (component == controllerSourceSwitch)
         {
            ReadControllerSourceSwitch(doubleValue);
         }
         else if (component == keyModeSwitch)
         {
            ReadKeyModeSwitch(doubleValue);
         }
         else if (component == attackModeSwitch)
         {
            ReadAttackModeSwitch(doubleValue);
         }
         else if (component == releaseModeSwitch)
         {
            ReadReleaseModeSwitch(doubleValue);
         }
         else if (component == switchMonitor)
         {
            ReadDisplayModeSwitch(doubleValue);
            DisplayVoiceChannels();        
         }
      }
      break;
   
      case Jack_Connected:   // longValue is the new cable ID
      {
         CheckConnections();
      }
      break;
   
      case Jack_Disconnected:   // All cables have been disconnected from this jack
      {
         CheckConnections();
      }
      break;
   
      case GUI_Update_Timer:   // Called every 50ms (by default) if turned on
      {
         DisplayControllerValue();
         UpdateGateLEDs();
         UpdateChannelMeters();
      }
      break;
   
      case Object_MouseMove:   // called when mouse is over an object that receives mouse notifications. 'object' parameter is a VoltageMouseKeyFlags object.
      {
      }
      break;
   
      case Object_MouseLeave:  // called when mouse leaves an object that receives mouse notifications. 'object' parameter is a VoltageMouseKeyFlags object.
      {
      }
      break;
   
      case Object_LeftButtonDown:   // called when user left-clicks on an object that receives mouse notifications. 'object' parameter is a VoltageMouseKeyFlags object.
      {
      }
      break;
   
      case Object_LeftButtonUp:   // called when user releases left mouse button on an object that receives mouse notifications. 'object' parameter is a VoltageMouseKeyFlags object.
      {
      }
      break;
   
      case Object_RightButtonDown:   // called when user releases right mouse button on an object that receives mouse notifications. 'object' parameter is a VoltageMouseKeyFlags object.
      {
      }
      break;
   
      case Object_RightButtonUp:   // called when user right-clicks on an object that receives mouse notifications
      {
      }
      break;
   
      case Object_LeftButtonDoubleClick: // called when user left-button double-clicks on an object that receives mouse notifications
      {
      }
      break;
   
      // Less common notifications:
   
      case Named_Timer:   // object contains a String with the name of the timer that has fired
      {
      }
      break;
   
      case Canvas_Painting:   // About to paint canvas.  object is a java.awt.Rectangle with painting boundaries
      {
      }
      break;
   
      case Canvas_Painted:   // Canvas painting is complete
      {
      }
      break;
   
      case Control_DragStart:    // A user has started dragging on a control that has been marked as draggable
      {
      }
      break;
   
      case Control_DragOn:       // This control has been dragged over during a drag operation. object contains the dragged object
      {
      }
      break;
   
      case Control_DragOff:      // This control has been dragged over during a drag operation. object contains the dragged object
      {
      }
      break;
   
      case Control_DragEnd:      // A user has ended their drag on a control that has been marked as draggable
      {
      }
      break;
   
      case Label_Changed:        // The text of an editable text control has changed
      {
      }
      break;
   
      case SoundPlayback_Start:   // A sound has begun playback
      {
      }
      break;
   
      case SoundPlayback_End:     // A sound has ended playback
      {
      }
      break;
   
      case Scrollbar_Position:    // longValue is the new scrollbar position
      {
      }
      break;
   
      case PolyVoices_Changed:    // longValue is the new number of poly voices
      {
         SetPolyphony((int)longValue);
         ResetAllChannels();
         DisplayVoiceChannels();        
      }
      break;
   
      case File_Dropped:     // 'object' is a String containing the file path
      {
      }
      break;
   
      case Preset_Loading_Start:   // called when preset loading begins
      {
      }
      break;
   
      case Preset_Loading_Finish:  // called when preset loading finishes
      {
      }
      break;
   
      case Variation_Loading_Start:    // sent when a variation is about to load
      {
      }
      break;
   
      case Variation_Loading_Finish:   // sent when a variation has just finished loading
      {
      }
      break;
   
      case Tempo_Changed:     // doubleValue is the new tempo
      {
      }
      break;
   
      case Randomized:     // called when the module's controls get randomized
      {
      }
      break;
   
      case VariationListChanged:   // sent when a variation gets added, deleted, or renamed, or the variations list gets reordered
      {
      }
      break;
   
      case Key_Press:     // sent when module has keyboard focus and a key is pressed; object is a VoltageKeyPressInfo object
      {
      }
      break;
   
      case Reset:    // sent when the module has been reset to default settings
      {
      }
      break;
   
      case Keyboard_NoteOn:   // sent when a note has been pressed on a VoltageKeyboard object. longValue is the note value ( 0-127 )
      {
      }
      break;
   
      case Keyboard_NoteOff:   // sent when a note has been released on a VoltageKeyboard object. longValue is the note value ( 0-127 )
      {
      }
      break;
   
      case Curve_Changed:   // sent when user has edited a curve's value. 'object' will be a VoltageCurve.CurveChangeNotification object.
      {
      }
      break;
   }



   return false;
   //[/user-Notify]
}


//-------------------------------------------------------------------------------
//  public void ProcessSample()

//  ProcessSample is called once per sample. Usually it's where you read
//  from input jacks, process audio, and write it to your output jacks.
//  Since ProcesssSample gets called 48,000 times per second, offload CPU-intensive operations
//  to other threads when possible and avoid calling native functions.
//-------------------------------------------------------------------------------
@Override
public void ProcessSample()
{
   //[user-ProcessSample]   Add your own process-sampling code here
 
   int v;   // Voice loop counter
   double outputValue;
   float diff;
   float temp;
   
   // Read value of current controller input
   
   switch (currentController)
   {
      case AFTERTOUCH:
      {
         currentControllerInputValue = (float)(GetIOPanelValue(VoltageModule.IOPanelValues.IOPanel_Aftertouch));
      }
      break;
      
      case MOD_WHEEL:
      {
         currentControllerInputValue = (float)(GetIOPanelValue(VoltageModule.IOPanelValues.IOPanel_ModWheel));
      }
      break;
      
      case PITCH_BEND:
      {
         currentControllerInputValue = (float)(GetIOPanelValue(VoltageModule.IOPanelValues.IOPanel_Bend));
      }
      break;
      
      case EXTERNAL:
      {
         if (externalCVInConnected)
         {
            currentControllerInputValue = (float)(externalControllerInputJack.GetValue());
         }
         else
         {
            currentControllerInputValue = 0.0f;
         }
      }
      break;
            
   }
   
   // Display raw controller value before attenuation.
   currentControllerDisplayValue = currentControllerInputValue;
   
   // Attenuate controller value by Level knob setting.
   currentControllerInputValue *= currentLevelMultiplier;
   
   // Any notes held?  
   polyNotesOnCurrent = false;
   
   if (polyGateInConnected)
   {
      for (v=0; v<currentPolyphony; v++)
      {
         if (polyGateInputJack.GetPolyValue(v) > GATE_THRESHOLD)
         {
            channelGate[v] = true;
            polyNotesOnCurrent = true;
         }
         else
         {
            channelGate[v] = false;
         }
      }
   }
   else
   {
      for (v=0; v<currentPolyphony; v++)
      {
         if (GetIOPanelPolyValue(IOPanelPolyValues.IOPanel_PolyGate, v) > GATE_THRESHOLD)
         {
            channelGate[v] = true;
            polyNotesOnCurrent = true;
         }
         else
         {
            channelGate[v] = false;
         }
      }
   }
   
   // Identify 'First' key voice channel   
   if ((polyNotesOnCurrent) && (!polyNotesOnPrevious))
   {
      // A new 'first' key has been pressed. Identify which voice channel it belongs to.
      for (v=0; v<currentPolyphony; v++)
      {
         if (channelGate[v])
         {
            firstKeyChannel = v;
            break;
         }
      }      
   }
   
   polyNotesOnPrevious = polyNotesOnCurrent;
   
   // If any notes pressed, read pitch values
   if (polyNotesOnCurrent)
   {
      if (polyPitchInConnected)
      {
         for (v=0; v<currentPolyphony; v++)
         {
            channelPitch[v] = (float)polyPitchInputJack.GetPolyValue(v);
         }
      }
      else
      {
         for (v=0; v<currentPolyphony; v++)
         {
            channelPitch[v] = (float)GetIOPanelPolyValue(IOPanelPolyValues.IOPanel_PolyPitch, v);
         }
      }
      
   }
   
   // Detect new key-on activity and apply Attack Mode setting
   // to that voice channel.
   for (v=0; v<currentPolyphony; v++)
   {
      // Key-on transition detected since last iteration
      if (!channelGatePrevious[v] && channelGate[v])            
      {
         // First, check if we are in Last Note Key Mode
         if (currentKeyMode == KeyMode.LAST)
         {
            if (lastKeyChannel != v)
            {
               // Apply 'Note Off' processing on previous Last Note channel
               switch (currentReleaseMode)
               {
                  case ZERO:
                  {
                     // Return to zero during release phase.
                     channelValueTarget[lastKeyChannel] = 0.0f;
                  }
                  break;
               
                  case HOLD:
                  case PEAK:
                  {
                     // Hold the current value during release.
                     channelValueTarget[lastKeyChannel] = channelValueCurrent[lastKeyChannel];
                  }
                  break;
                  
               }
               
               // Finally, set the new key as lastKeyChannel before applying Attack.
               lastKeyChannel = v;
            }
         }
         
         if (((currentKeyMode == KeyMode.FIRST) && (v == firstKeyChannel)) ||
             ((currentKeyMode == KeyMode.LAST) && (v == lastKeyChannel)) ||
             (currentKeyMode == KeyMode.HELD))
         {                     
            // Apply Attack mode for this voice channel
            switch (currentAttackMode)
            {
               case ZERO:
               {
                  // Start new note's attack phase from zero.
                  channelValueCurrent[v] = 0.0f;
               }
               break;
               
               case CURRENT:
               {
                  // Start new note's attack phase from current controller value
                  channelValueCurrent[v] = currentControllerInputValue;
               }
               break;
               
               default: // VOICE:
               {
                  // Pick up attack phase from previous release phase of voice channel
               }
               break;
            }
         }
      }
   }
   
   // Detect new key-off activity and apply Release Mode setting
   // to that voice channel.
   for (v=0; v<currentPolyphony; v++)
   {
      // Key-off transition detected since last iteration
      if (channelGatePrevious[v] && !channelGate[v])
      {
         if (((currentKeyMode == KeyMode.FIRST) && (v == firstKeyChannel)) ||
             ((currentKeyMode == KeyMode.LAST) && (v == lastKeyChannel)) ||
             (currentKeyMode == KeyMode.HELD))
         {
            // Apply Release mode for this voice channel
            switch (currentReleaseMode)
            {
               case ZERO:
               {
                  // Return to zero during release phase.
                  channelValueTarget[v] = 0.0f;
               }
               break;
               
               case HOLD:
               case PEAK:
               {
                  // Hold the current value during release.
                  channelValueTarget[v] = channelValueCurrent[v];
               }
               break;
            }
         }
      }
   }
   
   // Now that all key transitions have been processed, keep a
   // record of current gate states to compare at next iteration.
   for (v=0; v<currentPolyphony; v++)
   {
      channelGatePrevious[v] = channelGate[v];
   }
   
   // Apply controller value to target value for held keys.
   // Base the target value assignments on current key mode.      
   for (v=0; v<currentPolyphony; v++)
   {
      // Key-off transition detected since last iteration
      if (channelGate[v])
      {
         if (((currentKeyMode == KeyMode.FIRST) && (v == firstKeyChannel)) ||
             ((currentKeyMode == KeyMode.LAST) && (v == lastKeyChannel)) ||
             (currentKeyMode == KeyMode.HELD))
         {
            // Apply new target value for this channel
            channelValueTarget[v] = currentControllerInputValue;
         }
      }
   }
   
   // Apply Attack / Release slewing to all voices.
   
   for (v=0; v<currentPolyphony; v++)
   {
      diff = channelValueTarget[v] - channelValueCurrent[v];
      
      // Check if target value is above (ATTACK) or below (RELEASE) current value.
      if (diff > 0.0f)
      {
         // ATTACK PHASE
         channelValueCurrent[v] = channelValueTarget[v] - (diff * attackTimeFactor);
      }
      else if (diff < 0.0f)
      {
         // RELEASE PHASE
         // If release mode is PEAK, then do not perform release calculation.
         if (currentReleaseMode != ReleaseMode.PEAK)
         {
            channelValueCurrent[v] = channelValueTarget[v] - (diff * releaseTimeFactor);
         }
      }
      
   }
   
   // Send output values to appropriate sockets dependent on whether they
   // are connected.
   if (controlOnlyOutConnected)
   {
      for (v=0; v<currentPolyphony; v++)
      {
         polyOutputJackControlOnly.SetPolyValue (v, channelValueCurrent[v]);
      }
   }
   
   if (controlPlusPitchOutConnected)
   {
      for (v=0; v<currentPolyphony; v++)
      {
         polyOutputJackPlusPitch.SetPolyValue (v, channelPitch[v] + channelValueCurrent[v]);
      }
   }   
   
   if (VCAOutConnected)
   {
      // If Mono VCA In is connected, set all channels to that value or set to zero otherwise
      if (monoVCAInConnected)
      {
         float monoIn = (float)inputJackVCAMono.GetValue();
         
         for (v=0; v<currentPolyphony; v++)
         {
            channelVCAOutput[v] = monoIn;
         }
      }
      else
      {
         for (v=0; v<currentPolyphony; v++)
         {
            channelVCAOutput[v] = 0.0f;
         }
      }
   
      // Add Poly In values to individual channels
      if (polyVCAInConnected)
      {
         for (v=0; v<currentPolyphony; v++)
         {
            channelVCAOutput[v] += (float)polyInputVCAJack.GetPolyValue(v);
         }
      }
      
      // Attenuate VCA inputs by channel outputs.
      for (v=0; v<currentPolyphony; v++)
      {
         polyOutputJackVCA.SetPolyValue (v, channelVCAOutput[v] * channelValueCurrent[v]);
      }
   }   
   
   
   //[/user-ProcessSample]
}


//-------------------------------------------------------------------------------
//  public void ProcessBypassedSample()

//  ProcessBypassedSample gets called instead of ProcessSample when you've checked the "Can Be Bypassed" box
//  and a user has bypassed your module. If your module processes data from input jacks and then sends it to
//  output jack(s), make ProcessBypassedSample just send the data from the input jacks to the output jacks without
//  processing it.
//-------------------------------------------------------------------------------
@Override
public void ProcessBypassedSample()
{
   //[user-ProcessBypassedSample]   Add your own code here

   int v;   // Voice loop counter

   if (polyPitchInConnected)
   {
      for (v=0; v<currentPolyphony; v++)
      {
         channelPitch[v] = (float)polyPitchInputJack.GetPolyValue(v);
      }
   }
   else
   {
      for (v=0; v<currentPolyphony; v++)
      {
         channelPitch[v] = (float)GetIOPanelPolyValue(IOPanelPolyValues.IOPanel_PolyPitch, v);
      }
   }

   for (v=0; v<currentPolyphony; v++)
   {
      polyOutputJackControlOnly.SetPolyValue (v, 0);
      polyOutputJackPlusPitch.SetPolyValue (v, channelPitch[v]);
      polyOutputJackVCA.SetPolyValue (v, 0);
   }

   //[/user-ProcessBypassedSample]
}


//-------------------------------------------------------------------------------
//  public String GetTooltipText( VoltageComponent component )

//  Gets called when a tooltip is about to display for a control. Override it if
//  you want to change what the tooltip displays - if you want a knob to work in logarithmic fashion,
//  for instance, you can translate the knob's current value to a log-based string and display it here.
//-------------------------------------------------------------------------------
@Override
public String GetTooltipText( VoltageComponent component )
{
   //[user-GetTooltipText]   Add your own code here

   if (component == controllerLevelKnob)
   {
      return levelKnobTooltip;
   }

   if (component == knobAttack)
   {
      return attackKnobTooltip;
   }

   if (component == knobRelease)
   {
      return releaseKnobTooltip;
   }

   return super.GetTooltipText( component );
   //[/user-GetTooltipText]
}


//-------------------------------------------------------------------------------
//  public void EditComponentValue( VoltageComponent component, double newValue, String newText )

//  Gets called after a user clicks on a tooltip and types in a new value for a control. Override this if
//  you've changed the default tooltip display (translating a linear value to logarithmic, for instance)
//  in GetTooltipText().
//-------------------------------------------------------------------------------
@Override
public void EditComponentValue( VoltageComponent component, double newValue, String newText )
{
   //[user-EditComponentValue]   Add your own code here



   //[/user-EditComponentValue]
   super.EditComponentValue( component, newValue, newText );
}


//-------------------------------------------------------------------------------
//  public void OnUndoRedo( String undoType, double newValue, Object optionalObject )

//  If you've created custom undo events via calls to CreateUndoEvent, you'll need to
//  process them in this function when they get triggered by undo/redo actions.
//-------------------------------------------------------------------------------
@Override
public void OnUndoRedo( String undoType, double newValue, Object optionalObject )
{
   //[user-OnUndoRedo]   Add your own code here



   //[/user-OnUndoRedo]
}


//-------------------------------------------------------------------------------
//  public byte[] GetStateInformation()

//  Gets called when the module's state gets saved, typically when the user saves a preset with
//  this module in it. Voltage Modular will automatically save the states of knobs, sliders, etc.,
//  but if you have any custom state information you need to save, return it from this function.
//-------------------------------------------------------------------------------
@Override
public byte[] GetStateInformation()
{
   //[user-GetStateInformation]   Add your own code here



   return null;
   //[/user-GetStateInformation]
}


//-------------------------------------------------------------------------------
//  public void SetStateInformation(byte[] stateInfo)

//  Gets called when this module's state is getting restored, typically when a user opens a preset with
//  this module in it. The stateInfo parameter will contain whatever custom data you stored in GetStateInformation().
//-------------------------------------------------------------------------------
@Override
public void SetStateInformation(byte[] stateInfo)
{
   //[user-SetStateInformation]   Add your own code here



   //[/user-SetStateInformation]
}


//-------------------------------------------------------------------------------
//  public byte[] GetStateInformationForVariations()

//  Gets called when a user saves a variation with this module in it.
//  Voltage Modular will automatically save the states of knobs, sliders, etc.,
//  but if you have any custom state information you need to save, return it from this function.
//-------------------------------------------------------------------------------
@Override
public byte[] GetStateInformationForVariations()
{
   //[user-GetStateInformationForVariations]   Add your own code here



   return GetStateInformation();
   //[/user-GetStateInformationForVariations]
}


//-------------------------------------------------------------------------------
//  public void SetStateInformationForVariations(byte[] stateInfo)

//  Gets called when a user loads a variation with this module in it.
//  The stateInfo parameter will contain whatever custom data you stored in GetStateInformationForVariations().
//-------------------------------------------------------------------------------
@Override
public void SetStateInformationForVariations(byte[] stateInfo)
{
   //[user-SetStateInformationForVariations]   Add your own code here
   SetStateInformation(stateInfo);



   //[/user-SetStateInformationForVariations]
}


// Auto-generated variables
private VoltageLabel textLabel33;
private VoltageButton buttonReset;
private VoltageSwitch switchMonitor;
private VoltageLabel textVoice1;
private VoltageLabel textVoice3;
private VoltageLabel textVoice16;
private VoltageLabel textVoice15;
private VoltageLabel textVoice14;
private VoltageLabel textVoice13;
private VoltageLabel textVoice12;
private VoltageLabel textVoice11;
private VoltageLabel textVoice10;
private VoltageLabel textVoice9;
private VoltageLabel textVoice8;
private VoltageLabel textVoice7;
private VoltageLabel textVoice6;
private VoltageLabel textVoice5;
private VoltageLabel textVoice4;
private VoltageLabel textVoice2;
private VoltageLED LEDgate3;
private VoltageLED LEDgate1;
private VoltageLED LEDgate16;
private VoltageLED LEDgate15;
private VoltageLED LEDgate14;
private VoltageLED LEDgate13;
private VoltageLED LEDgate12;
private VoltageLED LEDgate11;
private VoltageLED LEDgate10;
private VoltageLED LEDgate9;
private VoltageLED LEDgate8;
private VoltageLED LEDgate7;
private VoltageLED LEDgate6;
private VoltageLED LEDgate5;
private VoltageLED LEDgate4;
private VoltageLED LEDgate2;
private VoltageLabel textLabel11;
private VoltageVUMeter meterOutput2;
private VoltageVUMeter meterOutput1;
private VoltageVUMeter meterOutput16;
private VoltageVUMeter meterOutput15;
private VoltageVUMeter meterOutput14;
private VoltageVUMeter meterOutput13;
private VoltageVUMeter meterOutput12;
private VoltageVUMeter meterOutput11;
private VoltageVUMeter meterOutput10;
private VoltageVUMeter meterOutput9;
private VoltageVUMeter meterOutput8;
private VoltageVUMeter meterOutput7;
private VoltageVUMeter meterOutput6;
private VoltageVUMeter meterOutput5;
private VoltageVUMeter meterOutput4;
private VoltageVUMeter meterOutput3;
private VoltageLabel textLabel32;
private VoltageLED LEDgate;
private VoltageLED LEDnegative;
private VoltageLED LEDpositive;
private VoltageVUMeter meterControllerVoltage;
private VoltagePolyJack polyInputVCAJack;
private VoltageLabel textLabel29;
private VoltageLabel textLabel27;
private VoltageAudioJack inputJackVCAMono;
private VoltageLabel textLabel26;
private VoltagePolyJack polyOutputJackVCA;
private VoltagePolyJack polyOutputJackPlusPitch;
private VoltagePolyJack polyOutputJackControlOnly;
private VoltageLabel textLabel25;
private VoltageLabel textLabel24;
private VoltageLabel textLabel31;
private VoltageLabel textLabel30;
private VoltageLabel textLabel28;
private VoltageLabel textLabel23;
private VoltageLabel textLabel22;
private VoltageKnob controllerLevelKnob;
private VoltageLabel textLabel21;
private VoltageLabel textLabel20;
private VoltageLabel textLabel19;
private VoltageSwitch keyModeSwitch;
private VoltageLabel textLabel18;
private VoltageLabel textLabel17;
private VoltageSwitch releaseModeSwitch;
private VoltageLabel textLabel16;
private VoltageLabel textLabel50;
private VoltageLabel textLabel49;
private VoltageLabel textLabel15;
private VoltageLabel textLabel14;
private VoltageSwitch attackModeSwitch;
private VoltageKnob knobRelease;
private VoltageLabel textLabel13;
private VoltageLabel textLabel12;
private VoltageKnob knobAttack;
private VoltageLabel textLabel10;
private VoltageLabel textLabel9;
private VoltageLabel textLabel8;
private VoltageLabel textLabel7;
private VoltagePolyJack polyPitchInputJack;
private VoltageLabel textLabel6;
private VoltagePolyJack polyGateInputJack;
private VoltageLabel textLabel5;
private VoltageLabel textLabel4;
private VoltageLabel textLabel3;
private VoltageLabel textLabel2;
private VoltageLabel textLabel1;
private VoltageSwitch controllerSourceSwitch;
private VoltageAudioJack externalControllerInputJack;


//[user-code-and-variables]    Add your own variables and functions here


// Types

private enum ControllerSource
{
   AFTERTOUCH,
   MOD_WHEEL,
   PITCH_BEND,
   EXTERNAL
}

private enum KeyMode
{
   FIRST,
   HELD,
   LAST
}

private enum AttackMode
{
   ZERO,
   CURRENT,
   VOICE
}

private enum ReleaseMode
{
   ZERO,
   HOLD,
   PEAK
}

private enum DisplayMode
{
   KEY_AND_OUTPUT,
   KEY_ONLY
}

// Constants

private final int MAX_POLY_VOICES = GetMaxNumberOfPolyVoices();

private final float SEMITONES_PER_OCTAVE = 12.0f;
private final float VOLTS_PER_SEMITONE = 1.0f / SEMITONES_PER_OCTAVE;
private final float FIVE_VOLTS_TO_100_PERCENT = 0.2f;

private final float LEVEL_KNOB_PERCENTAGE = 100.0f / 60.0f;
private final float LEVEL_KNOB_MULTIPLIER = 1.0f / 60.0f;

private final double TIME_BASE_MULTIPLIER = -5000.0 / Values.SampleRate;

private final float POSITIVE_LED_THRESHOLD = 0.04f;
private final float NEGATIVE_LED_THRESHOLD = -POSITIVE_LED_THRESHOLD;

private final double GATE_THRESHOLD = 2.5;
// Objects



// Variables

private ControllerSource currentController;
private KeyMode currentKeyMode;
private AttackMode currentAttackMode;
private ReleaseMode currentReleaseMode;
private DisplayMode currentDisplayMode;

private int currentPolyphony;
private int firstKeyChannel;
private int lastKeyChannel;

private float currentControllerInputValue;
private float currentControllerDisplayValue;
private float currentLevelMultiplier;

private float attackTimeFactor;
private float releaseTimeFactor;

private boolean polyNotesOnCurrent;
private boolean polyNotesOnPrevious;

private boolean[] channelGate =          new boolean[MAX_POLY_VOICES];
private boolean[] channelGatePrevious =  new boolean[MAX_POLY_VOICES];
private float[]   channelPitch        =  new float[MAX_POLY_VOICES];
private float[]   channelValueCurrent =  new float[MAX_POLY_VOICES];
private float[]   channelValueTarget  =  new float[MAX_POLY_VOICES];
private float[]   channelVCAOutput    =  new float[MAX_POLY_VOICES];

// Input connected flags

private boolean polyPitchInConnected;  
private boolean polyGateInConnected;  

private boolean externalCVInConnected;

private boolean polyVCAInConnected;
private boolean monoVCAInConnected;

// Output connected flags

private boolean VCAOutConnected;
private boolean controlPlusPitchOutConnected;
private boolean controlOnlyOutConnected;

// Tooltip strings

private String levelKnobTooltip;
private String attackKnobTooltip;
private String releaseKnobTooltip;


void ReadControllerSourceSwitch(double controller)
{
   if (controller > 2.5)
   {
      currentController = ControllerSource.AFTERTOUCH;
   }
   else if (controller > 1.5)
   {
      currentController = ControllerSource.MOD_WHEEL;
   }
   else if (controller > 0.5)
   {
      currentController = ControllerSource.PITCH_BEND;
   }
   else
   {
      currentController = ControllerSource.EXTERNAL;
   }   
   
}

void ReadKeyModeSwitch(double keyMode)
{
   if (keyMode > 1.5)
   {
      currentKeyMode = KeyMode.LAST;
   }
   else if (keyMode > 0.5)
   {
      currentKeyMode = KeyMode.HELD;
   }
   else
   {
      currentKeyMode = KeyMode.FIRST;
   }   
   
}

void ReadAttackModeSwitch(double attackMode)
{
   if (attackMode > 1.5)
   {
      currentAttackMode = AttackMode.VOICE;
   }
   else if (attackMode > 0.5)
   {
      currentAttackMode = AttackMode.CURRENT;
   }
   else
   {
      currentAttackMode = AttackMode.ZERO;
   }   
   
}

void ReadReleaseModeSwitch(double releaseMode)
{
   if (releaseMode > 1.5)
   {
      currentReleaseMode = ReleaseMode.PEAK;
   }
   else if (releaseMode > 0.5)
   {
      currentReleaseMode = ReleaseMode.HOLD;
   }
   else
   {
      currentReleaseMode = ReleaseMode.ZERO;
      // Release all Hold and Peak values when
      // switching to Zero mode.
      ResetTargetValuesOnly();
   }   
   
}

void ReadDisplayModeSwitch(double displayMode)
{
   if (displayMode > 0.5)
   {
      currentDisplayMode = DisplayMode.KEY_ONLY;
   }
   else
   {
      currentDisplayMode = DisplayMode.KEY_AND_OUTPUT;
   }   
   
}

void CheckConnections()
{
   polyPitchInConnected  = polyPitchInputJack.IsConnected();
   polyGateInConnected   = polyGateInputJack.IsConnected();
   externalCVInConnected = externalControllerInputJack.IsConnected();
   polyVCAInConnected    = polyInputVCAJack.IsConnected();
   monoVCAInConnected    = inputJackVCAMono.IsConnected();
   
   VCAOutConnected               = polyOutputJackVCA.IsConnected();
   controlPlusPitchOutConnected  = polyOutputJackPlusPitch.IsConnected();
   controlOnlyOutConnected       = polyOutputJackControlOnly.IsConnected();

}

void ReadLevelKnob(double level)
{
   float levelPercentage;
   float levelSemitones;
   
   levelSemitones = (float)level;
   currentLevelMultiplier = levelSemitones * LEVEL_KNOB_MULTIPLIER;
   levelPercentage = levelSemitones * LEVEL_KNOB_PERCENTAGE;
   
   levelKnobTooltip = String.format("%.1f", levelSemitones) + " Semitones (" + String.format("%.1f", levelPercentage) + "%)";
}

void ReadAttackKnob(double attack)
{
   double temp;
   
   attackKnobTooltip = String.format("%.1f", attack) + " ms";
   
   temp = TIME_BASE_MULTIPLIER / attack;   
   attackTimeFactor = (float)(exp(temp));
}

void ReadReleaseKnob(double release)
{
   double temp;
   
   releaseKnobTooltip = String.format("%.1f", release) + " ms";
   
   temp = TIME_BASE_MULTIPLIER / release;   
   releaseTimeFactor = (float)(exp(temp));   
}

void SetPolyphony(int polyphony)
{
   currentPolyphony = polyphony;
}

void ResetAllChannels()
{
   for (int v=0; v < MAX_POLY_VOICES; v++)
   {
      channelGate[v] = false;
      channelGatePrevious[v] = false;
      channelValueCurrent[v] = 0.0f;
      channelValueTarget[v] = 0.0f;
      channelVCAOutput[v] = 0.0f;
   }
}

void ResetTargetValuesOnly()
{
   for (int v=0; v < MAX_POLY_VOICES; v++)
   {
      channelValueTarget[v] = 0.0f;
   }
}

void DisplayVoiceChannels()
{
   boolean showOutputs = (currentDisplayMode == DisplayMode.KEY_AND_OUTPUT);
      
   // Voice 1
   if (currentPolyphony >= 1)
   {
      textVoice1.SetVisible(true);
      LEDgate1.SetVisible(true);
      meterOutput1.SetVisible(showOutputs);
   }
   else
   {
      textVoice1.SetVisible(false);
      LEDgate1.SetVisible(false);
      meterOutput1.SetVisible(false);
   }
   
   // Voice 2
   if (currentPolyphony >= 2)
   {
      textVoice2.SetVisible(true);
      LEDgate2.SetVisible(true);
      meterOutput2.SetVisible(showOutputs);
   }
   else
   {
      textVoice2.SetVisible(false);
      LEDgate2.SetVisible(false);
      meterOutput2.SetVisible(false);
   }
   
   // Voice 3
   if (currentPolyphony >= 3)
   {
      textVoice3.SetVisible(true);
      LEDgate3.SetVisible(true);
      meterOutput3.SetVisible(showOutputs);
   }
   else
   {
      textVoice3.SetVisible(false);
      LEDgate3.SetVisible(false);
      meterOutput3.SetVisible(false);
   }
   
   // Voice 4
   if (currentPolyphony >= 4)
   {
      textVoice4.SetVisible(true);
      LEDgate4.SetVisible(true);
      meterOutput4.SetVisible(showOutputs);
   }
   else
   {
      textVoice4.SetVisible(false);
      LEDgate4.SetVisible(false);
      meterOutput4.SetVisible(false);
   }
   
   // Voice 5
   if (currentPolyphony >= 5)
   {
      textVoice5.SetVisible(true);
      LEDgate5.SetVisible(true);
      meterOutput5.SetVisible(showOutputs);
   }
   else
   {
      textVoice5.SetVisible(false);
      LEDgate5.SetVisible(false);
      meterOutput5.SetVisible(false);
   }
   
   // Voice 6
   if (currentPolyphony >= 6)
   {
      textVoice6.SetVisible(true);
      LEDgate6.SetVisible(true);
      meterOutput6.SetVisible(showOutputs);
   }
   else
   {
      textVoice6.SetVisible(false);
      LEDgate6.SetVisible(false);
      meterOutput6.SetVisible(false);
   }
   
   // Voice 7
   if (currentPolyphony >= 7)
   {
      textVoice7.SetVisible(true);
      LEDgate7.SetVisible(true);
      meterOutput7.SetVisible(showOutputs);
   }
   else
   {
      textVoice7.SetVisible(false);
      LEDgate7.SetVisible(false);
      meterOutput7.SetVisible(false);
   }
   
   // Voice 8
   if (currentPolyphony >= 8)
   {
      textVoice8.SetVisible(true);
      LEDgate8.SetVisible(true);
      meterOutput8.SetVisible(showOutputs);
   }
   else
   {
      textVoice8.SetVisible(false);
      LEDgate8.SetVisible(false);
      meterOutput8.SetVisible(false);
   }
   
   // Voice 9
   if (currentPolyphony >= 9)
   {
      textVoice9.SetVisible(true);
      LEDgate9.SetVisible(true);
      meterOutput9.SetVisible(showOutputs);
   }
   else
   {
      textVoice9.SetVisible(false);
      LEDgate9.SetVisible(false);
      meterOutput9.SetVisible(false);
   }
   
   // Voice 10
   if (currentPolyphony >= 10)
   {
      textVoice10.SetVisible(true);
      LEDgate10.SetVisible(true);
      meterOutput10.SetVisible(showOutputs);
   }
   else
   {
      textVoice10.SetVisible(false);
      LEDgate10.SetVisible(false);
      meterOutput10.SetVisible(false);
   }
   
   // Voice 11
   if (currentPolyphony >= 11)
   {
      textVoice11.SetVisible(true);
      LEDgate11.SetVisible(true);
      meterOutput11.SetVisible(showOutputs);
   }
   else
   {
      textVoice11.SetVisible(false);
      LEDgate11.SetVisible(false);
      meterOutput11.SetVisible(false);
   }
   
   // Voice 12
   if (currentPolyphony >= 12)
   {
      textVoice12.SetVisible(true);
      LEDgate12.SetVisible(true);
      meterOutput12.SetVisible(showOutputs);
   }
   else
   {
      textVoice12.SetVisible(false);
      LEDgate12.SetVisible(false);
      meterOutput12.SetVisible(false);
   }
   
   // Voice 13
   if (currentPolyphony >= 13)
   {
      textVoice13.SetVisible(true);
      LEDgate13.SetVisible(true);
      meterOutput13.SetVisible(showOutputs);
   }
   else
   {
      textVoice13.SetVisible(false);
      LEDgate13.SetVisible(false);
      meterOutput13.SetVisible(false);
   }
   
   // Voice 14
   if (currentPolyphony >= 14)
   {
      textVoice14.SetVisible(true);
      LEDgate14.SetVisible(true);
      meterOutput14.SetVisible(showOutputs);
   }
   else
   {
      textVoice14.SetVisible(false);
      LEDgate14.SetVisible(false);
      meterOutput14.SetVisible(false);
   }
   
   // Voice 15
   if (currentPolyphony >= 15)
   {
      textVoice15.SetVisible(true);
      LEDgate15.SetVisible(true);
      meterOutput15.SetVisible(showOutputs);
   }
   else
   {
      textVoice15.SetVisible(false);
      LEDgate15.SetVisible(false);
      meterOutput15.SetVisible(false);
   }
   
   // Voice 16
   if (currentPolyphony >= 16)
   {
      textVoice16.SetVisible(true);
      LEDgate16.SetVisible(true);
      meterOutput16.SetVisible(showOutputs);
   }
   else
   {
      textVoice16.SetVisible(false);
      LEDgate16.SetVisible(false);
      meterOutput16.SetVisible(false);
   }
   
}

// Explicitly using fallthrough in this procedure, so switch off warnings
@SuppressWarnings("fallthrough")
void UpdateGateLEDs()
{
   int currentPriorityVoice = 0;
   // Always update gate LEDs
   
   // Calculate if the 'First' or 'Last' note keys are currently
   // held down, and which voice they belong to.
   switch (currentKeyMode)
   {
      case FIRST:
      {
         if (channelGatePrevious[firstKeyChannel])
         {
            currentPriorityVoice = firstKeyChannel + 1;
         }
      }
      break;
      
      case HELD:
      {
         // currentPriorityVoice already == 0
      }
      break;
      
      case LAST:
      {
         if (channelGatePrevious[lastKeyChannel])
         {
            currentPriorityVoice = lastKeyChannel + 1;
         }
      }
      break;
      
   }
   switch (currentPolyphony)
   {
      // This switch statement uses implicit fallthrough, so there is
      // a deliberate lack of a break after each case.
            
      case 16:
      {
         if (channelGatePrevious[15])
         {
            if (currentPriorityVoice == 16)
            {
               LEDgate16.SetValue(1.0);
            }
            else
            {
               LEDgate16.SetValue(0.5);
            }
         }
         else
         {
            LEDgate16.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 15:
      {
         if (channelGatePrevious[14])
         {
            if (currentPriorityVoice == 15)
            {
               LEDgate15.SetValue(1.0);
            }
            else
            {
               LEDgate15.SetValue(0.5);
            }
         }
         else
         {
            LEDgate15.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 14:
      {
         if (channelGatePrevious[13])
         {
            if (currentPriorityVoice == 14)
            {
               LEDgate14.SetValue(1.0);
            }
            else
            {
               LEDgate14.SetValue(0.5);
            }
         }
         else
         {
            LEDgate14.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 13:
      {
         if (channelGatePrevious[12])
         {
            if (currentPriorityVoice == 13)
            {
               LEDgate13.SetValue(1.0);
            }
            else
            {
               LEDgate13.SetValue(0.5);
            }
         }
         else
         {
            LEDgate13.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 12:
      {
         if (channelGatePrevious[11])
         {
            if (currentPriorityVoice == 12)
            {
               LEDgate12.SetValue(1.0);
            }
            else
            {
               LEDgate12.SetValue(0.5);
            }
         }
         else
         {
            LEDgate12.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 11:
      {
         if (channelGatePrevious[10])
         {
            if (currentPriorityVoice == 11)
            {
               LEDgate11.SetValue(1.0);
            }
            else
            {
               LEDgate11.SetValue(0.5);
            }
         }
         else
         {
            LEDgate11.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 10:
      {
         if (channelGatePrevious[9])
         {
            if (currentPriorityVoice == 10)
            {
               LEDgate10.SetValue(1.0);
            }
            else
            {
               LEDgate10.SetValue(0.5);
            }
         }
         else
         {
            LEDgate10.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 9:
      {
         if (channelGatePrevious[8])
         {
            if (currentPriorityVoice == 9)
            {
               LEDgate9.SetValue(1.0);
            }
            else
            {
               LEDgate9.SetValue(0.5);
            }
         }
         else
         {
            LEDgate9.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 8:
      {
         if (channelGatePrevious[7])
         {
            if (currentPriorityVoice == 8)
            {
               LEDgate8.SetValue(1.0);
            }
            else
            {
               LEDgate8.SetValue(0.5);
            }
         }
         else
         {
            LEDgate8.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 7:
      {
         if (channelGatePrevious[6])
         {
            if (currentPriorityVoice == 7)
            {
               LEDgate7.SetValue(1.0);
            }
            else
            {
               LEDgate7.SetValue(0.5);
            }
         }
         else
         {
            LEDgate7.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 6:
      {
         if (channelGatePrevious[5])
         {
            if (currentPriorityVoice == 6)
            {
               LEDgate6.SetValue(1.0);
            }
            else
            {
               LEDgate6.SetValue(0.5);
            }
         }
         else
         {
            LEDgate6.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 5:
      {
         if (channelGatePrevious[4])
         {
            if (currentPriorityVoice == 5)
            {
               LEDgate5.SetValue(1.0);
            }
            else
            {
               LEDgate5.SetValue(0.5);
            }
         }
         else
         {
            LEDgate5.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 4:
      {
         if (channelGatePrevious[3])
         {
            if (currentPriorityVoice == 4)
            {
               LEDgate4.SetValue(1.0);
            }
            else
            {
               LEDgate4.SetValue(0.5);
            }
         }
         else
         {
            LEDgate4.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 3:
      {
         if (channelGatePrevious[2])
         {
            if (currentPriorityVoice == 3)
            {
               LEDgate3.SetValue(1.0);
            }
            else
            {
               LEDgate3.SetValue(0.5);
            }
         }
         else
         {
            LEDgate3.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 2:
      {
         if (channelGatePrevious[1])
         {
            if (currentPriorityVoice == 2)
            {
               LEDgate2.SetValue(1.0);
            }
            else
            {
               LEDgate2.SetValue(0.5);
            }
         }
         else
         {
            LEDgate2.SetValue(0.0);
         }
      }
      // No break - fall through to next case
      
      case 1:
      {
         if (channelGatePrevious[0])
         {
            if (currentPriorityVoice == 1)
            {
               LEDgate1.SetValue(1.0);
            }
            else
            {
               LEDgate1.SetValue(0.5);
            }
         }
         else
         {
            LEDgate1.SetValue(0.0);
         }
      }      
   }
}

// Explicitly using fallthrough in this procedure, so switch off warnings
@SuppressWarnings("fallthrough")
void UpdateChannelMeters()
{
   // Only update if in Key & Out mode
   if (currentDisplayMode == DisplayMode.KEY_AND_OUTPUT)
   {
      switch (currentPolyphony)
      {
         // This switch statement uses implicit fallthrough, so there is
         // a deliberate lack of a break after each case.
            
         case 16:
         {
            meterOutput16.SetValue(Math.abs(channelValueCurrent[15] * 0.2f));
         }
         // No break - fall through to next case
      
         case 15:
         {
            meterOutput15.SetValue(Math.abs(channelValueCurrent[14] * 0.2f));
         }
         // No break - fall through to next case
      
         case 14:
         {
            meterOutput14.SetValue(Math.abs(channelValueCurrent[13] * 0.2f));
         }
         // No break - fall through to next case
      
         case 13:
         {
            meterOutput13.SetValue(Math.abs(channelValueCurrent[12] * 0.2f));
         }
         // No break - fall through to next case
      
         case 12:
         {
            meterOutput12.SetValue(Math.abs(channelValueCurrent[11] * 0.2f));
         }
         // No break - fall through to next case
      
         case 11:
         {
            meterOutput11.SetValue(Math.abs(channelValueCurrent[10] * 0.2f));
         }
         // No break - fall through to next case
      
         case 10:
         {
            meterOutput10.SetValue(Math.abs(channelValueCurrent[9] * 0.2f));
         }
         // No break - fall through to next case
      
         case 9:
         {
            meterOutput9.SetValue(Math.abs(channelValueCurrent[8] * 0.2f));
         }
         // No break - fall through to next case
      
         case 8:
         {
            meterOutput8.SetValue(Math.abs(channelValueCurrent[7] * 0.2f));
         }
         // No break - fall through to next case
      
         case 7:
         {
            meterOutput7.SetValue(Math.abs(channelValueCurrent[6] * 0.2f));
         }
         // No break - fall through to next case
      
         case 6:
         {
            meterOutput6.SetValue(Math.abs(channelValueCurrent[5] * 0.2f));
         }
         // No break - fall through to next case
      
         case 5:
         {
            meterOutput5.SetValue(Math.abs(channelValueCurrent[4] * 0.2f));
         }
         // No break - fall through to next case
      
         case 4:
         {
            meterOutput4.SetValue(Math.abs(channelValueCurrent[3] * 0.2f));
         }
         // No break - fall through to next case
      
         case 3:
         {
            meterOutput3.SetValue(Math.abs(channelValueCurrent[2] * 0.2f));
         }
         // No break - fall through to next case
      
         case 2:
         {
            meterOutput2.SetValue(Math.abs(channelValueCurrent[1] * 0.2f));
         }
         // No break - fall through to next case
      
         case 1:
         {
            meterOutput1.SetValue(Math.abs(channelValueCurrent[0] * 0.2f));
         }
         // No break - fall through to next case
         
      }  // End switch
               
   }  // End if

}

void DisplayControllerValue()
{
   // Controller value meter
   meterControllerVoltage.SetValue(Math.abs(currentControllerDisplayValue * 0.2f));
   
   // Positive LED
   if (currentControllerDisplayValue > POSITIVE_LED_THRESHOLD)
   {
      LEDpositive.SetValue(1.0);
   }
   else
   {
      LEDpositive.SetValue(0.0);
   }
   
   // Negative LED
   if (currentControllerDisplayValue < NEGATIVE_LED_THRESHOLD)
   {
      LEDnegative.SetValue(1.0);
   }
   else
   {
      LEDnegative.SetValue(0.0);
   }
   
   // Use polyNotesOnfPrevious value as it doesn't change values during ProcessSample. 
   if (polyNotesOnPrevious)
   {
      LEDgate.SetValue(1.0);
   }
   else
   {
      LEDgate.SetValue(0.0);
   }
   
}


//[/user-code-and-variables]
}

 