Package eu.bandm.music.midi
Class Routing
java.lang.Object
eu.bandm.music.midi.Routing
Contains methods and classes for a midi message/event processing network.
Plus some wrappers which lift some deficient classes from java.sound.midi to
the modern interfaces.
The basic data structures are
+----- MidiEvent---+ | long tick | | +---MidiMesage-+ | | | | | | +--------------+ | +------------------*
Attention: The time stamps in "midi events", coming from a "midi standard file", and those coming with "MidiMessages" (as separate method parameters) have different meanings.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic Motif<MidiMessage,
MidiEvent> static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkParameterValue
(int i, String text) static int
extract14bits
(ShortMessage message) static int
extractChannel
(int m) static int
extractCommand
(int m) static int
ATTENTION: java-bytes are SIGNED, and must be converted to int to get their midi meaning, wich is unsigned.static Pattern<MidiMessage>
static void
static int
packStatus
(int code, int channel) range
(int from, int to) A pattern which matches any Integer in the range between the two bounds, lower included, upper not.range_included
(int from, int to) A pattern which matches any Integer in the range between the two bounds, both INCLUDED!static Pattern<MidiMessage>
statusByte
(Pattern<Integer> command, Pattern<Integer> channel) Constructs a Pattern for an integer which represents a status byte.statusByteE
(Pattern<Integer> command, Pattern<Integer> channel) static Pattern<MidiMessage>
statusByteM
(Pattern<Integer> command, Pattern<Integer> channel) Replace by content( statusByte(..,..))static Pattern<MidiMessage>
-
Field Details
-
midi_note_on
public static final int midi_note_on- See Also:
-
midi_note_off
public static final int midi_note_off- See Also:
-
midi_polyphonic_aftertouch
public static final int midi_polyphonic_aftertouch- See Also:
-
midi_control_change
public static final int midi_control_change- See Also:
-
midi_program_change
public static final int midi_program_change- See Also:
-
midi_monophonic_aftertouch
public static final int midi_monophonic_aftertouch- See Also:
-
midi_pitchbend
public static final int midi_pitchbend- See Also:
-
midi_system_message
public static final int midi_system_message- See Also:
-
isChannelMessage
-
-
any
-
anyE
-
-
Constructor Details
-
Routing
public Routing()
-
-
Method Details
-
checkParameterValue
-
extractCommand
public static int extractCommand(int m) - Parameters:
m
- the int value of aMidiMessage
status byte- Returns:
- the int value of the midi command, based on ZERO, ie.
from
midi_note_on
tomidi_system_message
as defined in this class.
-
extractChannel
public static int extractChannel(int m) - Parameters:
m
- the int value of aMidiMessage
status byte- Returns:
- the int value of the adressed channel, from 0 to 15
-
extract14bits
- Parameters:
message
- a pitch bend message- Returns:
- the int value when concatenating the 7 lower bits of the two data byes.
-
packStatus
public static int packStatus(int code, int channel) - Parameters:
code
- the int value of the command, packed into the higher nibble. (May by based on zero or eight, since hi bit will be set anyhow.)channel
- value packed into the lower nibble.- Returns:
- the int value of the status byte, high bit always set
-
getKeyNumber
ATTENTION: java-bytes are SIGNED, and must be converted to int to get their midi meaning, wich is unsigned.
ATTENTION: this method does only make sense when a key is really part of the message, i.e. the commands from "midi_note_off" to "midi_polyphonic_aftertouch". (im case of "midi_program_change" and "midi_control_change" it does make sense to get the data byte, but this is an abuse w.r.t. the NAME of this method!) -
range_included
A pattern which matches any Integer in the range between the two bounds, both INCLUDED! -
range
A pattern which matches any Integer in the range between the two bounds, lower included, upper not. -
statusByte
Constructs a Pattern for an integer which represents a status byte. -
status
-
statusByteM
Replace by content( statusByte(..,..)) -
statusByteE
-
system
-
systemM
-
systemE
-
keyM
-
main
- Throws:
InvalidMidiDataException
IOException
-