Audio-Nama
view release on metacpan or search on metacpan
t/12_nama.t view on Meta::CPAN
1 => 'soundcard',
Fluidsynth => 'jack_client',
"MPlayer [20120]:out_0" => 'jack_client',
"drumkit.ports" => 'jack_ports_list',
manual => 'jack_manual',
jack => 'jack_manual',
bus => 'bus',
null => 'null',
"loop,16" => 'loop',
"loop,Main" => 'loop',
);
while( my($dest,$type) = splice @id_to_type, 0,2){
is( dest_type($dest), $type, "$dest => $type");
}
my $test_project = 'test';
load_project(name => $test_project, create => 1);
$ENV{NAMA_VERBOSE_TEST_OUTPUT} and diag("project project dir: ".project_dir());
$ENV{NAMA_VERBOSE_TEST_OUTPUT} and diag("project project wav dir: ".this_wav_dir());
#diag(map{ $_->dump} values %Audio::Nama::Track::by_index );
is( project_dir(), "$test_dir/$test_project", "establish project directory");
is( ref $bn{Main}, q(Audio::Nama::SubBus), 'Bus initializtion');
force_jack();
### Unit Tests for Audio::Nama::IO.pm
my @io_test_data = split "\n\n",
my $yaml = q(---
-
class: from_null
ecs_string: -i:null
-
class: to_null
ecs_string: -o:null
-
class: to_wav
args:
name: sax
width: 1
full_path: /foo/.wav/sax_1.wav
ecs_string: -f:s16_le,1,44100,i -o:/foo/.wav/sax_1.wav
-
class: from_wav
args:
playat_output: playat,5
select_output: select,1,4
modifiers:
full_path: test_dir/sax_1.wav
ecs_string: -i:playat,5,select,1,4,test_dir/sax_1.wav
-
class: from_loop
args:
endpoint: sax_in
ecs_string: -i:loop,sax_in
-
class: to_loop
args:
endpoint: sax_out
ecs_string: -o:loop,sax_out
-
class: to_alsa_soundcard_device
ecs_string: -o:alsa,default
-
class: from_alsa_soundcard_device
ecs_string: -i:alsa,default
-
class: from_soundcard
args:
width: 1
source_id: 2
source_type: soundcard
ecs_string: -i:jack_multi,system:capture_2
-
class: to_soundcard
args:
width: 2
send_id: 5
send_type: soundcard
ecs_string: -o:jack_multi,system:playback_5,system:playback_6
-
class: to_jack_port
args:
width: 1
port_name: sax
ecs_string: -f:f32_le,1,44100 -o:jack,,sax_out
-
class: from_jack_port
args:
port_name: sax
width: 2
ecs_string: -f:f32_le,2,44100 -i:jack,,sax_in
-
class: from_jack_client
args:
source_id: Horgand
source_type: jack_client
ecs_string: -i:jack,Horgand
-
class: to_jack_client
args:
send_id: system
send_type: jack_client
ecs_string: -o:jack,system
-
class: to_jack_multi
args:
width: 2
send_id: system
send_type: jack_multi
ecs_string: -o:jack_multi,system:playback_1,system:playback_2
-
class: from_jack_multi
args:
width: 2
source_id: Horgand
source_type: jack_client
ecs_string: -i:jack_multi,Horgand:out_1,Horgand:out_2
...);
t/12_nama.t view on Meta::CPAN
-a:1 -o:alsa,default
-a:3 -o:loop,sax_out
-a:4 -o:loop,Main_in
EXPECTED
gen_alsa();
check_setup('Bus - ALSA');
gen_jack();
$expected_setup_lines = <<EXPECTED;
-a:1 -i:loop,Main_in
-a:3 -i:jack_multi,system:capture_2,system:capture_3
-a:4 -i:loop,sax_out
# audio outputs
-a:1 -o:jack_multi,system:playback_1,system:playback_2
-a:3 -o:loop,sax_out
-a:4 -o:loop,Main_in
EXPECTED
check_setup('Bus - JACK');
nama_cmd('remove_bus Horns');
nama_cmd('add_submix_cooked Vo 5');
$expected_setup_lines = <<EXPECTED;
-a:1,4 -i:loop,sax_out
-a:3 -i:jack_multi,system:capture_2,system:capture_3
# audio outputs
-a:1 -o:jack_multi,system:playback_1,system:playback_2
-a:3 -o:loop,sax_out
-a:4 -o:jack_multi,system:playback_5,system:playback_6
EXPECTED
gen_jack();
check_setup('Create submix with output at soundcard - JACK');
nama_cmd('remove_bus Vo');
nama_cmd('sax mono');
###### Timeline tests
#
# This table tests how the offset run mode affects
# other time displacing operations.
#
# If you have a region, the offset could occur
# before the region, in the middle of the region
# or after the region. Code for each case
# is different. There is further an
# interaction with playat.
#
# The tests are exhaustive, all possible
# combinations are covered.
#
# The numbers indicate time positions.
# asterisk (*) indicates that no output is available
# for that specific field
{
$ENV{NAMA_VERBOSE_TEST_OUTPUT} and diag "Edit mode playat$ENV{NAMA_VERBOSE_TEST_OUTPUT} region endpoints adjustment";
my @tests = split "\n",<<TEST_DATA;
1 12 5 15 4 8 * * * 30 out_of_bounds_near region
2 12 5 15 23 26 * * * 30 out_of_bounds_far region
3 12 5 15 10 17 2 5 10 30 play_start_during_playat_delay region
4 12 5 15 13 21 0 6 14 30 play_start_within_region region
5 12 5 15 21 26 0 14 19 30 play_start_within_region region
6 0 5 15 5 9 0 10 14 30 play_start_within_region region
7 0 0 0 5 9 0 5 9 30 no_region_play_start_after_playat_delay no_playat
8 2 0 0 5 9 0 3 7 30 no_region_play_start_after_playat_delay
9 6 0 0 5 9 1 0 3 30 no_region_play_start_during_playat_delay
10 6 0 0 3 5 * * * 30 out_of_bounds_near no_region
11 6 0 0 40 49 * * * 30 out_of_bounds_far no_region
12 6 0 0 34 40 0 28 30 30 no_region_play_start_after_playat_delay end_after_wav_length
TEST_DATA
foreach(@tests){
#diag($_);
my ($index,
$playat,
$region_start,
$region_end,
$edit_play_start,
$edit_play_end,
$new_playat,
$new_region_start,
$new_region_end,
$length,
$case,
$comment,
) = split " ", $_;
my $args = {
playat => $playat,
region_start => $region_start,
region_end => $region_end,
edit_play_start => $edit_play_start,
edit_play_end => $edit_play_end,
setup_length => $length,
};
is( Audio::Nama::edit_case($args), $case, "$index: $case $comment");
is( Audio::Nama::new_playat($args), $new_playat, "$index: new_playat: $case");
is( Audio::Nama::new_region_start($args), $new_region_start, "$index: new_region_start: $case");
is( Audio::Nama::new_region_end($args), $new_region_end, "$index: new_region_end: $case");
}
}
load_project(name => "test_project-convert51", create => 1);
my $script = <<CONVERT51;
# Patrick Shirkey's stereo-to-5.1 converter script implemented in Nama
#
# This is the algorithm to convert a true stereo track to "fake" 5.1 surround.
# You can change the outputs to suit your 5.1 routing
#
# channel 1 - Left Front : left input
# channel 2 - Right Front : right input
( run in 0.623 second using v1.01-cache-2.11-cpan-aadc1410aed )