line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIDI::XML::Message; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
5
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
230
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
MIDI::XML::Channel - Base class for deriving MIDI message classes. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use MIDI::XML::Message; |
18
|
|
|
|
|
|
|
MIDI::XML::Message->as_MidiXML($self); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
MIDI::XML::Message is the base class from which MIDI Message objects are |
23
|
|
|
|
|
|
|
derived. It should not generally be used directly except as shown in the |
24
|
|
|
|
|
|
|
classes for the individual messages. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 EXPORT |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
None. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS AND ATTRIBUTES |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#========================================================================== |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item $delta_time = $Obj->delta() or $Obj->delta($delta_time); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Returns the message time as a delta time or undef if it is an absolute |
41
|
|
|
|
|
|
|
time. Optionally sets the message time to the specified delta time. To |
42
|
|
|
|
|
|
|
avoid contradictory times, the absolute time is set to undef when a delta time |
43
|
|
|
|
|
|
|
is set. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub delta { |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
0
|
0
|
|
|
|
|
if (@_) { |
50
|
0
|
|
|
|
|
|
$self->{'_Delta'} = shift; |
51
|
0
|
|
|
|
|
|
$self->{'_Absolute'} = undef; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
return $self->{'_Delta'}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#========================================================================== |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item $absolute_time = $Obj->absolute() or $Obj->absolute($absolute_time); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns the message time as an absolute time or undef if it is a delta |
61
|
|
|
|
|
|
|
time. Optionally sets the message time to the specified absolute time. To |
62
|
|
|
|
|
|
|
avoid contradictory times, the delta time is set to undef when an absolute time |
63
|
|
|
|
|
|
|
is set. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub absolute { |
68
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
69
|
0
|
0
|
|
|
|
|
if (@_) { |
70
|
0
|
|
|
|
|
|
$self->{'_Absolute'} = shift; |
71
|
0
|
|
|
|
|
|
$self->{'_Delta'} = undef; |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
return $self->{'_Absolute'}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#========================================================================== |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item $time = $Obj->time(); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns the message time, absolute or delta, whichever was last set. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub time { |
85
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
if ( defined($self->{'_Delta'})) { |
|
|
0
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $self->{'_Delta'}; |
89
|
|
|
|
|
|
|
} elsif ( defined($self->{'_Absolute'})) { |
90
|
0
|
|
|
|
|
|
return $self->{'_Absolute'}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
return undef; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#========================================================================== |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item @xml = $Obj->as_MidiXML(); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This method is called by the as_MusicXML methods of derived classes. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns an array of elements formatted according to the MidiXML DTD. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub as_MidiXML { |
109
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
110
|
0
|
|
|
|
|
|
my @xml; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
push @xml, ""; |
114
|
0
|
0
|
|
|
|
|
if ( defined($self->{'_Absolute'})) { |
|
|
0
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
push @xml, "$self->{'_Absolute'}"; |
116
|
|
|
|
|
|
|
} elsif ( defined($self->{'_Delta'})) { |
117
|
0
|
|
|
|
|
|
push @xml, "$self->{'_Delta'}"; |
118
|
|
|
|
|
|
|
} |
119
|
0
|
|
|
|
|
|
push @xml, undef; |
120
|
0
|
|
|
|
|
|
push @xml, ""; |
121
|
0
|
|
|
|
|
|
return @xml; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#========================================================================== |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
return 1; |
128
|
|
|
|
|
|
|
__END__ |