public abstract class MidiCommunication
extends java.lang.Object
implements javax.sound.midi.Receiver
Constructor and Description |
---|
MidiCommunication()
A constructor that automatically prompts for the MIDI i/o ports.
|
MidiCommunication(boolean prompt)
A constructor that supresses the automatic prompting of ports,
allowing the programmer to call midiSetup when it suits them.
|
MidiCommunication(int inputDeviceID,
int outputDeviceID)
A constructor that automatic assigns MIDI input and output to the ports
you define.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
abstract void |
handleMidiInput(int status,
int channel,
int data1,
int data2)
Handle external MIDI events sent to this computer.
|
void |
midiSetup()
Choose the MIDI ports to use.
|
void |
send(javax.sound.midi.MidiMessage message,
long timeStamp)
The method required by the recieve interface - It has a stupid name so we
pass data for short messages to handleMidiInput (a better name).
|
void |
sendMidiOutput(int status,
int channel,
int data1,
int data2)
Construct a MIDI message and pass to the designated MIDi output.
|
public MidiCommunication()
public MidiCommunication(boolean prompt)
public MidiCommunication(int inputDeviceID, int outputDeviceID)
inputDeviceID
- The MIDI port number to use for input to Java.outputDeviceID
- The MIDI port number to use for output from Java.public void midiSetup()
public abstract void handleMidiInput(int status, int channel, int data1, int data2)
status
- The MIDI status type. 11 = Controller, ? = Note on, etc.channel
- The MIDi channel this message is sent on.data1
- The first byte of data in the message. Often controller number of Note pitch.data2
- The second byte of data. Usually the controller value or Note velocity.public void sendMidiOutput(int status, int channel, int data1, int data2)
status
- The MIDI status type. 11 = Controller, 144 = Note on, 128 = Note Off, 192 = Program Change, etc.channel
- The MIDi channel this message is sent on.data1
- The first byte of data in the message. Often controller number of Note pitch.data2
- The second byte of data. Usually the controller value or Note velocity.public void send(javax.sound.midi.MidiMessage message, long timeStamp)
send
in interface javax.sound.midi.Receiver
public void close()
close
in interface java.lang.AutoCloseable
close
in interface javax.sound.midi.Receiver