| 1 | 13 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use Feature::Compat::Class; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # ABSTRACT: MIDI event base class | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 13 | ▶ | use experimental qw/ signatures /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | package MIDI::Stream::Event; | ||||||||||||||||||||||||||||
| 11 | class MIDI::Stream::Event; | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 13 | our $VERSION = '0.006'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 13 | ▶ | use Carp qw/ croak /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 13 | ▶ | use MIDI::Stream::Tables qw/ status_name keys_for /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 13 | field $name :reader; | |||||||||||||||||||||||||||
| 20 | 13 | field $message :reader :param; | |||||||||||||||||||||||||||
| 21 | 13 | field $dt :reader :param; | |||||||||||||||||||||||||||
| 22 | 13 | field $bytes; | |||||||||||||||||||||||||||
| 23 | 13 | field $status :reader; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | method bytes { | ||||||||||||||||||||||||||
|
Subroutine
bytes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | $bytes //= join '', map { chr } $message->@*; | ||||||||||||||||||||||||||
|
Condition0%0/2
$bytes //= join("", map({chr $_;} @$message))
MC/DC0%0/1
$bytes //= join("", map({chr $_;} @$message))
$bytes
Truth table0%0/2
A
A= $bytes
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 116 | ▶ | method as_hashref { | ||||||||||||||||||||||||||
|
Subroutine
as_hashref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | +{ | ||||||||||||||||||||||||||||
| 33 | 116 | map { $_ => $self->$_ } | |||||||||||||||||||||||||||
| 34 | ( 'name', keys_for( $self->name )->@* ) | ||||||||||||||||||||||||||||
| 35 | }; | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 116 | ▶ | method TO_JSON { $self->as_hashref }; | ||||||||||||||||||||||||||
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 31 | ▶ | method as_arrayref { | ||||||||||||||||||||||||||
|
Subroutine
as_arrayref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | [ | ||||||||||||||||||||||||||||
| 44 | $self->name => | ||||||||||||||||||||||||||||
| 45 | 31 | map { $self->$_ } keys_for( $self->name )->@* | |||||||||||||||||||||||||||
| 46 | ] | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 179 | ▶ | ADJUST { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 50 | 179 | ▶ | $name = status_name( $message->[0] ) // 'unknown'; | ||||||||||||||||||||||||||
|
Condition50%1/2
status_name($message->[0]) // "unknown"
MC/DC0%0/1
status_name($message->[0]) // "unknown"
status_name($message->[0])
Truth table50%1/2
A
A= status_name($message->[0])
| |||||||||||||||||||||||||||||
| 51 | 179 | $status = $message->[0]; | |||||||||||||||||||||||||||
| 52 | # note on with velocity 0 is note off | ||||||||||||||||||||||||||||
| 53 | 179 | ▶ | $name = 'note_off' if $status < 0xa0 && !$message->[2]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$status < 160 and not $message->[2]
MC/DC100%2/2
$status < 160 and not $message->[2]
$status < 160
not $message->[2]
Truth table100%3/3
A and not(B)
A= $status < 160B= not $message->[2]
| |||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 13 | 1; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||