package com.domemusictechnologies.acelogic;


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
//[/user-imports]


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

public AceLogic( long moduleID, VoltageObjects voltageObjects )
{
   super( moduleID, voltageObjects, "ACE SR-Latch", ModuleType.ModuleType_Logic, 2.0 );

   InitializeControls();


   canBeBypassed = false;
   SetSkin( "f891339ade0e4a00a0b617a4a96ca2e4" );
}

void InitializeControls()
{

   edge1InJack = new VoltageAudioJack( "Edge 1 Input", "Edge 1 Input", this, JackType.JackType_AudioInput );
   AddComponent( edge1InJack );
   edge1InJack.SetWantsMouseNotifications( false );
   edge1InJack.SetPosition( 27, 57 );
   edge1InJack.SetSize( 25, 25 );
   edge1InJack.SetSkin( "Jack Round Orange Ring" );

   edge1ModeSwitch = new VoltageSwitch( "Edge 1 Mode", "Edge 1 Mode", this, 0 );
   AddComponent( edge1ModeSwitch );
   edge1ModeSwitch.SetWantsMouseNotifications( false );
   edge1ModeSwitch.SetPosition( 27, 88 );
   edge1ModeSwitch.SetSize( 26, 14 );
   edge1ModeSwitch.SetSkin( "2-State Slide Horizontal" );

   edge1OutJack = new VoltageAudioJack( "Edge 1 Output", "Edge 1 Output", this, JackType.JackType_AudioOutput );
   AddComponent( edge1OutJack );
   edge1OutJack.SetWantsMouseNotifications( false );
   edge1OutJack.SetPosition( 27, 117 );
   edge1OutJack.SetSize( 25, 25 );
   edge1OutJack.SetSkin( "Jack Round Yellow Ring" );

   edge2InJack = new VoltageAudioJack( "Edge 2 Input", "Edge 2 Input", this, JackType.JackType_AudioInput );
   AddComponent( edge2InJack );
   edge2InJack.SetWantsMouseNotifications( false );
   edge2InJack.SetPosition( 87, 57 );
   edge2InJack.SetSize( 25, 25 );
   edge2InJack.SetSkin( "Jack Round Orange Ring" );

   edge2OutJack = new VoltageAudioJack( "Edge 2 Output", "Edge 2 Output", this, JackType.JackType_AudioOutput );
   AddComponent( edge2OutJack );
   edge2OutJack.SetWantsMouseNotifications( false );
   edge2OutJack.SetPosition( 87, 117 );
   edge2OutJack.SetSize( 25, 25 );
   edge2OutJack.SetSkin( "Jack Round Yellow Ring" );

   edge2ModeSwitch = new VoltageSwitch( "Edge 2 Mode", "Edge 2 Mode", this, 1 );
   AddComponent( edge2ModeSwitch );
   edge2ModeSwitch.SetWantsMouseNotifications( false );
   edge2ModeSwitch.SetPosition( 87, 88 );
   edge2ModeSwitch.SetSize( 26, 14 );
   edge2ModeSwitch.SetSkin( "2-State Slide Horizontal" );

   textLabel1 = new VoltageLabel( "textLabel1", "textLabel1", this, "Dome Music Technologies" );
   AddComponent( textLabel1 );
   textLabel1.SetWantsMouseNotifications( false );
   textLabel1.SetPosition( 14, 341 );
   textLabel1.SetSize( 115, 19 );
   textLabel1.SetEditable( false, false );
   textLabel1.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel1.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel1.SetColor( new Color( 0, 0, 0, 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, "Edge Detectors" );
   AddComponent( textLabel2 );
   textLabel2.SetWantsMouseNotifications( false );
   textLabel2.SetPosition( 25, 25 );
   textLabel2.SetSize( 89, 16 );
   textLabel2.SetEditable( false, false );
   textLabel2.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel2.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel2.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   textLabel3 = new VoltageLabel( "textLabel3", "textLabel3", this, "In 1" );
   AddComponent( textLabel3 );
   textLabel3.SetWantsMouseNotifications( false );
   textLabel3.SetPosition( 23, 40 );
   textLabel3.SetSize( 32, 19 );
   textLabel3.SetEditable( false, false );
   textLabel3.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel3.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel3.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   textLabel4 = new VoltageLabel( "textLabel4", "textLabel4", this, "In 2" );
   AddComponent( textLabel4 );
   textLabel4.SetWantsMouseNotifications( false );
   textLabel4.SetPosition( 81, 39 );
   textLabel4.SetSize( 35, 20 );
   textLabel4.SetEditable( false, false );
   textLabel4.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel4.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel4.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   textLabel5 = new VoltageLabel( "textLabel5", "textLabel5", this, "Out 1" );
   AddComponent( textLabel5 );
   textLabel5.SetWantsMouseNotifications( false );
   textLabel5.SetPosition( 20, 100 );
   textLabel5.SetSize( 39, 19 );
   textLabel5.SetEditable( false, false );
   textLabel5.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel5.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel5.SetColor( new Color( 0, 0, 0, 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 );

   textLabel6 = new VoltageLabel( "textLabel6", "textLabel6", this, "Out 2" );
   AddComponent( textLabel6 );
   textLabel6.SetWantsMouseNotifications( false );
   textLabel6.SetPosition( 82, 100 );
   textLabel6.SetSize( 35, 19 );
   textLabel6.SetEditable( false, false );
   textLabel6.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel6.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel6.SetColor( new Color( 0, 0, 0, 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 );

   setInputJack = new VoltageAudioJack( "Set Input", "Set Input", this, JackType.JackType_AudioInput );
   AddComponent( setInputJack );
   setInputJack.SetWantsMouseNotifications( false );
   setInputJack.SetPosition( 27, 197 );
   setInputJack.SetSize( 25, 25 );
   setInputJack.SetSkin( "Jack Round Orange Ring" );

   textLabel7 = new VoltageLabel( "textLabel7", "textLabel7", this, "Set" );
   AddComponent( textLabel7 );
   textLabel7.SetWantsMouseNotifications( false );
   textLabel7.SetPosition( 22, 179 );
   textLabel7.SetSize( 34, 21 );
   textLabel7.SetEditable( false, false );
   textLabel7.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel7.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel7.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   resetInputJack = new VoltageAudioJack( "Reset Input", "Reset Input", this, JackType.JackType_AudioInput );
   AddComponent( resetInputJack );
   resetInputJack.SetWantsMouseNotifications( false );
   resetInputJack.SetPosition( 87, 197 );
   resetInputJack.SetSize( 25, 25 );
   resetInputJack.SetSkin( "Jack Round Orange Ring" );

   textLabel8 = new VoltageLabel( "textLabel8", "textLabel8", this, "Reset" );
   AddComponent( textLabel8 );
   textLabel8.SetWantsMouseNotifications( false );
   textLabel8.SetPosition( 79, 180 );
   textLabel8.SetSize( 39, 19 );
   textLabel8.SetEditable( false, false );
   textLabel8.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel8.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel8.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   textLabel9 = new VoltageLabel( "textLabel9", "textLabel9", this, "SR Latch" );
   AddComponent( textLabel9 );
   textLabel9.SetWantsMouseNotifications( false );
   textLabel9.SetPosition( 30, 244 );
   textLabel9.SetSize( 79, 30 );
   textLabel9.SetEditable( false, false );
   textLabel9.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel9.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel9.SetColor( new Color( 0, 0, 0, 255 ) );
   textLabel9.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel9.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel9.SetBorderSize( 1 );
   textLabel9.SetMultiLineEdit( false );
   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", 12, false, false );

   srPlusOutput = new VoltageAudioJack( "SR + Output", "SR + Output", this, JackType.JackType_AudioOutput );
   AddComponent( srPlusOutput );
   srPlusOutput.SetWantsMouseNotifications( false );
   srPlusOutput.SetPosition( 27, 307 );
   srPlusOutput.SetSize( 25, 25 );
   srPlusOutput.SetSkin( "Jack Round Pink Ring" );

   textLabel10 = new VoltageLabel( "textLabel10", "textLabel10", this, "Output" );
   AddComponent( textLabel10 );
   textLabel10.SetWantsMouseNotifications( false );
   textLabel10.SetPosition( 18, 291 );
   textLabel10.SetSize( 44, 17 );
   textLabel10.SetEditable( false, false );
   textLabel10.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel10.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel10.SetColor( new Color( 0, 0, 0, 255 ) );
   textLabel10.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel10.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel10.SetBorderSize( 1 );
   textLabel10.SetMultiLineEdit( false );
   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", 12, false, false );

   srInvOutput = new VoltageAudioJack( "SR Inv. Output", "SR Inv. Output", this, JackType.JackType_AudioOutput );
   AddComponent( srInvOutput );
   srInvOutput.SetWantsMouseNotifications( false );
   srInvOutput.SetPosition( 87, 307 );
   srInvOutput.SetSize( 25, 25 );
   srInvOutput.SetSkin( "Jack Round Pink Ring" );

   textLabel11 = new VoltageLabel( "textLabel11", "textLabel11", this, "Inv. Out" );
   AddComponent( textLabel11 );
   textLabel11.SetWantsMouseNotifications( false );
   textLabel11.SetPosition( 72, 289 );
   textLabel11.SetSize( 54, 21 );
   textLabel11.SetEditable( false, false );
   textLabel11.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel11.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel11.SetColor( new Color( 0, 0, 0, 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 );

   srPlusLED = new VoltageLED( "SR + LED", "SR + LED", this );
   AddComponent( srPlusLED );
   srPlusLED.SetWantsMouseNotifications( false );
   srPlusLED.SetPosition( 12, 314 );
   srPlusLED.SetSize( 12, 12 );
   srPlusLED.SetSkin( "Green" );

   srMinusLED = new VoltageLED( "SR - LED", "SR - LED", this );
   AddComponent( srMinusLED );
   srMinusLED.SetWantsMouseNotifications( false );
   srMinusLED.SetPosition( 115, 314 );
   srMinusLED.SetSize( 12, 12 );
   srMinusLED.SetSkin( "Red" );

   setButton = new VoltageButton( "Set Button", "Set Button", this );
   AddComponent( setButton );
   setButton.SetWantsMouseNotifications( false );
   setButton.SetPosition( 4, 199 );
   setButton.SetSize( 21, 21 );
   setButton.SetSkin( "Mini Gray-Green" );
   setButton.ShowOverlay( false );
   setButton.SetOverlayText( "" );
   setButton.SetAutoRepeat( false );

   resetButton = new VoltageButton( "Reset Button", "Reset Button", this );
   AddComponent( resetButton );
   resetButton.SetWantsMouseNotifications( false );
   resetButton.SetPosition( 114, 199 );
   resetButton.SetSize( 21, 21 );
   resetButton.SetSkin( "Mini Gray-Red" );
   resetButton.ShowOverlay( false );
   resetButton.SetOverlayText( "" );
   resetButton.SetAutoRepeat( false );

   edge1setSwitch = new VoltageSwitch( "Edge 1 to Set", "Edge 1 to Set", this, 1 );
   AddComponent( edge1setSwitch );
   edge1setSwitch.SetWantsMouseNotifications( false );
   edge1setSwitch.SetPosition( 22, 146 );
   edge1setSwitch.SetSize( 35, 35 );
   edge1setSwitch.SetSkin( "2-State Bar Red" );

   edge2resetSwitch = new VoltageSwitch( "Edge 2 to Reset", "Edge 2 to Reset", this, 1 );
   AddComponent( edge2resetSwitch );
   edge2resetSwitch.SetWantsMouseNotifications( false );
   edge2resetSwitch.SetPosition( 82, 146 );
   edge2resetSwitch.SetSize( 35, 35 );
   edge2resetSwitch.SetSkin( "2-State Bar Red" );

   textLabel12 = new VoltageLabel( "textLabel12", "textLabel12", this, "Edge 1 to Set" );
   AddComponent( textLabel12 );
   textLabel12.SetWantsMouseNotifications( false );
   textLabel12.SetPosition( 2, 151 );
   textLabel12.SetSize( 31, 26 );
   textLabel12.SetEditable( false, false );
   textLabel12.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel12.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel12.SetColor( new Color( 0, 0, 0, 255 ) );
   textLabel12.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel12.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel12.SetBorderSize( 1 );
   textLabel12.SetMultiLineEdit( true );
   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", 8, false, false );

   textLabel13 = new VoltageLabel( "textLabel13", "textLabel13", this, "Edge 2 to Reset" );
   AddComponent( textLabel13 );
   textLabel13.SetWantsMouseNotifications( false );
   textLabel13.SetPosition( 108, 149 );
   textLabel13.SetSize( 33, 30 );
   textLabel13.SetEditable( false, false );
   textLabel13.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel13.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel13.SetColor( new Color( 0, 0, 0, 255 ) );
   textLabel13.SetBkColor( new Color( 65, 65, 65, 0 ) );
   textLabel13.SetBorderColor( new Color( 0, 0, 0, 0 ) );
   textLabel13.SetBorderSize( 1 );
   textLabel13.SetMultiLineEdit( true );
   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", 8, false, false );

   textLabel14 = new VoltageLabel( "textLabel14", "textLabel14", this, "Isolate" );
   AddComponent( textLabel14 );
   textLabel14.SetWantsMouseNotifications( false );
   textLabel14.SetPosition( 46, 144 );
   textLabel14.SetSize( 47, 16 );
   textLabel14.SetEditable( false, false );
   textLabel14.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel14.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel14.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   textLabel15 = new VoltageLabel( "textLabel15", "textLabel15", this, "Connect" );
   AddComponent( textLabel15 );
   textLabel15.SetWantsMouseNotifications( false );
   textLabel15.SetPosition( 45, 157 );
   textLabel15.SetSize( 48, 30 );
   textLabel15.SetEditable( false, false );
   textLabel15.SetJustificationFlags( VoltageLabel.Justification.HorizCentered );
   textLabel15.SetJustificationFlags( VoltageLabel.Justification.VertCentered );
   textLabel15.SetColor( new Color( 0, 0, 0, 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", 12, false, false );

   image2 = new VoltageImage( "image2", "image2", this, false );
   AddComponent( image2 );
   image2.SetWantsMouseNotifications( false );
   image2.SetPosition( 16, 3 );
   image2.SetSize( 112, 14 );
   image2.SetCurrentImage( "image image(50).png" );
}



//-------------------------------------------------------------------------------
//  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
   setButtonPressed = false;
   resetButtonPressed = false;

   srOutputHigh = false;
   previousSROutputHigh = false;
   
   srMinusLED.SetValue(1.0);

   CheckConnections();
   CheckSwitches();
   
   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

   boolean currentSetLED;

   switch( notification )
   {
      case Knob_Changed:   // doubleValue is the new VoltageKnob value
      {
      }
      break;
   
      case Slider_Changed:   // doubleValue is the new slider value
      {
      }
      break;
   
      case Button_Changed:   // doubleValue is the new button/toggle button value
      {
         setButtonPressed = (setButton.GetValue() > 0.5);
         resetButtonPressed = (resetButton.GetValue() > 0.5);
      }
      break;
   
      case Switch_Changed:   // doubleValue is the new switch value
      {
         CheckSwitches();
      }
      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
      {
         currentSetLED = srOutputHigh;
         
         if (currentSetLED != previousSROutputHigh)
         {
            // Switch off previously lit LED
            if (previousSROutputHigh)
            {
               srPlusLED.SetValue(0.0);
            }
            else
            {
               srMinusLED.SetValue(0.0);
            }
            
            // Now, switch on currently lit LED
            if (currentSetLED)
            {
               srPlusLED.SetValue(1.0);
            }
            else
            {
               srMinusLED.SetValue(1.0);
            }
            
            previousSROutputHigh = currentSetLED;
         }
         
      }
      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
      {
      }
      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

   boolean allSetInputs;
   boolean allResetInputs;
   boolean edge1outHigh;
   boolean edge2outHigh;
   
   // Process Edge Detectors first.
   edge1inHigh = (edge1InJack.GetValue() > LOGIC_THRESHOLD);
   edge2inHigh = (edge2InJack.GetValue() > LOGIC_THRESHOLD);

   // 
   if (edge1mode == Edge.RISING)
   {
      edge1outHigh = (edge1inHigh && (!previousEdge1inHigh));
   }
   else
   {
      edge1outHigh = ((!edge1inHigh) && previousEdge1inHigh);
   }
   
   previousEdge1inHigh = edge1inHigh;
   
   if (edge1outHigh)
   {
      edge1OutJack.SetValue(5.0);
   }
   else
   {
      edge1OutJack.SetValue(0.0);
   }
   
   if (edge2mode == Edge.RISING)
   {
      edge2outHigh = (edge2inHigh && (!previousEdge2inHigh));
   }
   else
   {
      edge2outHigh = ((!edge2inHigh) && previousEdge2inHigh);
   }
   
   previousEdge2inHigh = edge2inHigh;
   
   if (edge2outHigh)
   {
      edge2OutJack.SetValue(5.0);
   }
   else
   {
      edge2OutJack.SetValue(0.0);
   }
   
   // Now, gather three inputs each to Set and Reset:
   // 1. Hard-wired input from edge detector
   // 2. Front panel push-button
   // 3. Input jack
   
   allSetInputs = (edge1toSet && edge1outHigh) ||
                  (setButtonPressed) ||
                  (setInputJack.GetValue() > LOGIC_THRESHOLD);
                  
   allResetInputs = (edge2toReset && edge2outHigh) ||
                    (resetButtonPressed) ||
                    (resetInputJack.GetValue() > LOGIC_THRESHOLD);
                    
   // Calculate whether a state switch is required
   
   // Set high, Reset low
   if ((allSetInputs) && (!allResetInputs))
   {
      srOutputHigh = true;
   }
                  
   // Set low, Reset high
   if ((!allSetInputs) && (allResetInputs))
   {
      srOutputHigh = false;
   }
                  
   if (srOutputHigh)
   {
      srPlusOutput.SetValue(5.0);
      srInvOutput.SetValue(0.0);
   }
   else
   {
      srPlusOutput.SetValue(0.0);
      srInvOutput.SetValue(5.0);
   }
                     
   //[/user-ProcessSample]
}


//-------------------------------------------------------------------------------
//  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



   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 VoltageImage image2;
private VoltageLabel textLabel15;
private VoltageLabel textLabel14;
private VoltageLabel textLabel13;
private VoltageLabel textLabel12;
private VoltageSwitch edge2resetSwitch;
private VoltageSwitch edge1setSwitch;
private VoltageButton resetButton;
private VoltageButton setButton;
private VoltageLED srMinusLED;
private VoltageLED srPlusLED;
private VoltageLabel textLabel11;
private VoltageAudioJack srInvOutput;
private VoltageLabel textLabel10;
private VoltageAudioJack srPlusOutput;
private VoltageLabel textLabel9;
private VoltageLabel textLabel8;
private VoltageAudioJack resetInputJack;
private VoltageLabel textLabel7;
private VoltageAudioJack setInputJack;
private VoltageLabel textLabel6;
private VoltageLabel textLabel5;
private VoltageLabel textLabel4;
private VoltageLabel textLabel3;
private VoltageLabel textLabel2;
private VoltageLabel textLabel1;
private VoltageSwitch edge2ModeSwitch;
private VoltageAudioJack edge2OutJack;
private VoltageAudioJack edge2InJack;
private VoltageAudioJack edge1OutJack;
private VoltageSwitch edge1ModeSwitch;
private VoltageAudioJack edge1InJack;


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

private enum Edge
{
   RISING,
   FALLING
}

private final double LOGIC_THRESHOLD = 2.5;

private Edge edge1mode;
private Edge edge2mode;

private boolean edge1toSet;
private boolean edge2toReset;

private boolean edge1inHigh;
private boolean previousEdge1inHigh;

private boolean edge2inHigh;
private boolean previousEdge2inHigh;

private boolean edge1inConnected;
private boolean edge2inConnected;
private boolean edge1outConnected;
private boolean edge2outConnected;

private boolean setInConnected;
private boolean resetInConnected;
private boolean srOutConnected;
private boolean srInvOutConnected;

private boolean setInputHigh;
private boolean resetInputHigh;

private boolean setButtonPressed;
private boolean resetButtonPressed;

private boolean srOutputHigh;
private boolean previousSROutputHigh;

private void CheckConnections()
{
   edge1inConnected = (edge1InJack.IsConnected());
   edge2inConnected = (edge2InJack.IsConnected());
   edge1outConnected = (edge1OutJack.IsConnected());
   edge2outConnected = (edge2OutJack.IsConnected());
   
}

private void CheckSwitches()
{
   if (edge1ModeSwitch.GetValue() < 0.5)
   {
      edge1mode = Edge.RISING;
   }
   else
   {
      edge1mode = Edge.FALLING;
   }
   
   if (edge2ModeSwitch.GetValue() < 0.5)
   {
      edge2mode = Edge.RISING;
   }
   else
   {
      edge2mode = Edge.FALLING;
   }
   
   edge1toSet = (edge1setSwitch.GetValue() < 0.5);
   edge2toReset = (edge2resetSwitch.GetValue() < 0.5);
   
}


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

 