@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()); } }
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; }
@Override public void setSustain(int sustain) { for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) cpatch.getChannel().controlChange(Constants.SUSTAIN, sustain); }
@Override public void setReverb(int reverb) { for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) cpatch.getChannel().controlChange(Constants.REVERB, reverb); }
@Override public void setPan(int pan) { for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) cpatch.getChannel().controlChange(Constants.PAN, pan); }
@Override public void setModulation(int modulation) { for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) cpatch.getChannel().controlChange(Constants.MODULATION, modulation); }
@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); }
@Override public void setVolume(int volume) { for (CustomPatchElement cpatch : patches.get(selected_instrument).getPatch()) cpatch.getChannel().controlChange(Constants.VOLUME, volume); }