Example #1
0
 @Override
 public void decrementInstrument() {
   if (selected_instrument > low) --selected_instrument;
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) {
     patch = instrument[cpatch.getInstrument()].getPatch();
     cpatch.getChannel().programChange(patch.getBank(), patch.getProgram());
   }
 }
Example #2
0
  public CustomControls(MidiChannel[] channels, Instrument[] instrument, Patch patch) {
    this.channels = channels;
    this.instrument = instrument;
    this.patch = patch;
    this.patches = new HashMap<Integer, CustomPatch>();

    HashSet<CustomPatchElement> tmp = new HashSet<CustomPatchElement>();
    tmp.add(new CustomPatchElement(channels[0], 1, 127));
    tmp.add(new CustomPatchElement(channels[1], 20, 102));
    tmp.add(new CustomPatchElement(channels[2], 70, 75));

    patches.put(0, new CustomPatch("mine", tmp));

    for (CustomPatchElement c : patches.get(0).getPatch()) {
      patch = instrument[c.getInstrument()].getPatch();
      c.getChannel().programChange(patch.getBank(), patch.getProgram());
    }

    this.selected_instrument = 0;
  }
Example #3
0
 @Override
 public void setSustain(int sustain) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     cpatch.getChannel().controlChange(Constants.SUSTAIN, sustain);
 }
Example #4
0
 @Override
 public void setReverb(int reverb) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     cpatch.getChannel().controlChange(Constants.REVERB, reverb);
 }
Example #5
0
 @Override
 public void setPan(int pan) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     cpatch.getChannel().controlChange(Constants.PAN, pan);
 }
Example #6
0
 @Override
 public void setModulation(int modulation) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     cpatch.getChannel().controlChange(Constants.MODULATION, modulation);
 }
Example #7
0
 @Override
 public void stopNote(int note) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     if (cpatch.getRange()[0] <= note && note <= cpatch.getRange()[1])
       cpatch.getChannel().noteOff(note);
 }
Example #8
0
 @Override
 public void setVolume(int volume) {
   for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch())
     cpatch.getChannel().controlChange(Constants.VOLUME, volume);
 }