File Coverage

blib/lib/Music/ChordBot/Opus/Section/Style/Track.pm
Criterion Covered Total %
statement 27 27 100.0
branch 2 2 100.0
condition 1 3 33.3
subroutine 10 10 100.0
pod 5 6 83.3
total 45 48 93.7


line stmt bran cond sub pod time code
1             #! perl
2              
3 7     7   23733 use strict;
  7         15  
  7         226  
4 7     7   62 use warnings;
  7         16  
  7         177  
5 7     7   1068 use utf8;
  7         19  
  7         33  
6              
7             package Music::ChordBot::Opus::Section::Style::Track;
8              
9             =head1 NAME
10              
11             Music::ChordBot::Opus::Section::Style- ChordBot styles.
12              
13             =cut
14              
15             our $VERSION = 0.01;
16              
17 7     7   1467 use parent 'Music::ChordBot::Opus::Base';
  7         406  
  7         35  
18              
19             =head1 SYNOPSIS
20              
21             use Music::ChordBot::Opus::Section::Style::Track;
22             $track = Music::ChordBot::Section::Style::Track->new;
23             $track->id(14)->volume(6);
24              
25             =head1 METHODS
26              
27             =head2 new [ I ]
28              
29             Creates a new Music::ChordBot::Opus::Section::Style::Track object.
30              
31             Initial attributes can be passed to the constructor as a hash.
32              
33             Attributes:
34              
35             =over 4
36              
37             =item id
38              
39             The track id. The id selects an instrument and comping pattern.
40              
41             =item volume
42              
43             The desired volume.
44              
45             =back
46              
47             =cut
48              
49             sub new {
50 748     748 1 979 my $pkg = shift;
51 748         1917 my $data = { @_ };
52 748         4438 bless { data => $data }, $pkg;
53             }
54              
55             =head2 id volume
56              
57             Accessors can be used to set and/or get these attributes.
58              
59             =cut
60              
61 9     9 1 34 sub id { shift->_setget( "id", @_ ) }
62 4     4 1 19 sub volume { shift->_setget( "volume", @_ ) }
63              
64             =head2 instrument
65              
66             Returns a string describing the instrument for the current track.
67              
68             =cut
69              
70 2     2 1 10 sub instrument { $_[0]->description->{instrument} }
71              
72             =head2 pattern
73              
74             Returns a string describing the pattern for the current track.
75              
76             =cut
77              
78 2     2 1 8 sub pattern { $_[0]->description->{pattern} }
79              
80             my @descriptions;
81             sub description {
82 4     4 0 8 my ( $self, $id ) = @_;
83 4   33     18 $id //= $self->id;
84              
85 4 100       13 unless ( @descriptions ) {
86 1         3 my $data = <
87             1 Synth Arp 01
88             2 Synth Arp 02
89             3 Synth Arp 03
90             4 Synth Arp 04
91             5 Synth Arp 05
92             6 Synth Arp 06
93             7 Synth Arp 07
94             8 Synth Arp 08
95             9 Synth Arp 09
96             10 Synth Arp 10
97             11 Synth Arp 11
98             12 Synth Arp 12
99             13 Piano Arpeggio 01
100             14 Piano Arpeggio 02
101             15 Piano Arpeggio 03
102             16 Piano Arpeggio 04
103             17 Piano Arpeggio 05
104             18 Piano Arpeggio 06
105             19 Piano Arpeggio 07
106             20 Piano Arpeggio 08
107             21 Piano Arpeggio 09
108             22 Piano Arpeggio 10
109             23 Piano Arpeggio 11
110             24 Piano Arpeggio 12
111             25 Piano Arpeggio 13
112             26 Piano Arpeggio 14
113             27 Piano Arpeggio 15
114             28 Piano Arpeggio 16
115             29 Piano Arpeggio 17
116             30 Piano Arpeggio 18
117             31 Piano Arpeggio 19
118             32 Piano Arpeggio 20
119             33 Piano Arpeggio 21
120             34 Piano Arpeggio 22
121             35 Piano Arpeggio 23
122             36 Piano Arpeggio 24
123             37 Piano Arpeggio 25
124             38 Piano Arpeggio 26
125             39 Piano Arpeggio 27 - 6/8
126             40 Synth Attack 01
127             41 Synth Attack 02
128             42 Synth Attack 03
129             43 Synth Attack 04
130             44 Synth Attack 05
131             45 Synth Attack 06
132             46 Synth Attack 07
133             47 Synth Bass 01
134             48 Synth Bass 02
135             49 Synth Bass 03
136             50 Synth Bass 04
137             51 Synth Bass 05
138             52 Synth Bass 06
139             53 Synth Bass 07
140             54 Drums Electro 01
141             55 Drums Electro 02
142             56 Drums Electro 03
143             57 Drums Electro 04
144             58 Drums Electro 05
145             59 Drums Electro 06
146             60 Drums Electro 07
147             61 Drums Electro 08
148             62 Drums Electro 09
149             63 Drums Electro 10
150             64 Drums Electro 11
151             65 Drums Electro 12
152             66 Keyboard FM 01
153             67 Keyboard FM 02
154             68 Keyboard FM 03
155             69 Keyboard FM 04
156             70 Keyboard FM 05
157             71 Keyboard FM 06
158             72 Keyboard FM 07
159             73 Keyboard FM 08
160             74 Keyboard FM 09
161             75 Keyboard FM 10
162             76 Keyboard FM 11 - 3/4
163             77 Keyboard FM 12
164             78 Keyboard FM 13
165             79 Keyboard FM 14
166             80 Keyboard FM 15
167             81 Keyboard FM 16 - 6/8
168             82 Bass Fifths 01
169             83 Bass Fifths 02
170             84 Bass Fifths 03
171             85 Bass Fifths 04
172             86 Bass Fifths 05
173             87 Bass Fifths 06
174             88 Bass Fifths 07
175             89 Bass Fifths 08
176             90 Bass Fifths 09
177             91 Piano Hammered 01
178             92 Piano Hammered 02
179             93 Piano Hammered 03
180             94 Piano Hammered 04
181             95 Piano Hammered 05
182             96 Piano Hammered 06
183             97 Piano Hammered 07
184             98 Piano Hammered 08
185             99 Piano Hammered 09
186             100 Piano Hammered 10
187             101 Piano Hammered 11
188             102 Piano Hammered 12
189             103 Piano Hammered 13
190             104 Piano Hammered 14
191             105 Piano Hammered 15
192             106 Piano Hammered 16
193             107 Piano Hammered 17
194             108 Piano Hammered 18
195             109 Piano Hammered 19
196             110 Piano Hammered 20
197             111 Piano Hammered 21
198             112 Piano Hammered 22
199             113 Piano Hammered 23
200             114 Piano Hammered 24
201             115 Piano Hammered 25 - 5/4
202             116 Piano Hammered 26 - 3/4
203             117 Piano Hammered 27 - 3/4
204             118 Drums Hard 01
205             119 Drums Hard 02
206             120 Drums Hard 03
207             121 Drums Hard 04
208             122 Drums Hard 05
209             123 Drums Hard 06
210             124 Drums Hard 07
211             125 Drums Hard 08
212             126 Drums Hard 09
213             127 Drums Hard 10
214             128 Drums Hard 11
215             129 Drums Hard 12
216             130 Bass Line 01
217             131 Bass Line 02
218             132 Bass Line 03
219             133 Bass Line 04
220             134 Bass Line 05
221             135 Bass Line 06
222             136 Bass Line 07
223             137 Bass Line 08
224             138 Bass Line 09
225             139 Bass Line 10
226             140 Bass Line 11
227             141 Drums Medium 01
228             142 Drums Medium 02
229             143 Drums Medium 03
230             144 Drums Medium 04
231             145 Drums Medium 05
232             146 Drums Medium 06
233             147 Drums Medium 07
234             148 Drums Medium 08
235             149 Drums Medium 09
236             150 Drums Medium 10
237             151 Drums Medium 11
238             152 Drums Medium 12
239             153 Drums Metronome 2/4
240             154 Drums Metronome 3/4
241             155 Drums Metronome 4/4
242             156 Drums Metronome 5/4
243             157 Drums Metronome 6/8
244             158 E. Guitar Muted 01
245             159 E. Guitar Muted 02
246             160 E. Guitar Muted 03
247             161 E. Guitar Muted 04
248             162 E. Guitar Muted 05
249             163 Bass Octave 01
250             164 Bass Octave 02
251             165 Bass Octave 03
252             166 Bass Octave 04
253             167 Bass Octave 05
254             168 Bass Octave 06
255             169 Bass Octave 07
256             170 Bass Octave 08
257             171 Bass Octave 09
258             172 Keyboard Organ 01
259             173 Keyboard Organ 02
260             174 Keyboard Organ 03
261             175 Keyboard Organ 05
262             176 Keyboard Organ 06
263             177 Keyboard Organ 07
264             178 Keyboard Organ 08
265             179 Keyboard Organ 09
266             180 Keyboard Organ 10
267             181 Keyboard Organ 11
268             182 Keyboard Organ 12
269             183 Keyboard Organ 13
270             184 Keyboard Organ 14
271             185 Keyboard Organ 15
272             186 Keyboard Organ Bass 01
273             187 Keyboard Organ Bass 02
274             188 Drums Percussion 01
275             189 Drums Percussion 02
276             190 Drums Percussion 03
277             191 Drums Percussion 04
278             192 Drums Percussion 05
279             193 Drums Percussion 06
280             194 Drums Percussion 07
281             195 Piano Piano Bass 01
282             196 Piano Piano Bass 02
283             197 Piano Piano Bass 03
284             198 Piano Piano Bass 04
285             199 Piano Piano Bass 05
286             200 Piano Piano Bass 06
287             201 Piano Piano Bass 07
288             202 Piano Piano Bass 08
289             203 Piano Piano Bass 09
290             204 Piano Piano Bass 10
291             205 Piano Piano Bass 11
292             206 E. Guitar Picked 01
293             207 A. Guitar Picked 01
294             208 E. Guitar Picked 02
295             209 A. Guitar Picked 02
296             210 E. Guitar Picked 03
297             211 A. Guitar Picked 03
298             212 E. Guitar Picked 04
299             213 A. Guitar Picked 04
300             214 E. Guitar Picked 05
301             215 A. Guitar Picked 05
302             216 E. Guitar Picked 06
303             217 A. Guitar Picked 06 - 6/8
304             218 E. Guitar Picked 07
305             219 A. Guitar Picked 07
306             220 A. Guitar Picked 08
307             221 E. Guitar Picked 08 - 6/8
308             222 E. Guitar Picked 09
309             223 A. Guitar Picked 09
310             224 E. Guitar Picked 10
311             225 A. Guitar Picked 10
312             226 E. Guitar Picked 11
313             227 A. Guitar Picked 11
314             228 E. Guitar Picked 12
315             229 A. Guitar Picked 12
316             230 E. Guitar Picked 13
317             231 A. Guitar Picked 13
318             232 E. Guitar Picked 14
319             233 A. Guitar Picked 14
320             234 E. Guitar Picked 15
321             235 A. Guitar Picked 15
322             236 E. Guitar Picked 16
323             237 A. Guitar Picked 16
324             238 E. Guitar Picked 17
325             239 A. Guitar Picked 17
326             240 E. Guitar Picked 18
327             241 A. Guitar Picked 18
328             242 E. Guitar Picked 19
329             243 A. Guitar Picked 19
330             244 A. Guitar Picked 20
331             245 A. Guitar Picked 21
332             246 A. Guitar Picked 22
333             247 A. Guitar Picked 23
334             248 A. Guitar Picked 24
335             249 Keyboard Rhodes 01
336             250 Keyboard Rhodes 02
337             251 Keyboard Rhodes 03
338             252 Keyboard Rhodes 04
339             253 Keyboard Rhodes 05
340             254 Keyboard Rhodes 06
341             255 Keyboard Rhodes 07
342             256 Keyboard Rhodes 08
343             257 Keyboard Rhodes 09 - 3/4
344             258 Keyboard Rhodes 10
345             259 Keyboard Rhodes 11
346             260 Keyboard Rhodes 12
347             261 Keyboard Rhodes 13
348             262 Keyboard Rhodes 14
349             263 Keyboard Rhodes 15
350             264 Keyboard Rhodes 16 - 6/8
351             265 Piano Shuffle 01
352             266 Bass Shuffle 01
353             267 Drums Shuffle 01
354             268 Piano Shuffle 02
355             269 Bass Shuffle 02
356             270 Drums Shuffle 02
357             271 Piano Shuffle 03
358             272 Drums Shuffle 03
359             273 Drums Shuffle 04
360             274 Bass Simple 01
361             275 Bass Simple 02
362             276 Bass Simple 03
363             277 Bass Simple 04
364             278 Bass Simple 05
365             279 Bass Simple 06
366             280 Bass Simple 07
367             281 Bass Simple 08
368             282 Bass Simple 09
369             283 Bass Simple 10
370             284 Bass Simple 11
371             285 Bass Simple 12
372             286 Bass Simple 13
373             287 Bass Simple 14
374             288 Bass Slap 01
375             289 Bass Slap 02
376             290 Bass Slap 03
377             291 Bass Slap 04
378             292 Bass Slap 05
379             293 Bass Slap 06
380             294 Bass Slap 07
381             295 Bass Slap 08
382             296 Drums Soft 01
383             297 Drums Soft 02
384             298 Drums Soft 03
385             299 Drums Soft 04
386             300 Drums Soft 05
387             301 Drums Soft 06
388             302 Drums Soft 07
389             303 Drums Soft 08
390             304 Drums Soft 09
391             305 Drums Soft 10
392             306 Drums Soft 11 - 3/4
393             307 Drums Soft 12 - 6/8
394             308 E. Guitar Stab 01
395             309 E. Guitar Stab 02
396             310 E. Guitar Stab 03
397             311 E. Guitar Stab 04
398             312 Synth Strings 01
399             313 Synth Strings 02
400             314 Synth Strings 03
401             315 Synth Strings 04
402             316 E. Guitar Strum 01
403             317 A. Guitar Strum 01
404             318 E. Guitar Strum 02
405             319 A. Guitar Strum 02
406             320 E. Guitar Strum 03
407             321 A. Guitar Strum 03
408             322 E. Guitar Strum 04
409             323 A. Guitar Strum 04
410             324 E. Guitar Strum 05
411             325 A. Guitar Strum 05
412             326 E. Guitar Strum 06
413             327 A. Guitar Strum 06
414             328 E. Guitar Strum 07
415             329 A. Guitar Strum 07
416             330 E. Guitar Strum 08
417             331 A. Guitar Strum 08
418             332 E. Guitar Strum 09
419             333 A. Guitar Strum 09
420             334 E. Guitar Strum 10
421             335 A. Guitar Strum 10
422             336 E. Guitar Strum 11
423             337 A. Guitar Strum 11
424             338 E. Guitar Strum 12
425             339 A. Guitar Strum 12
426             340 E. Guitar Strum 13
427             341 A. Guitar Strum 13 - 3/4
428             342 E. Guitar Strum 14
429             343 A. Guitar Strum 14 - 3/4
430             344 E. Guitar Strum 15
431             345 A. Guitar Strum 15
432             346 E. Guitar Strum 16
433             347 A. Guitar Strum 16
434             348 E. Guitar Strum 17
435             349 A. Guitar Strum 17
436             350 E. Guitar Strum 18
437             351 A. Guitar Strum 18
438             352 E. Guitar Strum 19
439             353 A. Guitar Strum 19
440             354 E. Guitar Strum 20
441             355 A. Guitar Strum 20
442             356 E. Guitar Strum 21
443             357 E. Guitar Strum 22
444             358 E. Guitar Strum 23
445             359 E. Guitar Strum 24
446             360 E. Guitar Strum 25
447             361 E. Guitar Strum 26
448             362 E. Guitar Strum 27 - 3/4
449             363 E. Guitar Strum 28 - 3/4
450             364 Drums Swing 01
451             365 Drums Swing 02
452             366 Drums Swing 03
453             367 Drums Swing 04 - 3/4
454             368 Keyboard Vibraphone 01
455             369 Keyboard Vibraphone 02
456             370 Keyboard Vibraphone 03
457             371 Keyboard Vibraphone 04
458             372 Keyboard Vibraphone 05
459             EOD
460 1         72 for ( split( /\n/, $data ) ) {
461 372         816 my @a = split( /\t/, $_ );
462 372         1080 push( @descriptions, { instrument => $a[1], pattern => $a[2] } );
463             }
464             }
465 4         62 $descriptions[$id-1];
466             }
467              
468             =head1 AUTHOR, COPYRIGHT & LICENSE
469              
470             See L.
471              
472             =cut
473              
474             1;