Csound/ScoreStatement/t.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 57 CC 4 SCAR 14.3
CC
4
Cov
0%
new
6.0
tempo
6.0
score_text
6.0
CRAP 4.2
1 #_{ Encoding and name
2 =encoding utf8
3 =head1 NAME
4  
5 Csound::ScoreStatement
6  
7 L<http://www.csounds.com/manual/html/ScoregensTop.html>
8  
9 =cut
10 #_}
11  
12 package Csound::ScoreStatement::t;
13  
14 use warnings;
15 use strict;
16 use 5.10.0; # state
17  
18 use Carp;
19  
20 use Csound::ScoreStatement;
21  
22 our $VERSION = $Csound::VERSION;
23 our @ISA = qw(Csound::ScoreStatement);
24  
25 #_{ Synopsis
26  
27 =head1 SYNOPSIS
28  
29 use Csound::ScoreStatement::t;
30  
31 my $t = Csound::ScoreStatement::t->new();
32  
33 $t->tempo($t, $beats_per_minute);
34  
35 =cut
36 #_}
37 #_{ Description
38 =head DESCRIPTION
39  
40 The C<t> statement controls the tempo of a L<< score's|Csound::Score >> beats.
41  
42 The syntax is
43  
44 t 0 tempo-0 t-1 tempo-1 t-2 tempo-2 t-3 tempo-3 …
45  
46 where C<t-n> is the number of a beat and C<tempo-n> is the tempo in beats per minute at that given beat.
47  
48 =cut
49 #_}
50 #_{ Methods
51 #_{
52 =head1 METHODS
53 =cut
54 #_}
55 sub new { #_{
56 #_{ POD
57 =head2 new
58  
59 my $t = Csound::ScoreStatement::t->new($start_tempo);
60  
61 =cut
62 #_}
63  
64 my $class = shift;
65 my $self = {};
66 my $start_tempo = shift;
67  
68 bless $self, $class;
69 die unless $self->isa('Csound::ScoreStatement::t');
70  
71  
72 $self->{tempi} = [];
73  
74 $self->tempo(0, $start_tempo);
75  
76 return $self;
77  
78 } #_}
79 sub tempo { #_{
80 #_{ POD
81 =head2 new
82  
83 $t->tempo($t, $beats_per_minute);
84  
85 =cut
86 #_}
87  
88 my $self = shift;
89 die unless $self->isa('Csound::ScoreStatement::t');
90  
91 my $t = shift;
92 my $tempo = shift;
93  
94 push @{$self->{tempi}}, [$t, $tempo];
95  
96 } #_}
97 sub score_text { #_{
98 #_{ POD
99 =head2 new
100  
101 my $score_text = $t->score_text;
102  
103 Return the text to be written into the L<< score|Csound::Score >>.
104  
105 =cut
106 #_}
107  
108 my $self = shift;
109 die unless $self->isa('Csound::ScoreStatement::t');
110  
111 my $ret = "t";
112  
113 for my $t (@{$self->{tempi}}) {
114 $ret .= " $t->[0] $t->[1]";
115 }
116  
117 return $ret;
118  
119  
120 } #_}
121 #_}
122 #_{ POD: Copyright
123  
124 =head1 Copyright
125  
126 Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved.
127 This program is free software; you can redistribute it and/or modify it
128 under the terms of the the Artistic License (2.0). You may obtain a
129 copy of the full license at: L<http://www.perlfoundation.org/artistic_license_2_0>
130  
131 =cut
132  
133 #_}
134  
135 'tq84';