- java.lang.Object
-
- javax.sound.midi.MidiMessage
-
- javax.sound.midi.SysexMessage
-
- All Implemented Interfaces:
- Cloneable
public class SysexMessage extends MidiMessage
ASysexMessage
object represents a MIDI system exclusive message.When a system exclusive message is read from a MIDI file, it always has a defined length. Data from a system exclusive message from a MIDI file should be stored in the data array of a
SysexMessage
as follows: the system exclusive message status byte (0xF0 or 0xF7), all message data bytes, and finally the end-of-exclusive flag (0xF7). The length reported by theSysexMessage
object is therefore the length of the system exclusive data plus two: one byte for the status byte and one for the end-of-exclusive flag.As dictated by the Standard MIDI Files specification, two status byte values are legal for a
SysexMessage
read from a MIDI file:- 0xF0: System Exclusive message (same as in MIDI wire protocol)
- 0xF7: Special System Exclusive message
When Java Sound is used to handle system exclusive data that is being received using MIDI wire protocol, it should place the data in one or more
SysexMessages
. In this case, the length of the system exclusive data is not known in advance; the end of the system exclusive data is marked by an end-of-exclusive flag (0xF7) in the MIDI wire byte stream.- 0xF0: System Exclusive message (same as in MIDI wire protocol)
- 0xF7: End of Exclusive (EOX)
SysexMessage
object containing data for a particular system exclusive message should have the status value 0xF0. If this message contains all the system exclusive data for the message, it should end with the status byte 0xF7 (EOX). Otherwise, additional system exclusive data should be sent in one or moreSysexMessages
with a status value of 0xF7. TheSysexMessage
containing the last of the data for the system exclusive message should end with the value 0xF7 (EOX) to mark the end of the system exclusive message.If system exclusive data from
SysexMessages
objects is being transmitted using MIDI wire protocol, only the initial 0xF0 status byte, the system exclusive data itself, and the final 0xF7 (EOX) byte should be propagated; any 0xF7 status bytes used to indicate that aSysexMessage
contains continuing system exclusive data should not be propagated via MIDI wire protocol.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
SPECIAL_SYSTEM_EXCLUSIVE
Status byte for Special System Exclusive message (0xF7, or 247), which is used in MIDI files.static int
SYSTEM_EXCLUSIVE
Status byte for System Exclusive message (0xF0, or 240).
-
Constructor Summary
Constructors Modifier Constructor and Description SysexMessage()
Constructs a newSysexMessage
.protected
SysexMessage(byte[] data)
Constructs a newSysexMessage
.SysexMessage(byte[] data, int length)
Constructs a newSysexMessage
and sets the data for the message.SysexMessage(int status, byte[] data, int length)
Constructs a newSysexMessage
and sets the data for the message.
-
Method Summary
Methods Modifier and Type Method and Description Object
clone()
Creates a new object of the same class and with the same contents as this object.byte[]
getData()
Obtains a copy of the data for the system exclusive message.void
setMessage(byte[] data, int length)
Sets the data for the system exclusive message.void
setMessage(int status, byte[] data, int length)
Sets the data for the system exclusive message.-
Methods inherited from class javax.sound.midi.MidiMessage
getLength, getMessage, getStatus
-
-
-
-
Field Detail
-
SYSTEM_EXCLUSIVE
public static final int SYSTEM_EXCLUSIVE
Status byte for System Exclusive message (0xF0, or 240).- See Also:
MidiMessage.getStatus()
, Constant Field Values
-
SPECIAL_SYSTEM_EXCLUSIVE
public static final int SPECIAL_SYSTEM_EXCLUSIVE
Status byte for Special System Exclusive message (0xF7, or 247), which is used in MIDI files. It has the same value as END_OF_EXCLUSIVE, which is used in the real-time "MIDI wire" protocol.- See Also:
MidiMessage.getStatus()
, Constant Field Values
-
-
Constructor Detail
-
SysexMessage
public SysexMessage()
Constructs a newSysexMessage
. The contents of the new message are guaranteed to specify a valid MIDI message. Subsequently, you may set the contents of the message using one of thesetMessage
methods.- See Also:
setMessage(byte[], int)
-
SysexMessage
public SysexMessage(byte[] data, int length) throws InvalidMidiDataException
Constructs a newSysexMessage
and sets the data for the message. The first byte of the data array must be a valid system exclusive status byte (0xF0 or 0xF7). The contents of the message can be changed by using one of thesetMessage
methods.- Parameters:
data
- the system exclusive message data including the status bytelength
- the length of the valid message data in the array, including the status byte; it should be non-negative and less than or equal todata.length
- Throws:
InvalidMidiDataException
- if the parameter values do not specify a valid MIDI meta message.- Since:
- 1.7
- See Also:
setMessage(byte[], int)
,setMessage(int, byte[], int)
,getData()
-
SysexMessage
public SysexMessage(int status, byte[] data, int length) throws InvalidMidiDataException
Constructs a newSysexMessage
and sets the data for the message. The contents of the message can be changed by using one of thesetMessage
methods.- Parameters:
status
- the status byte for the message; it must be a valid system exclusive status byte (0xF0 or 0xF7)data
- the system exclusive message data (without the status byte)length
- the length of the valid message data in the array; it should be non-negative and less than or equal todata.length
- Throws:
InvalidMidiDataException
- if the parameter values do not specify a valid MIDI meta message.- Since:
- 1.7
- See Also:
setMessage(byte[], int)
,setMessage(int, byte[], int)
,getData()
-
SysexMessage
protected SysexMessage(byte[] data)
Constructs a newSysexMessage
.- Parameters:
data
- an array of bytes containing the complete message. The message data may be changed using thesetMessage
method.- See Also:
setMessage(byte[], int)
-
-
Method Detail
-
setMessage
public void setMessage(byte[] data, int length) throws InvalidMidiDataException
Sets the data for the system exclusive message. The first byte of the data array must be a valid system exclusive status byte (0xF0 or 0xF7).- Overrides:
setMessage
in classMidiMessage
- Parameters:
data
- the system exclusive message datalength
- the length of the valid message data in the array, including the status byte.- Throws:
InvalidMidiDataException
-
setMessage
public void setMessage(int status, byte[] data, int length) throws InvalidMidiDataException
Sets the data for the system exclusive message.- Parameters:
status
- the status byte for the message (0xF0 or 0xF7)data
- the system exclusive message datalength
- the length of the valid message data in the array- Throws:
InvalidMidiDataException
-
getData
public byte[] getData()
Obtains a copy of the data for the system exclusive message. The returned array of bytes does not include the status byte.- Returns:
- array containing the system exclusive message data.
-
clone
public Object clone()
Creates a new object of the same class and with the same contents as this object.- Specified by:
clone
in classMidiMessage
- Returns:
- a clone of this instance
- See Also:
Cloneable
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/sound/midi/sysexmessage.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.