/usr/share/perl5/Audio/Nama/Mute_Solo_Fade.pm is in nama 1.078-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | # ------------- Mute and Solo routines -----------
package Audio::Nama;
use Modern::Perl;
our (
%opts,
%tn,
%bn,
$hires,
$debug,
$debug2,
%fade_out_level,
%cops,
%copp,
@already_muted,
$fade_resolution,
$fade_time,
$soloing,
);
sub mute {
return if $opts{F};
return if $tn{Master}->rw eq 'OFF' or Audio::Nama::ChainSetup::really_recording();
$tn{Master}->mute;
}
sub unmute {
return if $opts{F};
return if $tn{Master}->rw eq 'OFF' or Audio::Nama::ChainSetup::really_recording();
$tn{Master}->unmute;
}
sub fade {
my ($id, $param, $from, $to, $seconds) = @_;
# no fade without Timer::HiRes
# no fade unless engine is running
if ( ! engine_running() or ! $hires ){
effect_update_copp_set ( $id, $param, $to );
return;
}
my $steps = $seconds * $fade_resolution;
my $wink = 1/$fade_resolution;
my $size = ($to - $from)/$steps;
$debug and print "id: $id, param: $param, from: $from, to: $to, seconds: $seconds\n";
for (1..$steps - 1){
modify_effect( $id, $param, '+', $size);
sleeper( $wink );
}
effect_update_copp_set(
$id,
$param,
$to);
}
sub fadein {
my ($id, $to) = @_;
my $from = $fade_out_level{$cops{$id}->{type}};
fade( $id, 0, $from, $to, $fade_time);
}
sub fadeout {
my $id = shift;
my $from = $copp{$id}[0];
my $to = $fade_out_level{$cops{$id}->{type}};
fade( $id, 0, $from, $to, $fade_time );
}
sub solo {
my @args = @_;
# get list of already muted tracks if I haven't done so already
if ( ! @already_muted ){
@already_muted = grep{ defined $_->old_vol_level}
map{ $tn{$_} }
Audio::Nama::Track::user();
}
$debug and say join " ", "already muted:", map{$_->name} @already_muted;
# convert bunches to tracks
my @names = map{ bunch_tracks($_) } @args;
# use hashes to store our list
my %to_mute;
my %not_mute;
# get dependent tracks
my @d = map{ $tn{$_}->bus_tree() } @names;
# store solo tracks and dependent tracks that we won't mute
map{ $not_mute{$_}++ } @names, @d;
# find all siblings tracks not in depends list
# - get buses list corresponding to our non-muting tracks
my %buses;
$buses{Main}++; # we always want Main
map{ $buses{$_}++ } # add to buses list
map { $tn{$_}->group } # corresponding bus (group) names
keys %not_mute; # tracks we want
# - get sibling tracks we want to mute
map{ $to_mute{$_}++ } # add to mute list
grep{ ! $not_mute{$_} } # those we *don't* want
map{ $bn{$_}->tracks } # tracks list
keys %buses; # buses list
# mute all tracks on our mute list (do we skip already muted tracks?)
map{ $tn{$_}->mute('nofade') } keys %to_mute;
# unmute all tracks on our wanted list
map{ $tn{$_}->unmute('nofade') } keys %not_mute;
$soloing = 1;
}
sub nosolo {
# unmute all except in @already_muted list
# unmute all tracks
map { $tn{$_}->unmute('nofade') } Audio::Nama::Track::user();
# re-mute previously muted tracks
if (@already_muted){
map { $_->mute('nofade') } @already_muted;
}
# remove listing of muted tracks
@already_muted = ();
$soloing = 0;
}
sub all {
# unmute all tracks
map { $tn{$_}->unmute('nofade') } Audio::Nama::Track::user();
# remove listing of muted tracks
@already_muted = ();
$soloing = 0;
}
1;
__END__
|