File Coverage

blib/lib/MIDI/Simple/Drummer/Jazz.pm
Criterion Covered Total %
statement 48 78 61.5
branch n/a
condition n/a
subroutine 12 16 75.0
pod 5 5 100.0
total 65 99 65.6


line stmt bran cond sub pod time code
1             package MIDI::Simple::Drummer::Jazz;
2             $MIDI::Simple::Drummer::Jazz::VERSION = '0.0810';
3             our $AUTHORITY = 'cpan:GENE';
4 1     1   909 use strict;
  1         3  
  1         34  
5 1     1   6 use warnings;
  1         2  
  1         33  
6 1     1   493 use parent 'MIDI::Simple::Drummer';
  1         313  
  1         5  
7              
8             sub new {
9 1     1 1 735 my $self = shift;
10 1         9 $self->SUPER::new(
11             -patch => 33,
12             @_
13             );
14             }
15              
16             sub _default_patterns {
17 1     1   2 my $self = shift;
18             return {
19              
20             1 => sub { # Basic swing with no kick or snare.
21 1     1   5 my $self = shift;
22 1         12 for my $beat (1 .. $self->beats) {
23 4         171 $self->note($self->TRIPLET_8TH, $self->ride1);
24 4         237 $self->rest($self->TRIPLET_8TH) for 0 .. 1;
25 4         164 $self->note($self->TRIPLET_8TH, $self->pedal, $self->ride1);
26 4         316 $self->rest($self->TRIPLET_8TH);
27 4         112 $self->note($self->TRIPLET_8TH, $self->ride1);
28             }
29             },
30              
31             2 => sub { # Syncopated swing with kick and snare.
32 0     0   0 my $self = shift;
33 0         0 for my $beat (1 .. $self->beats) {
34 0         0 $self->note($self->TRIPLET_8TH, $self->kick, $self->ride1);
35 0         0 $self->rest($self->TRIPLET_8TH);
36 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
37              
38 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->pedal, $self->ride1);
39 0         0 $self->rest($self->TRIPLET_8TH);
40 0         0 $self->note($self->TRIPLET_8TH, $self->kick, $self->ride1);
41              
42 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->ride1);
43 0         0 $self->rest($self->TRIPLET_8TH);
44 0         0 $self->note($self->TRIPLET_8TH, $self->kick);
45              
46 0         0 $self->note($self->TRIPLET_8TH, $self->kick, $self->pedal, $self->ride1);
47 0         0 $self->rest($self->TRIPLET_8TH);
48 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->ride1);
49             }
50             },
51              
52             3 => sub { # Syncopated swing with kick and snare.
53 0     0   0 my $self = shift;
54 0         0 for my $beat (1 .. $self->beats) {
55 0         0 $self->note($self->TRIPLET_8TH, $self->pedal, $self->ride1);
56 0         0 $self->rest($self->TRIPLET_8TH);
57 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
58              
59 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->ride1);
60 0         0 $self->rest($self->TRIPLET_8TH);
61 0         0 $self->note($self->TRIPLET_8TH, $self->pedal, $self->ride1);
62              
63 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->ride1);
64 0         0 $self->rest($self->TRIPLET_8TH);
65 0         0 $self->note($self->TRIPLET_8TH, $self->pedal);
66              
67 0         0 $self->note($self->TRIPLET_8TH, $self->kick, $self->pedal, $self->ride1);
68 0         0 $self->rest($self->TRIPLET_8TH);
69 0         0 $self->note($self->TRIPLET_8TH, $self->snare, $self->ride1);
70             }
71             },
72              
73             '1 fill' => sub {
74 2     2   5 my $self = shift;
75 2         22 $self->note($self->TRIPLET_8TH, $self->snare);
76 2         240 $self->rest($self->TRIPLET_8TH);
77 2         77 $self->note($self->TRIPLET_8TH, $self->snare);
78              
79 2         149 $self->note($self->_8TH, $self->snare) for 0 .. 1;
80             },
81              
82             '2 fill' => sub {
83 1     1   2 my $self = shift;
84 1         8 $self->note($self->TRIPLET_8TH, $self->snare);
85 1         67 $self->rest($self->TRIPLET_8TH);
86 1         33 $self->note($self->TRIPLET_8TH, $self->snare);
87              
88 1         59 $self->note($self->TRIPLET_8TH, $self->snare);
89 1         57 $self->rest($self->TRIPLET_8TH);
90 1         29 $self->note($self->TRIPLET_8TH, $self->snare);
91              
92 1         59 $self->note($self->_8TH, $self->snare) for 0 .. 1;
93             },
94              
95             '3 fill' => sub { # Ala Buddy
96 1     1   3 my $self = shift;
97 1         6 $self->note($self->TRIPLET_8TH, $self->snare);
98 1         73 $self->note($self->TRIPLET_8TH, $self->kick);
99 1         60 $self->note($self->TRIPLET_8TH, $self->snare);
100              
101 1         58 $self->note($self->TRIPLET_8TH, $self->snare);
102 1         59 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
103              
104              
105 1         64 $self->note($self->TRIPLET_8TH, $self->snare);
106 1         65 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
107              
108 1         58 $self->note($self->TRIPLET_8TH, $self->snare);
109 1         77 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
110             },
111              
112 1         38 };
113             }
114              
115             # Custom kit access
116             sub _default_kit {
117 1     1   2 my $self = shift;
118             return {
119 1         2 %{ $self->SUPER::_default_kit() },
  1         6  
120             ride1 => ['Ride Cymbal 1'],
121             ride2 => ['Ride Cymbal 2'],
122             bell => ['Ride Bell'],
123             pedal => ['Pedal Hi-Hat'],
124             }
125             }
126 12     12 1 26 sub ride1 { return shift->_set_get('ride1', @_) }
127 0     0 1 0 sub ride2 { return shift->_set_get('ride2', @_) }
128 0     0 1 0 sub bell { return shift->_set_get('bell', @_) }
129 4     4 1 29 sub pedal { return shift->_set_get('pedal', @_) }
130              
131             1;
132              
133             __END__