NAME
MIDI::XML::MidiChannelPrefix - MIDI ChannelPrefix messages.
SYNOPSIS
use MIDI::XML::MidiChannelPrefix;
$Channel_Prefix = MIDI::XML::MidiChannelPrefix->new();
$Channel_Prefix->delta(0);
$Channel_Prefix->channel(4);
@event = $Channel_Prefix->as_event();
$midi_track = MIDI::Track->new();
push( @{$midi_track->events_r},\@event;
@xml = $Channel_Prefix->as_MidiXML();
print join("\n",@xml);
DESCRIPTION
MIDI::XML::MidiChannelPrefix is a class encapsulating MIDI Channel Prefix meta messages. A Channel Prefix message includes either a delta time or absolute time as implemented by MIDI::XML::Message and the MIDI Sequence Number event encoded in 4 bytes as follows:
0xFF 0x20 0x01 0xnn
nn = channel number
EXPORT
None.
METHODS AND ATTRIBUTES
- $Channel_Prefix = MIDI::XML::MidiChannelPrefix->new()
-
This creates a new MIDI::XML::MidiChannelPrefix object.
- $Channel_Prefix = MIDI::XML::MidiChannelPrefix->new($event);
-
Creates a new MidiChannelPrefix object initialized with the values of a MIDI::Event midi_channel_prefix array.
- $delta_time = $Channel_Prefix->delta() or $Channel_Prefix->delta($delta_time);
-
Returns the message time as a delta time or undef if it is an absolute time. Optionally sets the message time to the specified delta time. To avoid contradictory times, the absolute time is set to undef when a delta time is set.
This functionality is provided by the MIDI::XML::Message base class.
- $absolute_time = $Channel_Prefix->absolute() or $Channel_Prefix->absolute($absolute_time);
-
Returns the message time as an absolute time or undef if it is a delta time. Optionally sets the message time to the specified absolute time. To avoid contradictory times, the delta time is set to undef when an absolute time is set. The absolute time should be zero according to the specification.
This functionality is provided by the MIDI::XML::Message base class.
- $time = $Channel_Prefix->time();
-
Returns the message time, absolute or delta, whichever was last set.
This functionality is provided by the MIDI::XML::Message base class.
- $channel = $Channel_Prefix->channel() or $Channel_Prefix->channel($channel);
-
Returns and optionally sets the channel number.
- $ordinal = $Channel_Prefix->ordinal();
-
Returns a value to be used to order events that occur at the same time.
- @event = $Channel_Prefix->as_event();
-
Returns a MIDI::Event midi_channel_prefix array initialized with the values of the MidiChannelPrefix object. MIDI::Event does not expect absolute times and will interpret them as delta times. Calling this method when the time is absolute will not generate a warning or error but it is unlikely that the results will be satisfactory.
- @xml = $Channel_Prefix->as_MidiXML();
-
Returns an array of elements formatted according to the MidiXML DTD. These elements may be assembled by track into entire documents with the following suggested DOCTYPE declaration:
<!DOCTYPE MIDI PUBLIC "-//Recordare//DTD MusicXML 0.7 MIDI//EN" "http://www.musicxml.org/dtds/midixml.dtd">
AUTHOR
Brian M. Ames, <bmames@apk.net>
SEE ALSO
COPYRIGHT and LICENSE
Copyright 2002 Brian M. Ames. This software may be used under the terms of the GPL and Artistic licenses, the same as Perl itself.