| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
13
|
|
|
13
|
|
172
|
use v5.26; |
|
|
13
|
|
|
|
|
48
|
|
|
2
|
13
|
|
|
13
|
|
65
|
use warnings; |
|
|
13
|
|
|
|
|
44
|
|
|
|
13
|
|
|
|
|
933
|
|
|
3
|
13
|
|
|
13
|
|
79
|
use Feature::Compat::Class; |
|
|
13
|
|
|
|
|
21
|
|
|
|
13
|
|
|
|
|
87
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: MIDI event base class |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
13
|
|
|
13
|
|
1866
|
use experimental qw/ signatures /; |
|
|
13
|
|
|
|
|
22
|
|
|
|
13
|
|
|
|
|
82
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package MIDI::Stream::Event; |
|
11
|
|
|
|
|
|
|
class MIDI::Stream::Event; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
13
|
|
|
13
|
|
1349
|
use Carp qw/ croak /; |
|
|
13
|
|
|
|
|
38
|
|
|
|
13
|
|
|
|
|
796
|
|
|
16
|
13
|
|
|
13
|
|
64
|
use MIDI::Stream::Tables qw/ status_name keys_for /; |
|
|
13
|
|
|
|
|
19
|
|
|
|
13
|
|
|
|
|
8765
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
field $name :reader; |
|
20
|
|
|
|
|
|
|
field $message :reader :param; |
|
21
|
|
|
|
|
|
|
field $dt :reader :param; |
|
22
|
|
|
|
|
|
|
field $bytes; |
|
23
|
|
|
|
|
|
|
field $status :reader; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
method bytes { |
|
27
|
|
|
|
|
|
|
$bytes //= join '', map { chr } $message->@*; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
method as_hashref { |
|
32
|
|
|
|
|
|
|
+{ |
|
33
|
|
|
|
|
|
|
map { $_ => $self->$_ } |
|
34
|
|
|
|
|
|
|
( 'name', keys_for( $self->name )->@* ) |
|
35
|
|
|
|
|
|
|
}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
method TO_JSON { $self->as_hashref }; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
method as_arrayref { |
|
43
|
|
|
|
|
|
|
[ |
|
44
|
|
|
|
|
|
|
$self->name => |
|
45
|
|
|
|
|
|
|
map { $self->$_ } keys_for( $self->name )->@* |
|
46
|
|
|
|
|
|
|
] |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
ADJUST { |
|
50
|
|
|
|
|
|
|
$name = status_name( $message->[0] ) // 'unknown'; |
|
51
|
|
|
|
|
|
|
$status = $message->[0]; |
|
52
|
|
|
|
|
|
|
# note on with velocity 0 is note off |
|
53
|
|
|
|
|
|
|
$name = 'note_off' if $status < 0xa0 && !$message->[2]; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |