Examples of Patch


Examples of javax.sound.midi.Patch

    public String getName() {
        return getClass().getName();
    }

    public Patch getPatch() {
        return new Patch(0, 0);
    }
View Full Code Here

Examples of javax.sound.midi.Patch

        return getName();
    }

    public Instrument getInstrument(Patch patch) {
        Instrument ins = getInstrument();
        Patch p = ins.getPatch();
        if (p.getBank() != patch.getBank())
            return null;
        if (p.getProgram() != patch.getProgram())
            return null;
        if (p instanceof ModelPatch && patch instanceof ModelPatch) {
            if (((ModelPatch)p).isPercussion()
                    != ((ModelPatch)patch).isPercussion()) {
                return null;
View Full Code Here

Examples of javax.sound.midi.Patch

        int bank = patch.getBank();
        boolean percussion = false;
        if (patch instanceof ModelPatch)
            percussion = ((ModelPatch) patch).isPercussion();
        for (Instrument instrument : instruments) {
            Patch patch2 = instrument.getPatch();
            int program2 = patch2.getProgram();
            int bank2 = patch2.getBank();
            if (program == program2 && bank == bank2) {
                boolean percussion2 = false;
                if (patch2 instanceof ModelPatch)
                    percussion2 = ((ModelPatch) patch2).isPercussion();
                if (percussion == percussion2)
View Full Code Here

Examples of javax.sound.midi.Patch

* @author Karl Helgason
*/
public class ModelInstrumentComparator implements Comparator<Instrument> {

    public int compare(Instrument arg0, Instrument arg1) {
        Patch p0 = arg0.getPatch();
        Patch p1 = arg1.getPatch();
        int a = p0.getBank() * 128 + p0.getProgram();
        int b = p1.getBank() * 128 + p1.getProgram();
        if (p0 instanceof ModelPatch) {
            a += ((ModelPatch)p0).isPercussion() ? 2097152 : 0;
        }
        if (p1 instanceof ModelPatch) {
            b += ((ModelPatch)p1).isPercussion() ? 2097152 : 0;
View Full Code Here

Examples of javax.sound.midi.Patch

        int bank = patch.getBank();
        boolean percussion = false;
        if (patch instanceof ModelPatch)
            percussion = ((ModelPatch)patch).isPercussion();
        for (Instrument instrument : instruments) {
            Patch patch2 = instrument.getPatch();
            int program2 = patch2.getProgram();
            int bank2 = patch2.getBank();
            if (program == program2 && bank == bank2) {
                boolean percussion2 = false;
                if (patch2 instanceof ModelPatch)
                    percussion2 = ((ModelPatch)patch2).isPercussion();
                if (percussion == percussion2)
View Full Code Here

Examples of javax.sound.midi.Patch

    if(defsbk != null)
    {
      synth.unloadAllInstruments(defsbk);
      SimpleSoundbank sbk = new SimpleSoundbank();
      SimpleInstrument ins = new SimpleInstrument();
      ins.setPatch(new Patch(0,1));
      sbk.addInstrument(ins);
      SimpleInstrument ins2 = new SimpleInstrument();
      ins2.setPatch(new Patch(0,2));
      sbk.addInstrument(ins2);
      synth.loadAllInstruments(sbk);
      assertTrue(synth.getLoadedInstruments().length == 2);
    }
    synth.close();
View Full Code Here

Examples of javax.sound.midi.Patch

    if(defsbk != null)
    {
      synth.unloadAllInstruments(defsbk);
      SimpleSoundbank sbk = new SimpleSoundbank();
      SimpleInstrument ins = new SimpleInstrument();
      ins.setPatch(new Patch(0,1));
      sbk.addInstrument(ins);
      SimpleInstrument ins2 = new SimpleInstrument();
      ins2.setPatch(new Patch(0,2));
      sbk.addInstrument(ins2);
      synth.loadInstruments(sbk, new Patch[] {ins2.getPatch()});
      assertTrue(synth.getLoadedInstruments().length == 1);
    }
    synth.close();
View Full Code Here

Examples of javax.sound.midi.Patch

    if(defsbk != null)
    {
      synth.unloadAllInstruments(defsbk);
      SimpleSoundbank sbk = new SimpleSoundbank();
      SimpleInstrument ins = new SimpleInstrument();
      ins.setPatch(new Patch(0,1));
      sbk.addInstrument(ins);
      SimpleInstrument ins2 = new SimpleInstrument();
      ins2.setPatch(new Patch(0,2));
      sbk.addInstrument(ins2);
      synth.loadInstrument(ins2);
      assertTrue(synth.getLoadedInstruments().length == 1);
    }
    synth.close();
View Full Code Here

Examples of javax.sound.midi.Patch

    if(defsbk != null)
    {
      synth.unloadAllInstruments(defsbk);
      SimpleSoundbank sbk = new SimpleSoundbank();
      SimpleInstrument ins = new SimpleInstrument();
      ins.setPatch(new Patch(0,1));
      sbk.addInstrument(ins);
      SimpleInstrument ins2 = new SimpleInstrument();
      ins2.setPatch(new Patch(0,2));
      sbk.addInstrument(ins2);
      synth.loadInstrument(ins2);
      assertTrue(synth.getLoadedInstruments().length == 1);
      synth.unloadInstrument(ins2);
      assertTrue(synth.getLoadedInstruments().length == 0);
View Full Code Here

Examples of javax.sound.midi.Patch

    if(defsbk != null)
    {
      synth.unloadAllInstruments(defsbk);
      SimpleSoundbank sbk = new SimpleSoundbank();
      SimpleInstrument ins = new SimpleInstrument();
      ins.setPatch(new Patch(0,1));
      sbk.addInstrument(ins);
      SimpleInstrument ins2 = new SimpleInstrument();
      ins2.setPatch(new Patch(0,2));
      sbk.addInstrument(ins2);
      synth.loadInstrument(ins2);
      assertTrue(synth.getLoadedInstruments().length == 1);
      synth.unloadInstruments(sbk, new Patch[] {ins2.getPatch()});
      assertTrue(synth.getLoadedInstruments().length == 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.