Class: MIDIPacket

Environment: Siren
Superclass: Object
Category: MusicIO-MIDI
Instance variables: length time flags duration data
Imports: private MIDICommands.*

A MIDIPacket represents a simple MIDI datagram with a time-stamp and a data array.

Instance Variables
data The MIDI data bytes (may include a MIDI command and running status messages)
length The number of meaningful bytes in the data
time The msec timestamp when the packet was created or received.
flags Any 'flags' received from the MIDI driver.
duration my event's length

Pool dictionaries:
MIDICommands octet)> e.g., (#noteOn -> 16r90)
(It is initialized by class MIDIPort.)

See the class comment in MIDIPort for details.

accessing

ampl
Answer the receiver's MIDI velocity.

ampl: a
Set the receiver's MIDI velocity.

channel
Answer the receiver's MIDI channel.

command
Answer the receiver's MIDI command nibble.

data
Answer the receiver's 'data' byte array.

data: anObject
Set the receiver's instance variable 'data' to be anObject.

duration
Answer the receiver's duration.

duration: d
Set the receiver's duration.

key
Answer the receiver's MIDI key number.

key: k
Set the receiver's MIDI key number.

length
Answer the receiver's 'length'.

length: anObject
Set the receiver's instance variable 'length' to be anObject.

pitch
Answer the receiver's MIDI key number.

pitch: aValue
Set the receiver's MIDI key number.

second: aValue
Set the receiver's MIDI key number.

setPitch: p dur: d loudness: vol
Answer an instance of the class with the given parameters.

status: s
Set the receiver's MIDI command.

third: aValue
Set the receiver's MIDI key velocity.

time
Answer the receiver's 'time'.

time: anObject
Set the receiver's instance variable 'time' to be anObject.

vel
Answer the receiver's MIDI velocity.

vel: v
Set the receiver's MIDI velocity.

voice
Answer the receiver's MIDI channel.

voice: v
Set the receiver's MIDI channel.

printing

print: x on: aStream
Store a two-digit hexadecimal version of the 8-bit argument x on the stream.

printOn: aStream
Store a readable version of the receiver on the argument.

initialize release

initialize
Set the receiver's time stamp

MetaClass: MIDIPacket class

instance creation

bytesFor14BitValue: val
Answer a two-element array with the 14-bit values that correspond to the given value.

fromBytes: aByteArray
Answer a new instance of a MIDI packet instantiated from the given byte array.

fromInt: anInt at: aTime
Answer a new instance of a MIDI packet instantiated from the given 3-byte long value.

new
Answer a new instance.

new: size
Answer a new instance with a data array of the given size.

setPitch: p dur: d loudness: vol
Answer an instance of the class with the given parameters.