Audio-Nama

 view release on metacpan or  search on metacpan

lib/Audio/Nama/Engine.pm  view on Meta::CPAN

{
package Audio::Nama::Engine;
our $VERSION = 1.0;
use Modern::Perl '2020';
use Carp;
our @ISA;
our %by_name;
our @ports = (57000..57050);
our %port = (
	fof => 57201,
	bus => 57202,
);
use Audio::Nama::Globals qw(:all);
use Role::Tiny::With;
with 'Audio::Nama::EcasoundSetup';
use Audio::Nama::Object qw( 
name 
port 
jack_seek_delay 
jack_transport_mode
events
socket
pids
ecasound
buffersize
ready

				 );

sub new {
	my $class = shift;	
	my %vals = @_;
	croak "undeclared field: @_" if grep{ ! $_is_field{$_} } keys %vals;
	Audio::Nama::pager_newline("$vals{name}: returning existing engine"), 
		return $by_name{$vals{name}} if $by_name{$vals{name}};
	my $self = bless { name => 'default', %vals }, $class;
	#print "object class: $class, object type: ", ref $self, $/;
	$by_name{ $self->name } = $self;
	$self->initialize_ecasound();
	$this_engine = $self;
}
sub initialize_ecasound { 
	my $self = shift;
 	my @existing_pids = split " ", qx(pgrep ecasound);
	$self->launch_ecasound_server;
	$self->{pids} = [ 
		grep{ 	my $pid = $_; ! grep{ $pid == $_ } @existing_pids }	
		split " ", qx(pgrep ecasound) 
	];
}
sub launch_ecasound_server {}

sub kill_and_reap {
		my $self = shift;
		Audio::Nama::kill_and_reap( @{$self->{pids}} );
}
sub tracks {
	my $self = shift;
	my @tracks = grep { $self->name eq $_->engine_group } Audio::Nama::all_tracks();
}
sub ecasound_iam {}

# the purpose of the following methods is to cache results
# from the engine, so we don't burden it with extra

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.500 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )