line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Audio::Nama; |
2
|
|
|
|
|
|
|
require 5.10.0; |
3
|
1
|
|
|
1
|
|
1383
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
4
|
|
|
|
|
|
|
$VERSION = "1.208"; |
5
|
1
|
|
|
1
|
|
726
|
use Modern::Perl; |
|
1
|
|
|
|
|
13123
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
#use Carp::Always; |
7
|
1
|
|
|
1
|
|
181
|
no warnings qw(uninitialized syntax); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
########## External dependencies ########## |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Carp qw(carp cluck confess croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
12
|
1
|
|
|
1
|
|
5
|
use Cwd; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
13
|
1
|
|
|
1
|
|
809
|
use Data::Section::Simple qw(get_data_section); |
|
1
|
|
|
|
|
531
|
|
|
1
|
|
|
|
|
56
|
|
14
|
1
|
|
|
1
|
|
823
|
use File::Find::Rule; |
|
1
|
|
|
|
|
8579
|
|
|
1
|
|
|
|
|
7
|
|
15
|
1
|
|
|
1
|
|
51
|
use File::Path; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
16
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
17
|
1
|
|
|
1
|
|
886
|
use File::Spec::Link; |
|
1
|
|
|
|
|
1691
|
|
|
1
|
|
|
|
|
26
|
|
18
|
1
|
|
|
1
|
|
1159
|
use File::Temp; |
|
1
|
|
|
|
|
16284
|
|
|
1
|
|
|
|
|
86
|
|
19
|
1
|
|
|
1
|
|
1254
|
use Getopt::Long; |
|
1
|
|
|
|
|
11251
|
|
|
1
|
|
|
|
|
5
|
|
20
|
1
|
|
|
1
|
|
1091
|
use Git::Repository; |
|
1
|
|
|
|
|
20154
|
|
|
1
|
|
|
|
|
7
|
|
21
|
1
|
|
|
1
|
|
1326
|
use Graph; |
|
1
|
|
|
|
|
124742
|
|
|
1
|
|
|
|
|
39
|
|
22
|
1
|
|
|
1
|
|
934
|
use IO::Socket; |
|
1
|
|
|
|
|
15124
|
|
|
1
|
|
|
|
|
6
|
|
23
|
1
|
|
|
1
|
|
1474
|
use IO::Select; |
|
1
|
|
|
|
|
1627
|
|
|
1
|
|
|
|
|
45
|
|
24
|
1
|
|
|
1
|
|
800
|
use IPC::Open3; |
|
1
|
|
|
|
|
2926
|
|
|
1
|
|
|
|
|
54
|
|
25
|
1
|
|
|
1
|
|
1272
|
use Log::Log4perl qw(get_logger :levels); |
|
1
|
|
|
|
|
53693
|
|
|
1
|
|
|
|
|
6
|
|
26
|
1
|
|
|
1
|
|
1041
|
use Module::Load::Conditional qw(can_load); |
|
1
|
|
|
|
|
21025
|
|
|
1
|
|
|
|
|
61
|
|
27
|
1
|
|
|
1
|
|
9
|
use Module::Load; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
28
|
1
|
|
|
1
|
|
1979
|
use Parse::RecDescent; |
|
1
|
|
|
|
|
37361
|
|
|
1
|
|
|
|
|
9
|
|
29
|
1
|
|
|
1
|
|
49
|
use Storable qw(thaw); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
85
|
|
30
|
1
|
|
|
1
|
|
1021
|
use Term::ReadLine; |
|
1
|
|
|
|
|
3275
|
|
|
1
|
|
|
|
|
29
|
|
31
|
1
|
|
|
1
|
|
872
|
use Text::Diff; |
|
1
|
|
|
|
|
9417
|
|
|
1
|
|
|
|
|
66
|
|
32
|
1
|
|
|
1
|
|
939
|
use Text::Format; |
|
1
|
|
|
|
|
4466
|
|
|
1
|
|
|
|
|
35
|
|
33
|
1
|
|
|
1
|
|
867
|
use Try::Tiny; |
|
1
|
|
|
|
|
1462
|
|
|
1
|
|
|
|
|
65
|
|
34
|
|
|
|
|
|
|
# use File::HomeDir;# Assign.pm |
35
|
|
|
|
|
|
|
# use File::Slurp; # several |
36
|
|
|
|
|
|
|
# use List::Util; # Fade.pm |
37
|
|
|
|
|
|
|
# use List::MoreUtils; # Effects.pm |
38
|
|
|
|
|
|
|
# use Time::HiRes; # automatically detected |
39
|
|
|
|
|
|
|
# use Tk; # loaded conditionally |
40
|
|
|
|
|
|
|
# use Event; # loaded conditionally |
41
|
|
|
|
|
|
|
# use AnyEvent; # loaded after Tk or Event |
42
|
|
|
|
|
|
|
# use AnyEvent::Term::TermKey; # --ditto-- |
43
|
|
|
|
|
|
|
# use jacks; # JACK server API |
44
|
|
|
|
|
|
|
# use Protocol::OSC; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
########## Nama modules ########### |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
# Note that :: in the *.p source files is expanded by # SKIP_PREPROC |
49
|
|
|
|
|
|
|
# preprocessing to Audio::Nama in the generated *.pm files. # SKIP_PREPROC |
50
|
|
|
|
|
|
|
# ::Assign becomes Audio::Nama::Assign # SKIP_PREPROC |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# These modules import functions and variables |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
1
|
|
620
|
use Audio::Nama::Assign qw(:all); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
207
|
|
56
|
1
|
|
|
1
|
|
525
|
use Audio::Nama::Globals qw(:all); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
673
|
|
57
|
1
|
|
|
1
|
|
568
|
use Audio::Nama::Util qw(:all); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
256
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Import the two user-interface classes |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
1
|
|
500
|
use Audio::Nama::Text; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
62
|
1
|
|
|
1
|
|
699
|
use Audio::Nama::Graphical; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# They are descendents of a base class we define in the root namespace |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
our @ISA; # no ancestors |
67
|
1
|
|
|
1
|
|
621
|
use Audio::Nama::Object qw(mode); # based on Object::Tiny |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
|
|
sub hello {"superclass hello"} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
|
|
sub new { my $class = shift; return bless {@_}, $class } |
|
0
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# The singleton $ui belongs to either the Audio::Nama::Text or Audio::Nama::Graphical class |
74
|
|
|
|
|
|
|
# depending on command line flags (-t or -g). |
75
|
|
|
|
|
|
|
# This (along with the availability of Tk) |
76
|
|
|
|
|
|
|
# determines whether the GUI comes up. The Text UI |
77
|
|
|
|
|
|
|
# is *always* available in the terminal that launched |
78
|
|
|
|
|
|
|
# Nama. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# How is $ui->init_gui interpreted? If $ui belongs to class |
81
|
|
|
|
|
|
|
# Audio::Nama::Text, Nama finds a no-op init_gui() stub in package Audio::Nama::Text |
82
|
|
|
|
|
|
|
# and does nothing. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# If $ui belongs to class Audio::Nama::Graphical, Nama looks for |
85
|
|
|
|
|
|
|
# init_gui() in package Audio::Nama::Graphical, finds nothing, so goes to |
86
|
|
|
|
|
|
|
# look in the base class. All graphical methods (found in |
87
|
|
|
|
|
|
|
# Graphical_subs.pl) are defined in the root namespace so they can |
88
|
|
|
|
|
|
|
# call Nama core methods without a package prefix. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
######## Nama classes ######## |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
1
|
|
729
|
use Audio::Nama::Track; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
93
|
1
|
|
|
1
|
|
705
|
use Audio::Nama::Bus; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
94
|
1
|
|
|
1
|
|
547
|
use Audio::Nama::Sequence; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
95
|
1
|
|
|
1
|
|
618
|
use Audio::Nama::Mark; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
96
|
1
|
|
|
1
|
|
607
|
use Audio::Nama::IO; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
15
|
|
97
|
1
|
|
|
1
|
|
569
|
use Audio::Nama::Wav; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
95
|
|
98
|
1
|
|
|
1
|
|
575
|
use Audio::Nama::Insert; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
99
|
1
|
|
|
1
|
|
552
|
use Audio::Nama::Fade; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
100
|
1
|
|
|
1
|
|
630
|
use Audio::Nama::Edit; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
101
|
1
|
|
|
1
|
|
597
|
use Audio::Nama::EffectChain; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
102
|
1
|
|
|
1
|
|
522
|
use Audio::Nama::Lat; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
103
|
1
|
|
|
1
|
|
530
|
use Audio::Nama::Engine; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
####### Nama subroutines ###### |
106
|
|
|
|
|
|
|
# |
107
|
|
|
|
|
|
|
# The following modules serve only to define and segregate subroutines. |
108
|
|
|
|
|
|
|
# They occupy the root namespace (except Audio::Nama::ChainSetup) |
109
|
|
|
|
|
|
|
# and do not execute any code when use'd. |
110
|
|
|
|
|
|
|
|
111
|
1
|
|
|
1
|
|
555
|
use Audio::Nama::AnalyseLV2; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
112
|
1
|
|
|
1
|
|
601
|
use Audio::Nama::Initializations (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
use Audio::Nama::Options (); |
114
|
|
|
|
|
|
|
use Audio::Nama::Config (); |
115
|
|
|
|
|
|
|
use Audio::Nama::Custom (); |
116
|
|
|
|
|
|
|
use Audio::Nama::Terminal (); |
117
|
|
|
|
|
|
|
use Audio::Nama::Grammar (); |
118
|
|
|
|
|
|
|
use Audio::Nama::Help (); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Audio::Nama::Project (); |
121
|
|
|
|
|
|
|
use Audio::Nama::Persistence (); |
122
|
|
|
|
|
|
|
use Audio::Nama::Git; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
use Audio::Nama::ChainSetup (); # separate namespace |
125
|
|
|
|
|
|
|
use Audio::Nama::Graph (); |
126
|
|
|
|
|
|
|
use Audio::Nama::Modes (); |
127
|
|
|
|
|
|
|
use Audio::Nama::Mix (); |
128
|
|
|
|
|
|
|
use Audio::Nama::Memoize (); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
use Audio::Nama::EngineSetup (); |
131
|
|
|
|
|
|
|
use Audio::Nama::EngineRun (); |
132
|
|
|
|
|
|
|
use Audio::Nama::EngineCleanup (); |
133
|
|
|
|
|
|
|
use Audio::Nama::EffectsRegistry (); |
134
|
|
|
|
|
|
|
use Audio::Nama::Effect q(:all); |
135
|
|
|
|
|
|
|
use Audio::Nama::MuteSoloFade (); |
136
|
|
|
|
|
|
|
use Audio::Nama::Jack (); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
use Audio::Nama::Regions (); |
139
|
|
|
|
|
|
|
use Audio::Nama::CacheTrack (); |
140
|
|
|
|
|
|
|
use Audio::Nama::Bunch (); |
141
|
|
|
|
|
|
|
use Audio::Nama::Wavinfo (); |
142
|
|
|
|
|
|
|
use Audio::Nama::Midi (); |
143
|
|
|
|
|
|
|
use Audio::Nama::Latency (); |
144
|
|
|
|
|
|
|
use Audio::Nama::Log qw(logit loggit logpkg logsub initialize_logger); |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub main { |
147
|
|
|
|
|
|
|
say eval join(get_data_section('banner'), qw(" ")); |
148
|
|
|
|
|
|
|
bootstrap_environment() ; |
149
|
|
|
|
|
|
|
load_project(); |
150
|
|
|
|
|
|
|
process_command($config->{execute_on_project_load}); |
151
|
|
|
|
|
|
|
reconfigure_engine(); |
152
|
|
|
|
|
|
|
process_command($config->{opts}->{X}); |
153
|
|
|
|
|
|
|
$ui->loop(); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub bootstrap_environment { |
157
|
|
|
|
|
|
|
definitions(); |
158
|
|
|
|
|
|
|
process_command_line_options(); |
159
|
|
|
|
|
|
|
start_logging(); |
160
|
|
|
|
|
|
|
setup_grammar(); |
161
|
|
|
|
|
|
|
setup_hotkey_grammar(); |
162
|
|
|
|
|
|
|
initialize_interfaces(); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
sub cleanup_exit { |
165
|
|
|
|
|
|
|
logsub("&cleanup_exit"); |
166
|
|
|
|
|
|
|
remove_riff_header_stubs(); |
167
|
|
|
|
|
|
|
trigger_rec_cleanup_hooks(); |
168
|
|
|
|
|
|
|
# for each process: |
169
|
|
|
|
|
|
|
# - SIGINT (1st time) |
170
|
|
|
|
|
|
|
# - allow time to close down |
171
|
|
|
|
|
|
|
# - SIGINT (2nd time) |
172
|
|
|
|
|
|
|
# - allow time to close down |
173
|
|
|
|
|
|
|
# - SIGKILL |
174
|
|
|
|
|
|
|
delete $project->{events}; |
175
|
|
|
|
|
|
|
close_midish() if $config->{use_midish}; |
176
|
|
|
|
|
|
|
my @engines = values %Audio::Nama::Engine::by_name; |
177
|
|
|
|
|
|
|
for (@engines){ |
178
|
|
|
|
|
|
|
if( @{$_->{pids}}){ |
179
|
|
|
|
|
|
|
map{ my $pid = $_; |
180
|
|
|
|
|
|
|
map{ my $signal = $_; |
181
|
|
|
|
|
|
|
kill $signal, $pid; |
182
|
|
|
|
|
|
|
sleeper(0.2); |
183
|
|
|
|
|
|
|
} (15,9); |
184
|
|
|
|
|
|
|
waitpid $pid, 1; |
185
|
|
|
|
|
|
|
} @{$_->{pids}}; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
$text->{term}->rl_deprep_terminal() if defined $text->{term}; |
189
|
|
|
|
|
|
|
exit; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
END { } |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; |
194
|
|
|
|
|
|
|
__DATA__ |