View Single Post
  #9 (permalink)  
Old 08-30-2008, 12:38 AM
willemjav willemjav is offline
Senior Member
 
Join Date: Dec 2007
Location: Spain
Posts: 342
willemjav is on a distinguished road
The complete code concerning the midiflag is the following. There are two classes envolved


Code:
public void midiInput(byte[] data){ System.out.println("Input from: "+myInput.getName()); System.out.println("Array length " + data.length); System.out.print("midi data "); for (int i = 0; i < data.length; i++) { System.out.print(" > " + (data[i]) + " / " + (data[i])); //System.out.print(hexChars[(data[i] & 0xFF) / 16] ); //System.out.print(hexChars[(data[i] & 0xFF) % 16]+" willem "); //if (data.length > 5 && (i+1) % 16 == 0) System.out.println(""); } if ((data[0]==-112) && (data[1]==60) && (data[2]==0)) { // for the moment works on C, have no midi ped midiped = true; // midi pedal cc64 127, >64 or 0 pedal up System.out.println(""); System.out.println("pedal up"); } else midiped = false; System.out.println(""); } public boolean getPedal() { / method/ of class midiforFbo1 if(midiped) return true; else return false; }
This code sits in the class midiforFbo1 (its constructor sets either one of the midi drivers by the mmjflag).
In the second class the object setm gets acces to the method of the midi flag.

setm = new midiforFbo1(mmjflag);

The following method sets the flag on the pedal or space key.

Code:
public void keyTyped(KeyEvent evt) { char ch = evt.getKeyChar(); // The character typed. if (ch == ' ' || (setm.getPedal())) { midipedalflag=true; System.out.println(" midipedal trigger "); } }
Reply With Quote