File Coverage

blib/lib/MIDI/Simple/Drummer/Jazz.pm
Criterion Covered Total %
statement 24 78 30.7
branch n/a
condition n/a
subroutine 7 16 43.7
pod 5 5 100.0
total 36 99 36.3


line stmt bran cond sub pod time code
1             package MIDI::Simple::Drummer::Jazz;
2             $MIDI::Simple::Drummer::Jazz::VERSION = '0.0811';
3             our $AUTHORITY = 'cpan:GENE';
4 1     1   565 use strict;
  1         3  
  1         24  
5 1     1   4 use warnings;
  1         2  
  1         21  
6 1     1   332 use parent 'MIDI::Simple::Drummer';
  1         226  
  1         4  
7              
8             sub new {
9 1     1 1 500 my $self = shift;
10 1         5 $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 0     0   0 my $self = shift;
22 0         0 for my $beat (1 .. $self->beats) {
23 0         0 $self->note($self->TRIPLET_8TH, $self->ride1);
24 0         0 $self->rest($self->TRIPLET_8TH) for 0 .. 1;
25 0         0 $self->note($self->TRIPLET_8TH, $self->pedal, $self->ride1);
26 0         0 $self->rest($self->TRIPLET_8TH);
27 0         0 $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 0     0   0 my $self = shift;
75 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
76 0         0 $self->rest($self->TRIPLET_8TH);
77 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
78              
79 0         0 $self->note($self->_8TH, $self->snare) for 0 .. 1;
80             },
81              
82             '2 fill' => sub {
83 4     4   5 my $self = shift;
84 4         20 $self->note($self->TRIPLET_8TH, $self->snare);
85 4         240 $self->rest($self->TRIPLET_8TH);
86 4         100 $self->note($self->TRIPLET_8TH, $self->snare);
87              
88 4         188 $self->note($self->TRIPLET_8TH, $self->snare);
89 4         183 $self->rest($self->TRIPLET_8TH);
90 4         91 $self->note($self->TRIPLET_8TH, $self->snare);
91              
92 4         192 $self->note($self->_8TH, $self->snare) for 0 .. 1;
93             },
94              
95             '3 fill' => sub { # Ala Buddy
96 0     0   0 my $self = shift;
97 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
98 0         0 $self->note($self->TRIPLET_8TH, $self->kick);
99 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
100              
101 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
102 0         0 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
103              
104              
105 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
106 0         0 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
107              
108 0         0 $self->note($self->TRIPLET_8TH, $self->snare);
109 0         0 $self->note($self->TRIPLET_8TH, $self->kick) for 0 .. 1;
110             },
111              
112 1         27 };
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         5  
120             ride1 => ['Ride Cymbal 1'],
121             ride2 => ['Ride Cymbal 2'],
122             bell => ['Ride Bell'],
123             pedal => ['Pedal Hi-Hat'],
124             }
125             }
126 0     0 1   sub ride1 { return shift->_set_get('ride1', @_) }
127 0     0 1   sub ride2 { return shift->_set_get('ride2', @_) }
128 0     0 1   sub bell { return shift->_set_get('bell', @_) }
129 0     0 1   sub pedal { return shift->_set_get('pedal', @_) }
130              
131             1;
132              
133             __END__