line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#! perl |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
64257
|
use strict; |
|
6
|
|
|
|
|
85
|
|
|
6
|
|
|
|
|
227
|
|
4
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
265
|
|
5
|
6
|
|
|
6
|
|
3742
|
use utf8; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Music::ChordBot::Opus::Section::Style; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Music::ChordBot::Opus::Section::Style- ChordBot styles. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 0.01; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
6
|
|
1844
|
use parent 'Music::ChordBot::Opus::Base'; |
|
6
|
|
|
|
|
388
|
|
|
6
|
|
|
|
|
100
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Music::ChordBot::Opus::Section::Style; |
22
|
|
|
|
|
|
|
$style = Music::ChordBot::Section::Style->new; |
23
|
|
|
|
|
|
|
$style->preset("Hammered"); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
6
|
|
|
6
|
|
4564
|
use Music::ChordBot::Opus::Section::Style::Track; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
2037
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 new [ I ] |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Creates a new Music::ChordBot::Opus::Section::Style object. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Initial attributes can be passed to the constructor as a hash. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Attributes: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 4 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item reverb |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The level of reverb effect. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item chorus |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The level of chorus effect. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item tracks |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
A list (array ref) of Track objects. See |
52
|
|
|
|
|
|
|
L for details about |
53
|
|
|
|
|
|
|
tracks. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item beats |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The number of beats per measure. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item divider |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The divider for the measure. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Default is 4/4. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub new { |
70
|
335
|
|
|
335
|
1
|
430
|
my $pkg = shift; |
71
|
335
|
|
|
|
|
1144
|
my $data = { chorus => 4, reverb => 8, tracks => [], @_ }; |
72
|
335
|
|
|
|
|
1433
|
bless { data => $data }, $pkg; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 chorus reverb beats divider tracks |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Accessors can be used to set and/or get these attributes. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
333
|
|
|
333
|
1
|
939
|
sub chorus { shift->_setget( "chorus", @_ ) } |
82
|
333
|
|
|
333
|
1
|
842
|
sub reverb { shift->_setget( "reverb", @_ ) } |
83
|
171
|
|
|
171
|
0
|
601
|
sub legacy { shift->_setget( "legacy", @_ ) } |
84
|
16
|
|
|
16
|
1
|
49
|
sub beats { shift->_setget( "beats", @_ ) } |
85
|
16
|
|
|
16
|
1
|
55
|
sub divider { shift->_setget( "divider", @_ ) } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 add_track I |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Adds a track object to the style. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub add_track { |
94
|
745
|
|
|
745
|
1
|
983
|
my ( $self, $track ) = @_; |
95
|
745
|
|
|
|
|
743
|
push( @{$self->{data}->{tracks}}, $track->data ); |
|
745
|
|
|
|
|
2375
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 preset I |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Sets the style to one of the built-in preset values. For a list of |
101
|
|
|
|
|
|
|
preset values and their descriptions, see |
102
|
|
|
|
|
|
|
L. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my %presets; |
107
|
|
|
|
|
|
|
sub preset { |
108
|
6
|
100
|
|
6
|
1
|
27
|
return $presets{$_[1]} if %presets; |
109
|
|
|
|
|
|
|
|
110
|
6
|
|
|
6
|
|
1587
|
use JSON (); |
|
6
|
|
|
|
|
184800
|
|
|
6
|
|
|
|
|
1592
|
|
111
|
5
|
|
|
|
|
64
|
my $json = JSON->new; |
112
|
5
|
|
|
|
|
45
|
while ( ) { |
113
|
330
|
|
|
|
|
3016
|
my $data = $json->decode($_); |
114
|
330
|
|
|
|
|
802
|
my $preset = __PACKAGE__->new; |
115
|
330
|
50
|
|
|
|
1174
|
$preset->chorus( $data->{chorus} ) if exists $data->{chorus}; |
116
|
330
|
50
|
|
|
|
10310
|
$preset->reverb( $data->{reverb} ) if exists $data->{reverb}; |
117
|
330
|
100
|
|
|
|
1012
|
$preset->legacy( $data->{legacy} ) if exists $data->{legacy}; |
118
|
330
|
100
|
|
|
|
727
|
$preset->beats( $data->{beats} ) if exists $data->{beats}; |
119
|
330
|
100
|
|
|
|
754
|
$preset->divider($data->{divider}) if exists $data->{divider}; |
120
|
|
|
|
|
|
|
|
121
|
330
|
|
|
|
|
438
|
my $tracks = $data->{tracks}; |
122
|
330
|
|
|
|
|
606
|
foreach my $t ( @$tracks ) { |
123
|
740
|
|
|
|
|
2467
|
$preset->add_track |
124
|
|
|
|
|
|
|
( Music::ChordBot::Opus::Section::Style::Track->new |
125
|
|
|
|
|
|
|
( id => $t->[0], volume => $t->[1] ) ) |
126
|
|
|
|
|
|
|
} |
127
|
330
|
|
|
|
|
2495
|
$presets{ $data->{name} } = $preset; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
5
|
|
|
|
|
126
|
$presets{$_[1]} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT & LICENSE |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
See L. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__DATA__ |