// Path: src/ym2151/DataModel/Common.java
// public class Common {
// 	
// 	/**
// 	 * A Map that holds the different Controller Values<br>
// 	 * There KEYs for the Different Knobs are:
// 	 * <br><br> PAN, FL, CON, AMS, PMS, 
// 	 * <br>OP1_EN, OP2_EN, OP3_EN, OP4_EN, 
// 	 * <br>AMSEN_OP1, AMSEN_OP2, AMSEN_OP3, AMSEN_OP4
// 	 * */
// 	public final ListenerHashMap<String, Integer> map;
// 	
// 	
// 	/**
// 	 * Creates a new Common Data Model for the representation of a Instrument in the Controller
// 	 * */
// 	protected Common(){
// 		map = new ListenerHashMap<String, Integer>();
// 		map.put("VOL", 63);
// 	}
// 	
// 	
// 	/**
// 	 * This is Part of the OPM File Parsing. Use OPMFile to Load a OPM File.
// 	 * @param s the String Values to parse.
// 	 * @return "true" if parsing went OK and "false" if else.
// 	 * */
// 	protected boolean setVars(String[] s){
// 		if(s.length != 8){
// 			return false;
// 		}
// 
// 		map.put("PAN", Integer.parseInt(s[1]));
// 
// 		map.put("FL", Integer.parseInt(s[2]) << 4); //FB
// 
// 		map.put("CON", Integer.parseInt(s[3]) << 4); //ALGO
// 
// 		map.put("AMS", Integer.parseInt(s[4]) << 5);//AMS
// 
// 		map.put("PMS", Integer.parseInt(s[5]) << 4);//PMS
// 
// 		int slot = (Integer.parseInt(s[6]) >> 3) & 0x0F;
// 
// 		map.put("OP1_EN", ((slot) 	  & 0x01) * 127);
// 		map.put("OP3_EN", ((slot >> 1) & 0x01) * 127);
// 		map.put("OP2_EN", ((slot >> 2) & 0x01) * 127);
// 		map.put("OP4_EN", ((slot >> 3) & 0x01) * 127);
// 		
// 		return true;
// 	}
// 	
// 	/**
// 	 * This is Part of the OPM File Creation. Use OPMFile to Save a OPM File.
// 	 * @return the String to add to the OPM File
// 	 * */
// 	protected String toOPM(){
// 		
// 		String sp = "  ";
// 		int PAN = map.get("PAN");
// 		int FL = map.get("FL") >> 4;
// 		int CON = map.get("CON") >> 4;
// 		int AMS = map.get("AMS") >> 5;
// 		int PMS = map.get("PMS") >> 4;
// 		
// 		
// 		int OP1_EN = map.get("OP1_EN") >= 64 ? 1 : 0;
// 		int OP3_EN = map.get("OP3_EN") >= 64 ? 1 : 0;
// 		int OP2_EN = map.get("OP2_EN") >= 64 ? 1 : 0;
// 		int OP4_EN = map.get("OP4_EN") >= 64 ? 1 : 0;
// 		
// 		int SLOT = ((OP1_EN) | (OP3_EN << 1) | (OP2_EN << 2) |(OP4_EN << 3)) << 3;
// 		
// 		return PAN+sp+FL+sp+CON+sp+AMS+sp+PMS+sp+SLOT+sp;
// 	}
// 
// }
// 
// Path: src/ym2151/Swing/ListenerHashMap.java
// public interface HashMapListener<K,V>{
// 	public void valueChanged(K key, V value);
// }


import ym2151.DataModel.Common;
import ym2151.Swing.ListenerHashMap.HashMapListener;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;
		pnlVolume.add(knobVolume);
		
		
		//add the Algorithm Selector and Buttons
		JPanel pnlRight = new JPanel();
		GridBagConstraints gbc_pnlRight = new GridBagConstraints();
		gbc_pnlRight.insets = new Insets(0, 0, 5, 5);
		gbc_pnlRight.fill = GridBagConstraints.BOTH;
		gbc_pnlRight.gridx = 2;
		gbc_pnlRight.gridy = 1;
		add(pnlRight, gbc_pnlRight);
		GridBagLayout gbl_pnlRight = new GridBagLayout();
		gbl_pnlRight.columnWidths = new int[] {75, 0};
		gbl_pnlRight.rowHeights = new int[]{20, 176, 40, 0};
		gbl_pnlRight.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gbl_pnlRight.rowWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
		pnlRight.setLayout(gbl_pnlRight);
		
		JLabel lblAlgorithm = new JLabel("Algorithm");
		lblAlgorithm.setHorizontalAlignment(SwingConstants.CENTER);
		GridBagConstraints gbc_lblAlgorithm = new GridBagConstraints();
		gbc_lblAlgorithm.fill = GridBagConstraints.BOTH;
		gbc_lblAlgorithm.insets = new Insets(0, 0, 5, 0);
		gbc_lblAlgorithm.gridx = 0;
		gbc_lblAlgorithm.gridy = 0;
		pnlRight.add(lblAlgorithm, gbc_lblAlgorithm);
		
		algorithmSelector = new AlgorithmSelector(7);
		GridBagConstraints gbc_algorithmSelector = new GridBagConstraints();
		gbc_algorithmSelector.fill = GridBagConstraints.BOTH;
// Path: src/ym2151/DataModel/Common.java
// public class Common {
// 	
// 	/**
// 	 * A Map that holds the different Controller Values<br>
// 	 * There KEYs for the Different Knobs are:
// 	 * <br><br> PAN, FL, CON, AMS, PMS, 
// 	 * <br>OP1_EN, OP2_EN, OP3_EN, OP4_EN, 
// 	 * <br>AMSEN_OP1, AMSEN_OP2, AMSEN_OP3, AMSEN_OP4
// 	 * */
// 	public final ListenerHashMap<String, Integer> map;
// 	
// 	
// 	/**
// 	 * Creates a new Common Data Model for the representation of a Instrument in the Controller
// 	 * */
// 	protected Common(){
// 		map = new ListenerHashMap<String, Integer>();
// 		map.put("VOL", 63);
// 	}
// 	
// 	
// 	/**
// 	 * This is Part of the OPM File Parsing. Use OPMFile to Load a OPM File.
// 	 * @param s the String Values to parse.
// 	 * @return "true" if parsing went OK and "false" if else.
// 	 * */
// 	protected boolean setVars(String[] s){
// 		if(s.length != 8){
// 			return false;
// 		}
// 
// 		map.put("PAN", Integer.parseInt(s[1]));
// 
// 		map.put("FL", Integer.parseInt(s[2]) << 4); //FB
// 
// 		map.put("CON", Integer.parseInt(s[3]) << 4); //ALGO
// 
// 		map.put("AMS", Integer.parseInt(s[4]) << 5);//AMS
// 
// 		map.put("PMS", Integer.parseInt(s[5]) << 4);//PMS
// 
// 		int slot = (Integer.parseInt(s[6]) >> 3) & 0x0F;
// 
// 		map.put("OP1_EN", ((slot) 	  & 0x01) * 127);
// 		map.put("OP3_EN", ((slot >> 1) & 0x01) * 127);
// 		map.put("OP2_EN", ((slot >> 2) & 0x01) * 127);
// 		map.put("OP4_EN", ((slot >> 3) & 0x01) * 127);
// 		
// 		return true;
// 	}
// 	
// 	/**
// 	 * This is Part of the OPM File Creation. Use OPMFile to Save a OPM File.
// 	 * @return the String to add to the OPM File
// 	 * */
// 	protected String toOPM(){
// 		
// 		String sp = "  ";
// 		int PAN = map.get("PAN");
// 		int FL = map.get("FL") >> 4;
// 		int CON = map.get("CON") >> 4;
// 		int AMS = map.get("AMS") >> 5;
// 		int PMS = map.get("PMS") >> 4;
// 		
// 		
// 		int OP1_EN = map.get("OP1_EN") >= 64 ? 1 : 0;
// 		int OP3_EN = map.get("OP3_EN") >= 64 ? 1 : 0;
// 		int OP2_EN = map.get("OP2_EN") >= 64 ? 1 : 0;
// 		int OP4_EN = map.get("OP4_EN") >= 64 ? 1 : 0;
// 		
// 		int SLOT = ((OP1_EN) | (OP3_EN << 1) | (OP2_EN << 2) |(OP4_EN << 3)) << 3;
// 		
// 		return PAN+sp+FL+sp+CON+sp+AMS+sp+PMS+sp+SLOT+sp;
// 	}
// 
// }
// 
// Path: src/ym2151/Swing/ListenerHashMap.java
// public interface HashMapListener<K,V>{
// 	public void valueChanged(K key, V value);
// }


// Path: src/ym2151/Swing/CommonPanel.java
import ym2151.DataModel.Common;
import ym2151.Swing.ListenerHashMap.HashMapListener;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;

		pnlVolume.add(knobVolume);
		
		
		//add the Algorithm Selector and Buttons
		JPanel pnlRight = new JPanel();
		GridBagConstraints gbc_pnlRight = new GridBagConstraints();
		gbc_pnlRight.insets = new Insets(0, 0, 5, 5);
		gbc_pnlRight.fill = GridBagConstraints.BOTH;
		gbc_pnlRight.gridx = 2;
		gbc_pnlRight.gridy = 1;
		add(pnlRight, gbc_pnlRight);
		GridBagLayout gbl_pnlRight = new GridBagLayout();
		gbl_pnlRight.columnWidths = new int[] {75, 0};
		gbl_pnlRight.rowHeights = new int[]{20, 176, 40, 0};
		gbl_pnlRight.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gbl_pnlRight.rowWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
		pnlRight.setLayout(gbl_pnlRight);
		
		JLabel lblAlgorithm = new JLabel("Algorithm");
		lblAlgorithm.setHorizontalAlignment(SwingConstants.CENTER);
		GridBagConstraints gbc_lblAlgorithm = new GridBagConstraints();
		gbc_lblAlgorithm.fill = GridBagConstraints.BOTH;
		gbc_lblAlgorithm.insets = new Insets(0, 0, 5, 0);
		gbc_lblAlgorithm.gridx = 0;
		gbc_lblAlgorithm.gridy = 0;
		pnlRight.add(lblAlgorithm, gbc_lblAlgorithm);
		
		algorithmSelector = new AlgorithmSelector(7);
		GridBagConstraints gbc_algorithmSelector = new GridBagConstraints();
		gbc_algorithmSelector.fill = GridBagConstraints.BOTH;
		gbc_algorithmSelector.insets = new Insets(0, 0, 5, 0);