line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#! perl |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
34935
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
196
|
|
4
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
334
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Music::ChordBot::Opus::Section::Chord; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Music::ChordBot::Opus::Section::Chord - ChordBot chords. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 0.01; |
15
|
|
|
|
|
|
|
|
16
|
6
|
|
|
6
|
|
1148
|
use parent 'Music::ChordBot::Opus::Base'; |
|
6
|
|
|
|
|
510
|
|
|
6
|
|
|
|
|
28
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Music::ChordBot::Opus::Section::Chord; |
21
|
|
|
|
|
|
|
$chord = Music::ChordBot::Section::Chord->new; |
22
|
|
|
|
|
|
|
$chord->root("C"); |
23
|
|
|
|
|
|
|
$chord->type("Min7"); |
24
|
|
|
|
|
|
|
$chord->duration(4); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
or |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$chord = Music::ChordBot::Section::Chord->new("C Min7 4"); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
or |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$chord = Music::ChordBot::Section::Chord->new("C", "Min7", 4); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new [ args ] |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Creates a new Music::ChordBot::Opus::Section::Chord object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The chord key, type and duration may be passed as arguments to the |
42
|
|
|
|
|
|
|
constructor, either as three separate values, or as a string |
43
|
|
|
|
|
|
|
containing these values space separated. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Attributes: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over 4 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item root |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
The root (key) of the chord. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item bass |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
An added bass note of the chord. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item type |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The type, e.g., "Maj" (major), "Min" (minor), "7" (seventh) and so on. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item duration |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The duration, in beats. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item inversion |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Thee inversion, if applicable. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub new { |
72
|
58
|
|
|
58
|
1
|
143
|
my $pkg = shift; |
73
|
58
|
|
|
|
|
82
|
my $data = {}; |
74
|
58
|
100
|
|
|
|
137
|
if ( @_ == 1 ) { |
75
|
18
|
|
|
|
|
86
|
@_ = split( ' ', $_[0] ); |
76
|
|
|
|
|
|
|
} |
77
|
58
|
100
|
|
|
|
133
|
if ( @_ == 3 ) { |
78
|
56
|
|
|
|
|
116
|
$data->{root} = shift; |
79
|
56
|
100
|
|
|
|
151
|
if ( $data->{root} =~ /^(.+)\/(.*)/ ) { |
80
|
2
|
|
|
|
|
7
|
$data->{bass} = $2; |
81
|
2
|
|
|
|
|
5
|
$data->{root} = $1; |
82
|
|
|
|
|
|
|
} |
83
|
56
|
|
|
|
|
127
|
$data->{type} = shift; |
84
|
56
|
|
|
|
|
218
|
$data->{duration} = 0+shift; |
85
|
|
|
|
|
|
|
} |
86
|
58
|
|
|
|
|
368
|
bless { data => $data }, $pkg; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 root bass type duration inversion |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Accessors can be used to set and/or get these attributes. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
4
|
|
|
4
|
1
|
39
|
sub root { shift->_setget( "root", @_ ) } |
96
|
1
|
|
|
1
|
1
|
4
|
sub bass { shift->_setget( "bass", @_ ) } |
97
|
2
|
|
|
2
|
1
|
8
|
sub type { shift->_setget( "type", @_ ) } |
98
|
3
|
|
|
3
|
1
|
13
|
sub duration { shift->_setget( "duration", @_ ) } |
99
|
1
|
|
|
1
|
1
|
5
|
sub inversion { shift->_setget( "inversion", @_ ) } |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT & LICENSE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
See L. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |