// Path: src/ym2151/DataModel/LFO.java
// public class LFO {
// 	
// 	
// 	/**
// 	 * A Map that holds the different Controller Values<br>
// 	 * There KEYs for the Different Knobs are:<br>
// 	 * LFRQ,<br>
// 	 * AMD,<br>
// 	 * PMD,<br>
// 	 * WF,<br>
// 	 * NFRQ,<br>
// 	 * NE <br>
// 	 * */
// 	public final ListenerHashMap<String, Integer> map;
// 	
// 	
// 	/**
// 	 * Creates a new LFO Data Model for the representation of a Instrument in the Controller
// 	 * */
// 	protected LFO(){
// 		map = new ListenerHashMap<String, Integer>();
// 	}
// 	
// 	
// 	/**
// 	 * 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 != 6){
// 			return false;
// 		}
// 		
// 		map.put("LFRQ", Integer.parseInt(s[1]) >>> 1);
// 		
// 		map.put("AMD", Integer.parseInt(s[2]));
// 		map.put("PMD", Integer.parseInt(s[3]));
// 		
// 		map.put("WF", Integer.parseInt(s[4]) << 5);
// 		map.put("NFRQ", Integer.parseInt(s[5]) << 2);
// 		
// 		return true;
// 	}
// 	
// 	
// 	/**
// 	 * This is Part of the OPM File Creation. Use OPMFile to Save a OPM File.
// 	 * */
// 	protected String toOPM(){
// 		String sp = "  ";
// 		
// 		int LFRQ = map.get("LFRQ") << 1;
// 		int AMD = map.get("AMD");
// 		int PMD = map.get("PMD");
// 		int WF = map.get("WF") >> 5;
// 		int NFRQ = map.get("NFRQ") >> 2;
// 		
// 		return LFRQ+sp+AMD+sp+PMD+sp+WF+sp+NFRQ+"\n";
// 	}
// 	
// 	
// }
// 
// Path: src/ym2151/Swing/ListenerHashMap.java
// public interface HashMapListener<K,V>{
// 	public void valueChanged(K key, V value);
// }


import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import ym2151.DataModel.LFO;
import ym2151.Swing.ListenerHashMap.HashMapListener;
		NamedKnob knobAmD = new NamedKnob(lfo.map, "AMD");
		GridBagConstraints gbc_knobAP = new GridBagConstraints();
		gbc_knobAP.insets = new Insets(0, 0, 5, 5);
		gbc_knobAP.fill = GridBagConstraints.BOTH;
		gbc_knobAP.gridx = 0;
		gbc_knobAP.gridy = 4;
		add(knobAmD, gbc_knobAP);
		
		final JToggleButton tglbtnEnableNoise = new JToggleButton("Enable Noise");
		GridBagConstraints gbc_tglbtnEnableNoise = new GridBagConstraints();
		gbc_tglbtnEnableNoise.insets = new Insets(0, 0, 5, 5);
		gbc_tglbtnEnableNoise.gridx = 1;
		gbc_tglbtnEnableNoise.gridy = 4;
		add(tglbtnEnableNoise, gbc_tglbtnEnableNoise);
		tglbtnEnableNoise.addActionListener(new ToggleButtonListener(lfo.map, "NE", tglbtnEnableNoise));
		
		NamedKnob knobNoiseFreq = new NamedKnob(lfo.map, "NFRQ");
		GridBagConstraints gbc_knobNoiseFreq = new GridBagConstraints();
		gbc_knobNoiseFreq.insets = new Insets(0, 0, 5, 0);
		gbc_knobNoiseFreq.fill = GridBagConstraints.BOTH;
		gbc_knobNoiseFreq.gridx = 2;
		gbc_knobNoiseFreq.gridy = 4;
		add(knobNoiseFreq, gbc_knobNoiseFreq);

	}
	
	
	/**
	 * Add a Listener, if the Noise Enable Button Changes
	 * */
// Path: src/ym2151/DataModel/LFO.java
// public class LFO {
// 	
// 	
// 	/**
// 	 * A Map that holds the different Controller Values<br>
// 	 * There KEYs for the Different Knobs are:<br>
// 	 * LFRQ,<br>
// 	 * AMD,<br>
// 	 * PMD,<br>
// 	 * WF,<br>
// 	 * NFRQ,<br>
// 	 * NE <br>
// 	 * */
// 	public final ListenerHashMap<String, Integer> map;
// 	
// 	
// 	/**
// 	 * Creates a new LFO Data Model for the representation of a Instrument in the Controller
// 	 * */
// 	protected LFO(){
// 		map = new ListenerHashMap<String, Integer>();
// 	}
// 	
// 	
// 	/**
// 	 * 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 != 6){
// 			return false;
// 		}
// 		
// 		map.put("LFRQ", Integer.parseInt(s[1]) >>> 1);
// 		
// 		map.put("AMD", Integer.parseInt(s[2]));
// 		map.put("PMD", Integer.parseInt(s[3]));
// 		
// 		map.put("WF", Integer.parseInt(s[4]) << 5);
// 		map.put("NFRQ", Integer.parseInt(s[5]) << 2);
// 		
// 		return true;
// 	}
// 	
// 	
// 	/**
// 	 * This is Part of the OPM File Creation. Use OPMFile to Save a OPM File.
// 	 * */
// 	protected String toOPM(){
// 		String sp = "  ";
// 		
// 		int LFRQ = map.get("LFRQ") << 1;
// 		int AMD = map.get("AMD");
// 		int PMD = map.get("PMD");
// 		int WF = map.get("WF") >> 5;
// 		int NFRQ = map.get("NFRQ") >> 2;
// 		
// 		return LFRQ+sp+AMD+sp+PMD+sp+WF+sp+NFRQ+"\n";
// 	}
// 	
// 	
// }
// 
// Path: src/ym2151/Swing/ListenerHashMap.java
// public interface HashMapListener<K,V>{
// 	public void valueChanged(K key, V value);
// }


// Path: src/ym2151/Swing/LFOPanel.java
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import ym2151.DataModel.LFO;
import ym2151.Swing.ListenerHashMap.HashMapListener;

		NamedKnob knobAmD = new NamedKnob(lfo.map, "AMD");
		GridBagConstraints gbc_knobAP = new GridBagConstraints();
		gbc_knobAP.insets = new Insets(0, 0, 5, 5);
		gbc_knobAP.fill = GridBagConstraints.BOTH;
		gbc_knobAP.gridx = 0;
		gbc_knobAP.gridy = 4;
		add(knobAmD, gbc_knobAP);
		
		final JToggleButton tglbtnEnableNoise = new JToggleButton("Enable Noise");
		GridBagConstraints gbc_tglbtnEnableNoise = new GridBagConstraints();
		gbc_tglbtnEnableNoise.insets = new Insets(0, 0, 5, 5);
		gbc_tglbtnEnableNoise.gridx = 1;
		gbc_tglbtnEnableNoise.gridy = 4;
		add(tglbtnEnableNoise, gbc_tglbtnEnableNoise);
		tglbtnEnableNoise.addActionListener(new ToggleButtonListener(lfo.map, "NE", tglbtnEnableNoise));
		
		NamedKnob knobNoiseFreq = new NamedKnob(lfo.map, "NFRQ");
		GridBagConstraints gbc_knobNoiseFreq = new GridBagConstraints();
		gbc_knobNoiseFreq.insets = new Insets(0, 0, 5, 0);
		gbc_knobNoiseFreq.fill = GridBagConstraints.BOTH;
		gbc_knobNoiseFreq.gridx = 2;
		gbc_knobNoiseFreq.gridy = 4;
		add(knobNoiseFreq, gbc_knobNoiseFreq);

	}
	
	
	/**
	 * Add a Listener, if the Noise Enable Button Changes
	 * */
	private class ToggleButtonListener implements ActionListener, HashMapListener<String, Integer>{