jdk/test/javax/sound/midi/Gervill/SoftSynthesizer/RemapInstrument.java
changeset 6502 13b20559a04a
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
6501:684810d882b3 6502:13b20559a04a
    54         AudioSynthesizer synth = new SoftSynthesizer();
    54         AudioSynthesizer synth = new SoftSynthesizer();
    55         synth.openStream(null, null);
    55         synth.openStream(null, null);
    56         Soundbank defsbk = synth.getDefaultSoundbank();
    56         Soundbank defsbk = synth.getDefaultSoundbank();
    57         if(defsbk != null)
    57         if(defsbk != null)
    58         {
    58         {
    59             Instrument ins0 = defsbk.getInstrument(new Patch(0,0));
    59             Instrument ins3 = defsbk.getInstrument(new Patch(0,3));
    60             Instrument ins10 = defsbk.getInstrument(new Patch(0,10));
    60             Instrument ins10 = defsbk.getInstrument(new Patch(0,10));
    61             assertTrue(synth.remapInstrument(ins0, ins10));
    61             assertTrue(synth.remapInstrument(ins3, ins10));
    62             Instrument[] loaded = synth.getLoadedInstruments();
    62             Instrument[] loaded = synth.getLoadedInstruments();
    63             for (int i = 0; i < loaded.length; i++) {
    63             for (int i = 0; i < loaded.length; i++) {
    64                 if(loaded[i].getPatch().getBank() == 0)
    64                 if(loaded[i].getPatch().getBank() == ins3.getPatch().getBank())
    65                 if(loaded[i].getPatch().getProgram() == 10)
    65                 if(loaded[i].getPatch().getProgram() == ins3.getPatch().getProgram())
    66                 {
    66                 {
    67                     assertEquals(loaded[i].getName(), ins0.getName());
    67                     assertEquals(loaded[i].getName(), ins10.getName());
    68                     break;
    68                     break;
    69                 }
    69                 }
    70             }
    70             }
    71 
    71 
    72         }
    72         }