javax.sound.midi

Class ShortMessage

  • All Implemented Interfaces:
    Cloneable

    public class ShortMessage
    extends MidiMessage
    A ShortMessage contains a MIDI message that has at most two data bytes following its status byte. The types of MIDI message that satisfy this criterion are channel voice, channel mode, system common, and system real-time--in other words, everything except system exclusive and meta-events. The ShortMessage class provides methods for getting and setting the contents of the MIDI message.

    A number of ShortMessage methods have integer parameters by which you specify a MIDI status or data byte. If you know the numeric value, you can express it directly. For system common and system real-time messages, you can often use the corresponding fields of ShortMessage, such as SYSTEM_RESET. For channel messages, the upper four bits of the status byte are specified by a command value and the lower four bits are specified by a MIDI channel number. To convert incoming MIDI data bytes that are in the form of Java's signed bytes, you can use the conversion code given in the MidiMessage class description.

    See Also:
    SysexMessage, MetaMessage
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int ACTIVE_SENSING
      Status byte for Active Sensing message (0xFE, or 254).
      static int CHANNEL_PRESSURE
      Command value for Channel Pressure (Aftertouch) message (0xD0, or 208)
      static int CONTINUE
      Status byte for Continue message (0xFB, or 251).
      static int CONTROL_CHANGE
      Command value for Control Change message (0xB0, or 176)
      static int END_OF_EXCLUSIVE
      Status byte for End of System Exclusive message (0xF7, or 247).
      static int MIDI_TIME_CODE
      Status byte for MIDI Time Code Quarter Frame message (0xF1, or 241).
      static int NOTE_OFF
      Command value for Note Off message (0x80, or 128)
      static int NOTE_ON
      Command value for Note On message (0x90, or 144)
      static int PITCH_BEND
      Command value for Pitch Bend message (0xE0, or 224)
      static int POLY_PRESSURE
      Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or 160)
      static int PROGRAM_CHANGE
      Command value for Program Change message (0xC0, or 192)
      static int SONG_POSITION_POINTER
      Status byte for Song Position Pointer message (0xF2, or 242).
      static int SONG_SELECT
      Status byte for MIDI Song Select message (0xF3, or 243).
      static int START
      Status byte for Start message (0xFA, or 250).
      static int STOP
      Status byte for Stop message (0xFC, or 252).
      static int SYSTEM_RESET
      Status byte for System Reset message (0xFF, or 255).
      static int TIMING_CLOCK
      Status byte for Timing Clock messagem (0xF8, or 248).
      static int TUNE_REQUEST
      Status byte for Tune Request message (0xF6, or 246).

      Erste Seite von API Java Inhaltsverzeichnis Haut

      • Fields inherited from class javax.sound.midi.MidiMessage

        data, length
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
        ShortMessage()
      Constructs a new ShortMessage.
      protected ShortMessage(byte[] data)
      Constructs a new ShortMessage.
        ShortMessage(int status)
      Constructs a new ShortMessage which represents a MIDI message that takes no data bytes.
        ShortMessage(int status, int data1, int data2)
      Constructs a new ShortMessage which represents a MIDI message that takes up to two data bytes.
        ShortMessage(int command, int channel, int data1, int data2)
      Constructs a new ShortMessage which represents a channel MIDI message that takes up to two data bytes.

      Erste Seite von API Java Inhaltsverzeichnis Haut

    • 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.
      int getChannel()
      Obtains the MIDI channel associated with this event.
      int getCommand()
      Obtains the MIDI command associated with this event.
      int getData1()
      Obtains the first data byte in the message.
      int getData2()
      Obtains the second data byte in the message.
      protected int getDataLength(int status)
      Retrieves the number of data bytes associated with a particular status byte value.
      void setMessage(int status)
      Sets the parameters for a MIDI message that takes no data bytes.
      void setMessage(int status, int data1, int data2)
      Sets the parameters for a MIDI message that takes one or two data bytes.
      void setMessage(int command, int channel, int data1, int data2)
      Sets the short message parameters for a channel message which takes up to two data bytes.

      Erste Seite von API Java Inhaltsverzeichnis Haut

    • Constructor Detail

      • ShortMessage

        public ShortMessage()
        Constructs a new ShortMessage. 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 the setMessage methods.
        See Also:
        setMessage(int)
      • ShortMessage

        public ShortMessage(int command,
                    int channel,
                    int data1,
                    int data2)
                     throws InvalidMidiDataException
        Constructs a new ShortMessage which represents a channel MIDI message that takes up to two data bytes. If the message only takes one data byte, the second data byte is ignored. If the message does not take any data bytes, both data bytes are ignored. The contents of the message can be changed by using one of the setMessage methods.
        Parameters:
        command - the MIDI command represented by this message
        channel - the channel associated with the message
        data1 - the first data byte
        data2 - the second data byte
        Throws:
        InvalidMidiDataException - if the command value, channel value or all data bytes belonging to the message do not specify a valid MIDI message
        Since:
        1.7
        See Also:
        setMessage(int), setMessage(int, int, int), setMessage(int, int, int, int), getCommand(), getChannel(), getData1(), getData2()
      • ShortMessage

        protected ShortMessage(byte[] data)
        Constructs a new ShortMessage.
        Parameters:
        data - an array of bytes containing the complete message. The message data may be changed using the setMessage method.
        See Also:
        setMessage(int)
    • Method Detail

      • setMessage

        public void setMessage(int status,
                      int data1,
                      int data2)
                        throws InvalidMidiDataException
        Sets the parameters for a MIDI message that takes one or two data bytes. If the message takes only one data byte, the second data byte is ignored; if the message does not take any data bytes, both data bytes are ignored.
        Parameters:
        status - the MIDI status byte
        data1 - the first data byte
        data2 - the second data byte
        Throws:
        InvalidMidiDataException - if the the status byte, or all data bytes belonging to the message, do not specify a valid MIDI message.
        InvalidMidiDataException
        See Also:
        setMessage(int, int, int, int), setMessage(int)
      • setMessage

        public void setMessage(int command,
                      int channel,
                      int data1,
                      int data2)
                        throws InvalidMidiDataException
        Sets the short message parameters for a channel message which takes up to two data bytes. If the message only takes one data byte, the second data byte is ignored; if the message does not take any data bytes, both data bytes are ignored.
        Parameters:
        command - the MIDI command represented by this message
        channel - the channel associated with the message
        data1 - the first data byte
        data2 - the second data byte
        Throws:
        InvalidMidiDataException - if the status byte or all data bytes belonging to the message, do not specify a valid MIDI message
        InvalidMidiDataException
        See Also:
        setMessage(int, int, int), setMessage(int), getCommand(), getChannel(), getData1(), getData2()
      • getChannel

        public int getChannel()
        Obtains the MIDI channel associated with this event. This method assumes that the event is a MIDI channel message; if not, the return value will not be meaningful.
        Returns:
        MIDI channel associated with the message.
        See Also:
        setMessage(int, int, int, int)
      • getCommand

        public int getCommand()
        Obtains the MIDI command associated with this event. This method assumes that the event is a MIDI channel message; if not, the return value will not be meaningful.
        See Also:
        setMessage(int, int, int, int)
      • getData1

        public int getData1()
        Obtains the first data byte in the message.
        Returns:
        the value of the data1 field
        See Also:
        setMessage(int, int, int)
      • getData2

        public int getData2()
        Obtains the second data byte in the message.
        Returns:
        the value of the data2 field
        See Also:
        setMessage(int, int, int)
      • clone

        public Object clone()
        Creates a new object of the same class and with the same contents as this object.
        Specified by:
        clone in class MidiMessage
        Returns:
        a clone of this instance.
        See Also:
        Cloneable
      • getDataLength

        protected final int getDataLength(int status)
                                   throws InvalidMidiDataException
        Retrieves the number of data bytes associated with a particular status byte value.
        Parameters:
        status - status byte value, which must represent a short MIDI message
        Returns:
        data length in bytes (0, 1, or 2)
        Throws:
        InvalidMidiDataException - if the status argument does not represent the status byte for any short message
        InvalidMidiDataException

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/sound/midi/shortmessage.html/.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut