Package javax.sound.midi

Examples of javax.sound.midi.Patch


        0xf7};
    int[] oct = {5,10,15,20,25,30,35,40,45,50,51,52};
    byte[] bmsg = new byte[msg.length];
    for (int i = 0; i < bmsg.length; i++)
      bmsg[i] = (byte)msg[i];
    SoftTuning tuning = new SoftTuning(new Patch(8,32),bmsg);
    double[] tunings = tuning.getTuning();
    for (int i = 0; i < tunings.length; i++)  
      assertTrue(Math.abs(tunings[i]-(i*100 + (oct[i%12]-64))) < 0.00001);   
    assertEquals(tuning.getPatch().getProgram(), 32);
    assertEquals(tuning.getPatch().getBank(), 8);   
View Full Code Here


    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

    if(!value)
      throw new RuntimeException("assertTrue fails!");
  }
   
  public static void main(String[] args) throws Exception {
    SoftTuning tuning = new SoftTuning(new Patch(8,32));
    assertEquals(tuning.getPatch().getProgram(), 32);
    assertEquals(tuning.getPatch().getBank(), 8);
  }
View Full Code Here

    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

    performers[1].setSelfNonExclusive(false);
    performers[0].setDefaultConnectionsEnabled(true);
    performers[1].getConnectionBlocks().add(new ModelConnectionBlock());
    performers[1].getOscillators().add(new ModelByteBufferWavetable(new ModelByteBuffer(new byte[] {1,2,3})));
   
    Patch patch = new Patch(0,36);
    instrument.setPatch(patch);
    assertEquals(instrument.getPatch().getProgram(), patch.getProgram());
    assertEquals(instrument.getPatch().getBank(), patch.getBank());
  }
View Full Code Here

    public static void main(String[] args) throws Exception {

        Soundbank soundbank = EmergencySoundbank.createSoundbank();
        for (int i = 0; i < 128; i++) {
            Patch patch = new ModelPatch(0, i, false);
            ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch);
            if(ins == null)
                throw new Exception("Instrument " + i + " is missing!");
            if(ins.getPerformers().length == 0)
                throw new Exception("Instrument " + i + " doesn't have any performers!");
        }
        Patch patch = new ModelPatch(0, 0, true);
        ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch);
        if(ins == null)
            throw new Exception("Drumkit instrument is missing!");
        if(ins.getPerformers().length == 0)
            throw new Exception("Drumkit instrument doesn't have any performers!");
View Full Code Here

    public static void main(String[] args) throws Exception {
        File file = new File(System.getProperty("test.src", "."), "ding.sf2");
        Soundbank sf2 = new SF2SoundbankReader().getSoundbank(file);
        assertTrue(sf2.getInstruments().length == 1);
        Patch patch = sf2.getInstruments()[0].getPatch();
        assertTrue(patch.getProgram() == 0);
        assertTrue(patch.getBank() == 0);
    }
View Full Code Here

    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

    public static void main(String[] args) throws Exception {
        File file = new File(System.getProperty("test.src", "."), "ding.sf2");
        URL url = file.toURI().toURL();
        Soundbank sf2 = new SF2SoundbankReader().getSoundbank(url);
        assertTrue(sf2.getInstruments().length == 1);
        Patch patch = sf2.getInstruments()[0].getPatch();
        assertTrue(patch.getProgram() == 0);
        assertTrue(patch.getBank() == 0);
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        File file = new File(System.getProperty("test.src", "."), "ding.dls");
        Soundbank dls = new DLSSoundbankReader().getSoundbank(file);
        assertTrue(dls.getInstruments().length == 1);
        Patch patch = dls.getInstruments()[0].getPatch();
        assertTrue(patch.getProgram() == 0);
        assertTrue(patch.getBank() == 0);
    }
View Full Code Here

TOP

Related Classes of javax.sound.midi.Patch

Copyright © 2018 www.massapicom. 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.