package MidiApps; import java.io.*; import java.util.*; import javax.sound.midi.*; public class bentComposer extends composer { player p; int note; int patch; public void setNote(int noteIn) { note = noteIn; } public void setPatch(int patchIn) { patch = patchIn; } public void compose() { try { if (s == null) { createSequence(); } Track t = s.createTrack(); String TrackName; bentPlayer bp = new bentPlayer(); p = (player)(bp); p.setTracer(tr); p.setTrack(t); p.setTick(0); p.setTrackName("Bent track"); p.generalMidiOn(); p.setTempo((byte)0x02, (byte)0xA1, (byte)0x20); p.addChannel(0); p.omniOff(); p.polyOff(); p.setPatch(patch); p.setVelOn(0x60); p.setVelOff(0x60); p.setDur((long)60); bentPitchFactory fact = new bentPitchFactory(); fact.setTracer(tr); fact.setMidiPitchIn((byte)note); fact.setMidiPitchOut((byte)note); for (int i = 0; i < 64; i++) { fact.setBendAmount((short)i*128); fact.calculateBendBytes(); bp.setBentPitch(fact.getBentPitch()); bp.play(); } for (int i = 63; i > 0; i--) { fact.setBendAmount((short)i*128); fact.calculateBendBytes(); bp.setBentPitch(fact.getBentPitch()); bp.play(); } p.setDur((long)720); p.resetPitch(); p.addMidiPitch((byte)note); p.play(); // bp.test(); p.endOfTrack(); } //try catch(Exception e) { tr.trace("Compser::compose: Exception caught:"); tr.trace(e.toString()); } //catch } }