jdk/src/share/classes/javax/sound/midi/ShortMessage.java
changeset 2651 c6612086e8c9
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
2650:44d88464a573 2651:c6612086e8c9
   183         // Default message data: NOTE_ON on Channel 0 with max volume
   183         // Default message data: NOTE_ON on Channel 0 with max volume
   184         data[0] = (byte) (NOTE_ON & 0xFF);
   184         data[0] = (byte) (NOTE_ON & 0xFF);
   185         data[1] = (byte) 64;
   185         data[1] = (byte) 64;
   186         data[2] = (byte) 127;
   186         data[2] = (byte) 127;
   187         length = 3;
   187         length = 3;
       
   188     }
       
   189 
       
   190     /**
       
   191      * Constructs a new {@code ShortMessage} which represents a MIDI
       
   192      * message that takes no data bytes.
       
   193      * The contents of the message can be changed by using one of
       
   194      * the {@code setMessage} methods.
       
   195      *
       
   196      * @param status the MIDI status byte
       
   197      * @throws InvalidMidiDataException if {@code status} does not specify
       
   198      *     a valid MIDI status byte for a message that requires no data bytes
       
   199      * @see #setMessage(int)
       
   200      * @see #setMessage(int, int, int)
       
   201      * @see #setMessage(int, int, int, int)
       
   202      * @see #getStatus()
       
   203      * @since 1.7
       
   204      */
       
   205     public ShortMessage(int status) throws InvalidMidiDataException {
       
   206         super(null);
       
   207         setMessage(status); // can throw InvalidMidiDataException
       
   208     }
       
   209 
       
   210     /**
       
   211      * Constructs a new {@code ShortMessage} which represents a MIDI message
       
   212      * that takes up to two data bytes. If the message only takes one data byte,
       
   213      * the second data byte is ignored. If the message does not take
       
   214      * any data bytes, both data bytes are ignored.
       
   215      * The contents of the message can be changed by using one of
       
   216      * the {@code setMessage} methods.
       
   217      *
       
   218      * @param status   the MIDI status byte
       
   219      * @param data1    the first data byte
       
   220      * @param data2    the second data byte
       
   221      * @throws InvalidMidiDataException if the status byte or all data bytes
       
   222      *     belonging to the message do not specify a valid MIDI message
       
   223      * @see #setMessage(int)
       
   224      * @see #setMessage(int, int, int)
       
   225      * @see #setMessage(int, int, int, int)
       
   226      * @see #getStatus()
       
   227      * @see #getData1()
       
   228      * @see #getData2()
       
   229      * @since 1.7
       
   230      */
       
   231     public ShortMessage(int status, int data1, int data2)
       
   232             throws InvalidMidiDataException {
       
   233         super(null);
       
   234         setMessage(status, data1, data2); // can throw InvalidMidiDataException
       
   235     }
       
   236 
       
   237     /**
       
   238      * Constructs a new {@code ShortMessage} which represents a channel
       
   239      * MIDI message that takes up to two data bytes. If the message only takes
       
   240      * one data byte, the second data byte is ignored. If the message does not
       
   241      * take any data bytes, both data bytes are ignored.
       
   242      * The contents of the message can be changed by using one of
       
   243      * the {@code setMessage} methods.
       
   244      *
       
   245      * @param command  the MIDI command represented by this message
       
   246      * @param channel  the channel associated with the message
       
   247      * @param data1    the first data byte
       
   248      * @param data2    the second data byte
       
   249      * @throws InvalidMidiDataException if the command value, channel value
       
   250      *     or all data bytes belonging to the message do not specify
       
   251      *     a valid MIDI message
       
   252      * @see #setMessage(int)
       
   253      * @see #setMessage(int, int, int)
       
   254      * @see #setMessage(int, int, int, int)
       
   255      * @see #getCommand()
       
   256      * @see #getChannel()
       
   257      * @see #getData1()
       
   258      * @see #getData2()
       
   259      * @since 1.7
       
   260      */
       
   261     public ShortMessage(int command, int channel, int data1, int data2)
       
   262             throws InvalidMidiDataException {
       
   263         super(null);
       
   264         setMessage(command, channel, data1, data2);
   188     }
   265     }
   189 
   266 
   190 
   267 
   191     /**
   268     /**
   192      * Constructs a new <code>ShortMessage</code>.
   269      * Constructs a new <code>ShortMessage</code>.