/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.util.LinkedHashMap;

/**
 *
 * @author Tom
 */
public class AverageMIDIFileData extends MIDIFileData{
   private LinkedHashMap<String, Integer> instrumentGroup = new LinkedHashMap<>();
   private LinkedHashMap<String, Integer> keyGroup  = new LinkedHashMap<>();

   public AverageMIDIFileData() {
      super();
      keyGroup.put("Major C", 0);
      keyGroup.put("Major C#", 0);
      keyGroup.put("Major D", 0);
      keyGroup.put("Major D#", 0);
      keyGroup.put("Major E", 0);
      keyGroup.put("Major F", 0);
      keyGroup.put("Major F#", 0);
      keyGroup.put("Major G", 0);
      keyGroup.put("Major G#", 0);
      keyGroup.put("Major A", 0);
      keyGroup.put("Major A#", 0);
      keyGroup.put("Major B", 0);
      keyGroup.put("Minor C", 0);
      keyGroup.put("Minor C#", 0);
      keyGroup.put("Minor D", 0);
      keyGroup.put("Minor D#", 0);
      keyGroup.put("Minor E", 0);
      keyGroup.put("Minor F", 0);
      keyGroup.put("Minor F#", 0);
      keyGroup.put("Minor G", 0);
      keyGroup.put("Minor G#", 0);
      keyGroup.put("Minor A", 0);
      keyGroup.put("Minor A#", 0);
      keyGroup.put("Minor B", 0);
      
      instrumentGroup.put("Piano", 0);
      instrumentGroup.put("Chromatic Percussion", 0);
      instrumentGroup.put("Organ", 0);
      instrumentGroup.put("Guitar", 0);
      instrumentGroup.put("Bass", 0);
      instrumentGroup.put("Strings", 0);
      instrumentGroup.put("Ensemble", 0);
      instrumentGroup.put("Brass", 0);
      instrumentGroup.put("Reed", 0);
      instrumentGroup.put("Pipe", 0);
      instrumentGroup.put("Synth Lead", 0);
      instrumentGroup.put("Synth Pad", 0);
      instrumentGroup.put("Synth Effects", 0);
      instrumentGroup.put("Ethnic", 0);
      instrumentGroup.put("Percussive", 0);
      instrumentGroup.put("Sound Effects", 0);
      instrumentGroup.put("Percussions", 0);
   }
   
   public LinkedHashMap<String, Integer> getInstrumentGroup() {
      return instrumentGroup;
   }

   public void incInstrument(int instrument) {
      if (instrument >= 0 && instrument <= 8) { //Piano
         int x = (int)instrumentGroup.get("Piano") + 1;
         instrumentGroup.put("Piano",x);
      } else if (instrument >= 9 && instrument <= 16) { //Chromatic Percussion
         int x = (int)instrumentGroup.get("Chromatic Percussion") + 1;
         instrumentGroup.put("Chromatic Percussion",x);
      } else if (instrument >= 17 && instrument <= 24) { //Organ
         int x = (int)instrumentGroup.get("Organ") + 1;
         instrumentGroup.put("Organ",x);
      } else if (instrument >= 25 && instrument <= 32) { //Guitar
         int x = (int)instrumentGroup.get("Guitar") + 1;
         instrumentGroup.put("Guitar",x);
      } else if (instrument >= 33 && instrument <= 40) { //Bass
         int x = (int)instrumentGroup.get("Bass") + 1;
         instrumentGroup.put("Bass",x);
      } else if (instrument >= 41 && instrument <= 48) { //Strings
         int x = (int)instrumentGroup.get("Strings") + 1;
         instrumentGroup.put("Strings",x);
      } else if (instrument >= 49 && instrument <= 56) { //Ensemble
         int x = (int)instrumentGroup.get("Ensemble") + 1;
         instrumentGroup.put("Ensemble",x);
      } else if (instrument >= 57 && instrument <= 64) { //Brass
         int x = (int)instrumentGroup.get("Brass") + 1;
         instrumentGroup.put("Brass",x);
      } else if (instrument >= 65 && instrument <= 72) { //Reed
         int x = (int)instrumentGroup.get("Reed") + 1;
         instrumentGroup.put("Reed",x);
      } else if (instrument >= 73 && instrument <= 80) { //Pipe
         int x = (int)instrumentGroup.get("Pipe") + 1;
         instrumentGroup.put("Pipe",x);
      } else if (instrument >= 81 && instrument <= 88) { //Synth Lead
         int x = (int)instrumentGroup.get("Synth Lead") + 1;
         instrumentGroup.put("Synth Lead",x);
      } else if (instrument >= 89 && instrument <= 96) { //Synth Pad
         int x = (int)instrumentGroup.get("Synth Pad") + 1;
         instrumentGroup.put("Synth Pad",x);
      } else if (instrument >= 97 && instrument <= 104) { //Synth Effects
         int x = (int)instrumentGroup.get("Synth Effects") + 1;
         instrumentGroup.put("Synth Effects",x);
      } else if (instrument >= 105 && instrument <= 112) { //Ethnic
         int x = (int)instrumentGroup.get("Ethnic") + 1;
         instrumentGroup.put("Ethnic",x);
      } else if (instrument >= 113 && instrument <= 120) { //Percussive
         int x = (int)instrumentGroup.get("Percussive") + 1;
         instrumentGroup.put("Percussive",x);
      } else if (instrument >= 121 && instrument <= 128) { //Sound Effects
         int x = (int)instrumentGroup.get("Sound Effects") + 1;
         instrumentGroup.put("Sound Effects",x);
      } else { //Percussions
         int x = (int)instrumentGroup.get("Percussions") + 1;
         instrumentGroup.put("Percussions",x);
      }
   }
   
   public void incKey(String key) {
      int x = (int)keyGroup.get(key) + 1;
      keyGroup.put(key,x);
   }

   public LinkedHashMap<String, Integer> getKeyGroup() {
      return keyGroup;
   }
}
