| 1 | package MIDI::RtController::Filter::CC; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | our $AUTHORITY = 'cpan:GENE'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: Control-change based RtController filters | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.1407'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use strictures 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use curry; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use IO::Async::Timer::Countdown (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use IO::Async::Timer::Periodic (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Iterator::Breathe (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Types::MIDI qw(Velocity); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use Types::Common::Numeric qw(PositiveNum); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use Types::Standard qw(Maybe Int); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use constant KNOWN_FILTERS => qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | single clock_it breathe scatter stair_step ramp_up ramp_down flicker threshold program_change | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | extends 'MIDI::RtController::Filter'; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | has control => ( | |||||||||||||||||||||||||||||||||||||||||
| 30 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 31 | isa => Velocity, # no CC# in Types::MIDI yet | ||||||||||||||||||||||||||||||||||||||||||
| 32 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | has initial_point => ( | |||||||||||||||||||||||||||||||||||||||||
| 37 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | default => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | has range_bottom => ( | |||||||||||||||||||||||||||||||||||||||||
| 44 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | default => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | has range_top => ( | |||||||||||||||||||||||||||||||||||||||||
| 51 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | default => 127, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | has range_step => ( | |||||||||||||||||||||||||||||||||||||||||
| 58 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 59 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | has time_step => ( | |||||||||||||||||||||||||||||||||||||||||
| 65 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 66 | isa => PositiveNum, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | default => 0.25, | ||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | has step_up => ( | |||||||||||||||||||||||||||||||||||||||||
| 72 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 73 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | default => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | has step_down => ( | |||||||||||||||||||||||||||||||||||||||||
| 79 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 80 | isa => Velocity, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub add_filters ($filters, $controllers) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_filters: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | for my $orig (@$filters) { | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my %params = %$orig; # work on a copy | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $port = delete $params{port}; | |||||||||||||||||||||||||||||||||||||||||
| 89 | # skip unnamed and unknown entries | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | next if !$port || !exists $controllers->{$port}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$port and exists $controllers->{$port}
MC/DC0%0/2
$port and exists $controllers->{$port}
$port
exists $controllers->{$port}
Truth table0%0/3
A and B
A= $portB= exists $controllers->{$port}
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $type = delete $params{type} || 'single'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $params{'type'} || 'single'
MC/DC0%0/1
delete $params{'type'} || 'single'
delete $params{'type'}
Truth table0%0/2
A
A= delete $params{'type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | croak qq{Unknown filter type "$type" (must be one of: } . join(', ', KNOWN_FILTERS) . ')' | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | unless grep { $_ eq $type } KNOWN_FILTERS; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my $event = delete $params{event} || 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $params{'event'} || 'all'
MC/DC0%0/1
delete $params{'event'} || 'all'
delete $params{'event'}
Truth table0%0/2
A
A= delete $params{'event'}
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | my $filter = __PACKAGE__->new( | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | rtc => $controllers->{$port} | |||||||||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # assume all remaining key/values are module attributes | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | for my $param (keys %params) { | |||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $filter->$param( $params{$param} ); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $method = "curry::$type"; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $controllers->{$port}->add_filter($type, $event => $filter->$method); | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub single ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
single: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my $value = $self->value // $val; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->value // $val
MC/DC0%0/2
$self->value // $val
$self->value
$val
Truth table0%0/3
A // B
A= $self->valueB= $val
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub clock_it ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clock_it: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my ($ev, $chan) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->rtc->send_it(['start']); | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 130 | IO::Async::Timer::Periodic->new( | ||||||||||||||||||||||||||||||||||||||||||
| 131 | interval => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | on_tick => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->rtc->send_it(['stop']); | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $self->rtc->send_it(['clock']); | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub breathe ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
breathe: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $it = Iterator::Breathe->new( | |||||||||||||||||||||||||||||||||||||||||
| 163 | bottom => $self->range_bottom, | ||||||||||||||||||||||||||||||||||||||||||
| 164 | top => $self->range_top, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | step => $self->range_step, | ||||||||||||||||||||||||||||||||||||||||||
| 166 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 169 | IO::Async::Timer::Periodic->new( | ||||||||||||||||||||||||||||||||||||||||||
| 170 | interval => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | on_tick => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $it->iterate; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $it->i ]; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 186 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub scatter ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scatter: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $value = $self->initial_point; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my @values = ($self->range_bottom .. $self->range_top); | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 206 | IO::Async::Timer::Periodic->new( | ||||||||||||||||||||||||||||||||||||||||||
| 207 | interval => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | on_tick => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $value = $values[ int rand @values ]; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 223 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub stair_step ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stair_step: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $it = Iterator::Breathe->new( | |||||||||||||||||||||||||||||||||||||||||
| 240 | bottom => $self->range_bottom, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | top => $self->range_top, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $value = $self->initial_point; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $direction = 1; # up | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 248 | IO::Async::Timer::Periodic->new( | ||||||||||||||||||||||||||||||||||||||||||
| 249 | interval => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | on_tick => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | # compute the stair-stepping | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if ($direction) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $it->step($self->step_up); | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $it->step(- $self->step_down); | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | # toggle the stair-step direction | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $direction = !$direction; | |||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | # iterate the breathing | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $it->iterate; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $value = $it->i; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $value = $self->range_top if $value >= $self->range_top; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $value = $self->range_bottom if $value <= $self->range_bottom; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 281 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | sub ramp_up ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ramp_up: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $value = $self->initial_point; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 299 | IO::Async::Timer::Countdown->new( | ||||||||||||||||||||||||||||||||||||||||||
| 300 | delay => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | on_expire => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $value += $self->range_step; | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | if ($value > $self->range_top) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $c->start; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 326 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub ramp_down ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ramp_down: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $value = $self->initial_point; | |||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 345 | IO::Async::Timer::Countdown->new( | ||||||||||||||||||||||||||||||||||||||||||
| 346 | delay => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | on_expire => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $value -= $self->range_step; | |||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($value < $self->range_bottom) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | $c->start; | |||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 372 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | sub flicker ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flicker: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | return 0 if $self->running; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $self->running(1); | |||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $value = $self->range_bottom; | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | $self->rtc->loop->add( | ||||||||||||||||||||||||||||||||||||||||||
| 391 | IO::Async::Timer::Countdown->new( | ||||||||||||||||||||||||||||||||||||||||||
| 392 | delay => $self->time_step, | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | on_expire => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ($self->halt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $c->stop; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $self->rtc->loop->remove($c); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $self->running(0); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $self->halt(0); | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | my $cc = [ 'control_change', $self->channel, $self->control, $value ]; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $self->rtc->send_it($cc); | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | $value = $value == $self->range_top ? $self->range_bottom : $self->range_top; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $c->start; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | )->start | |||||||||||||||||||||||||||||||||||||||||
| 409 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub threshold ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threshold: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | return 0 unless defined $self->trigger && defined $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->trigger and defined $val
MC/DC0%0/2
defined $self->trigger and defined $val
defined $self->trigger
defined $val
Truth table0%0/3
A and B
A= defined $self->triggerB= defined $val
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | my $above_only = $self->step_up && !$self->step_down; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->step_up && !$self->step_down
MC/DC0%0/2
$self->step_up && !$self->step_down
$self->step_up
!$self->step_down
Truth table0%0/3
A && not(B)
A= $self->step_upB= !$self->step_down
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | my $below_only = $self->step_down && !$self->step_up; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->step_down && !$self->step_up
MC/DC0%0/2
$self->step_down && !$self->step_up
$self->step_down
!$self->step_up
Truth table0%0/3
A && not(B)
A= $self->step_downB= !$self->step_up
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if ($above_only && $val <= $self->trigger) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$above_only and $val <= $self->trigger
MC/DC0%0/2
$above_only and $val <= $self->trigger
$above_only
$val <= $self->trigger
Truth table0%0/3
A and B
A= $above_onlyB= $val <= $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return 1; # block: only notes above the trigger are allowed | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | if ($below_only && $val >= $self->trigger) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$below_only and $val >= $self->trigger
MC/DC0%0/2
$below_only and $val >= $self->trigger
$below_only
$val >= $self->trigger
Truth table0%0/3
A and B
A= $below_onlyB= $val >= $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return 1; # block: only notes below the trigger are allowed | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | say "Sending $note" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $msg = [ $ev, $self->channel, $note, $val ]; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $self->rtc->send_it($msg); | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | sub program_change ($self, $device, $dt, $event) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program_change: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my ($ev, $chan, $note, $val) = $event->@*; | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | return 0 if defined $self->trigger && defined $note && $note != $self->trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger and defined $note
MC/DC0%0/3
defined $self->trigger and defined $note and $note != $self->trigger
defined $self->trigger
defined $note
$note != $self->trigger
Truth table0%0/4
A and B and C
A= defined $self->triggerB= defined $noteC= $note != $self->trigger
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | return 0 if defined $self->value && defined $val && $val != $self->value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->value and defined $val and $val != $self->value
defined $self->value and defined $val
MC/DC0%0/3
defined $self->value and defined $val and $val != $self->value
defined $self->value
defined $val
$val != $self->value
Truth table0%0/4
A and B and C
A= defined $self->valueB= defined $valC= $val != $self->value
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $program = $self->value; | |||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | say "Program change: $program" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $self->rtc->send_it([ 'patch_change', $self->channel, $program ]); | |||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return $self->continue; | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | __END__ | ||||||||||||||||||||||||||||||||||||||||||