public class MessageClassifier
extends java.lang.Object
This class is used to classify a message.
Modifier and Type | Field and Description |
---|---|
private static int |
INVALID_BYTE |
private static java.lang.String |
MSG_LVL_1_SORT_CH_MODE |
private static java.lang.String |
MSG_LVL_1_SORT_CH_VOICE |
private static java.lang.String |
MSG_LVL_1_SORT_META |
private static java.lang.String |
MSG_LVL_1_SORT_SYS_COM |
private static java.lang.String |
MSG_LVL_1_SORT_SYS_RT |
Modifier | Constructor and Description |
---|---|
private |
MessageClassifier()
Private constructor because this class is only used statically.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getDescription(IMessageType message)
Returns a long and short description for the given message or message category.
|
static java.lang.String[] |
getKeySignature(byte sharpsOrFlats,
byte tonality)
Returns the note and tonality of a KEY_SIGNATURE message like it’s used in MidicaPL format.
|
private static java.lang.String |
getLvl2MetaText(int type)
Returns the level 2 message name of META messages.
|
private static java.lang.String |
getLvl2ModeMsgTxtByData1(int val)
Returns the level 2 command of a channel mode message.
|
private static java.lang.String |
getLvl2SystemMsgTxtByStatusByte(int status)
Returns the level 2 message name of system common and system realtime messages by status byte.
|
private static java.lang.String |
getLvl2VoiceMsgTxtByCommand(int cmd)
Returns the level 2 message name of channel voice messages by message command.
|
private static java.lang.String[] |
getLvl34ControllerMsgTxtByData1(int val)
Returns the level 3 and 4 node names of control change messages.
|
private static java.lang.String[] |
getLvl456UniversalSysexTxt(boolean isRealTime,
int sub1,
int sub2)
Returns the level 4, 5, and 6 node names of universal SysEx messages.
|
private static java.lang.String[] |
getLvl4RpnNrpnDataTxt(byte msb,
byte lsb,
byte type)
Returns the level 4 message fields for the tree node of Data entry/increment/decrement messages.
|
private static java.lang.String |
getNoteString(byte number,
int channel)
Returns the configured note name or percussion IDs by number and channel.
|
private static java.lang.String |
getVendorName(java.lang.String vendorNum)
Returns the vendor name for the given vendor number.
|
static SingleMessage |
processMetaMessage(javax.sound.midi.MetaMessage msg,
long tick,
int trackNum,
int msgNum,
java.util.ArrayList<SingleMessage> messages,
MidicaTreeModel msgTreeModel,
java.lang.String chosenCharset,
java.lang.String midiFileCharset)
Retrieves general information from meta messages.
|
static SingleMessage |
processShortMessage(javax.sound.midi.ShortMessage msg,
long tick,
int trackNum,
int msgNum,
java.util.ArrayList<SingleMessage> messages,
MidicaTreeModel msgTreeModel)
Retrieves general information from short messages.
|
static SingleMessage |
processSysexMessage(javax.sound.midi.SysexMessage msg,
long tick,
int trackNum,
int msgNum,
java.util.ArrayList<SingleMessage> messages,
MidicaTreeModel msgTreeModel)
Retrieves general information from SysEx messages.
|
private static final java.lang.String MSG_LVL_1_SORT_CH_VOICE
private static final java.lang.String MSG_LVL_1_SORT_CH_MODE
private static final java.lang.String MSG_LVL_1_SORT_SYS_COM
private static final java.lang.String MSG_LVL_1_SORT_SYS_RT
private static final java.lang.String MSG_LVL_1_SORT_META
private static final int INVALID_BYTE
private MessageClassifier()
Private constructor because this class is only used statically.
public static final java.lang.String[] getDescription(IMessageType message)
Returns a long and short description for the given message or message category.
The first returned value is the long description or null, if not available. It’s used for the description part in the message detail field.
The second returned value is the short description or an empty string, if not available. It’s used for the summary column message table.
message
- message or message categorypublic static java.lang.String[] getKeySignature(byte sharpsOrFlats, byte tonality)
Returns the note and tonality of a KEY_SIGNATURE message like it’s used in MidicaPL format.
Example:
In standard configuration, getKeySignature(0, 1) returns [“c”, “maj”].
If note or tonality cannot be found out, both returned values are empty strings.
sharpsOrFlats
- number of sharps or flatstonality
- tonality byte from the messageprivate static final java.lang.String getNoteString(byte number, int channel)
Returns the configured note name or percussion IDs by number and channel.
number
- MIDI numberchannel
- MIDI channelpublic static final SingleMessage processShortMessage(javax.sound.midi.ShortMessage msg, long tick, int trackNum, int msgNum, java.util.ArrayList<SingleMessage> messages, MidicaTreeModel msgTreeModel) throws java.lang.ReflectiveOperationException
Retrieves general information from short messages.
SingleMessage
to the given messages list.msg
- Short messagetick
- TickstamptrackNum
- Track number (beginning with 0).msgNum
- Number of the message inside the track.messages
- List of messages where the processed message will be added.msgTreeModel
- Tree model where the created leaf note will be added.java.lang.ReflectiveOperationException
- if the message cannot be added to the tree model.public static final SingleMessage processMetaMessage(javax.sound.midi.MetaMessage msg, long tick, int trackNum, int msgNum, java.util.ArrayList<SingleMessage> messages, MidicaTreeModel msgTreeModel, java.lang.String chosenCharset, java.lang.String midiFileCharset) throws java.lang.ReflectiveOperationException
Retrieves general information from meta messages.
SingleMessage
to the given messages list.msg
- Meta messagetick
- TickstamptrackNum
- Track number (beginning with 0).msgNum
- Number of the message inside the track.messages
- List of messages where the processed message will be added.msgTreeModel
- Tree model where the created leaf note will be added.chosenCharset
- Charset that has been chosen with the file chooser.midiFileCharset
- The last charset from a charset switch inside of a lyrics message.java.lang.ReflectiveOperationException
- if the message cannot be added to the tree model.public static final SingleMessage processSysexMessage(javax.sound.midi.SysexMessage msg, long tick, int trackNum, int msgNum, java.util.ArrayList<SingleMessage> messages, MidicaTreeModel msgTreeModel) throws java.lang.ReflectiveOperationException
Retrieves general information from SysEx messages.
SingleMessage
to the given messages list.msg
- SysEx messagetick
- TickstamptrackNum
- Track number (beginning with 0).msgNum
- Number of the message inside the track.messages
- List of messages where the processed message will be added.msgTreeModel
- Tree model where the created leaf note will be added.java.lang.ReflectiveOperationException
- if the message cannot be added to the tree model.private static final java.lang.String getLvl2SystemMsgTxtByStatusByte(int status)
Returns the level 2 message name of system common and system realtime messages by status byte.
status
- Status byte of the message.private static final java.lang.String getLvl2MetaText(int type)
Returns the level 2 message name of META messages.
type
- Second byte of the message.private static final java.lang.String getLvl2VoiceMsgTxtByCommand(int cmd)
Returns the level 2 message name of channel voice messages by message command.
The command contains the first 4 bits of the status byte.
cmd
- Command of the voice message.private static final java.lang.String getLvl2ModeMsgTxtByData1(int val)
Returns the level 2 command of a channel mode message. The status is the same as a channel voice / control change message. So this has to be determined by the (given) first data value.
val
- First data byte of the message.private static final java.lang.String[] getLvl34ControllerMsgTxtByData1(int val)
Returns the level 3 and 4 node names of control change messages. A level 4 node name is only added for controllers that have an MSB and LSB.
The returned array consists of:
val
- First data byte of the message.private static final java.lang.String[] getLvl4RpnNrpnDataTxt(byte msb, byte lsb, byte type)
Returns the level 4 message fields for the tree node of Data entry/increment/decrement messages. These messages affect the last set (N)RPN of the given channel.
The following strings are returned:
msb
- The MSB of the (N)RPN.lsb
- The LSB of the (N)RPN.type
- 1 for RPN, 0 for NRPN, -1 for noneprivate static final java.lang.String[] getLvl456UniversalSysexTxt(boolean isRealTime, int sub1, int sub2)
Returns the level 4, 5, and 6 node names of universal SysEx messages.
A level 5 or 6 node name is not always available - depending on the given Sub-ID 1.
The returned array consists of 1, 3 or 4 elements:
The 2nd and 3rd element are only returned if Sub-ID 1 allows a sub type.
The 4th element is only available for MIDI-CI messages.
isRealTime
- true for Real Time messages, false for Non Real Time messages.sub1
- Sub-ID 1 (4th byte of the message)sub2
- Sub-ID 2 (5th byte of the message)private static final java.lang.String getVendorName(java.lang.String vendorNum)
Returns the vendor name for the given vendor number.
The given vendor number can be one of the following:
vendorNum
- The vendor number as described above.