Audio-Nama
view release on metacpan or search on metacpan
lib/Audio/Nama/Jack.pm view on Meta::CPAN
# ------- Jack port connect routines -------
package Audio::Nama;
use v5.36;
use File::Slurp;
no warnings 'uninitialized';
# general functions
sub update_jack_client_list {
state $warn_count;
#logsub((caller(0))[3]);
# cache current JACK status
# skip if Ecasound is busy
return if $this_engine->started();
if( $jack->{jackd_running} = process_is_running('jackd') ){
# reset our clients data
$jack->{clients} = {};
$jack->{use_jacks}
? jacks_get_port_latency()
: parse_port_latency();
parse_ports_list();
my ($bufsize) = qx(jack_bufsize);
($jack->{periodsize}) = $bufsize =~ /(\d+)/;
my ($sample_rate) = qx(jack_samplerate);
chomp $sample_rate;
$project->{name}
and $sample_rate != $project->{sample_rate}
and ($warn_count == 1 or $warn_count % 8 == 0) # warn less often
and Audio::Nama::throw(qq(
JACK audio daemon sample rate is $sample_rate but sample rate for project "$project->{name}" is $project->{sample_rate}.
Please fix this problem before continuing (maybe restart jackd with --rate $project->{sample_rate}?))),
print prompt();
$warn_count++;
} else { }
}
sub client_port {
my $name = shift;
$name =~ /(.+?):([^:]+)$/;
=comment
$name =~ /
(?<client>.+?) # anything, non-greedy
: # a colon
(?<port>[^:]+$) # non-colon stuff to end
/x;
@+{qw(client port)}
=cut
$1, $2
}
sub jack_client_array {
# returns array of ports if client and direction exist
my ($name, $direction) = @_;
$jack->{clients}->{$name}{$direction} // []
}
sub jacks_get_port_latency {
logsub((caller(0))[3]);
delete $jack->{clients};
my $jc;
( run in 0.555 second using v1.01-cache-2.11-cpan-5a3173703d6 )