Audio-Nama
view release on metacpan or search on metacpan
lib/Audio/Nama/Track.pm view on Meta::CPAN
my $status = $track->rec_status;
#logpkg(__FILE__,__LINE__,'debug', "last: $last status: $status");
if ($status eq REC){ return ++$last}
elsif ( $status eq PLAY){ return $track->playback_version }
else { return 0 }
}
sub playat_time {
logpkg(__FILE__,__LINE__,'logcluck',$_[0]->name . "->playat_time");
$_[0]->play_start_time
}
}
{
package Audio::Nama::VersionTrack;
use Audio::Nama::Globals qw(:all);
use Audio::Nama::Log qw(logpkg);
our $VERSION = 1.0;
our @ISA ='Audio::Nama::Track';
sub set_version {}
sub versions { [$_[0]->version] }
}
{
package Audio::Nama::Clip;
# Clips are the units of audio used to
# to make sequences.
# A clip is created from a track. Clips extend the Track
# class in providing a position which derives from the
# object's ordinal position in an array (clips attribute) of
# the parent sequence object.
# Clips differ from tracks in that clips
# their one-based position (index) in the sequence items array.
# index is one-based.
use Audio::Nama::Globals qw(:all);
use Audio::Nama::Log qw(logpkg);
our $VERSION = 1.0;
our @ISA = qw( Audio::Nama::VersionTrack Audio::Nama::Track );
sub sequence { my $self = shift; $Audio::Nama::bn{$self->group} };
sub index { my $self = shift; my $i = 0;
for( @{$self->sequence->items} ){
$i++;
return $i if $self->name eq $_
}
}
sub predecessor {
my $self = shift;
$self->sequence->clip($self->index - 1)
}
sub duration {
my $self = shift;
$self->{duration}
? Audio::Nama::Mark::duration_from_tag($self->{duration})
: $self->is_region
? $self->region_end_time - $self->region_start_time
: $self->wav_length;
}
sub endpoint {
my $self = shift;
$self->duration + ( $self->predecessor ? $self->predecessor->endpoint : 0 )
}
sub playat_time {
my $self = shift;
my $previous = $self->predecessor;
$previous ? $previous->endpoint : 0
}
sub rec_status { $_[0]->version ? PLAY : OFF }
# we currently are not compatible with offset run mode
# perhaps we can enforce OFF status for clips under
# offset run mode
} # end package
{
package Audio::Nama::Spacer;
our $VERSION = 1.0;
our @ISA = 'Audio::Nama::Clip';
use SUPER;
use Audio::Nama::Object qw(duration);
sub rec_status { OFF }
sub new {
my ($class,%args) = @_;
# remove args we will process
my $duration = delete $args{duration};
# give the remainder to the superclass constructor
@_ = ($class, %args);
my $self = super();
#logpkg(__FILE__,__LINE__,'debug',"new object: ", json_out($self->as_hash));
#logpkg(__FILE__,__LINE__,'debug', "items: ",json_out($items));
# set the args removed above
$self->{duration} = $duration;
$self;
}
} # end package
{
package Audio::Nama::WetTrack; # for inserts
use Audio::Nama::Globals qw(:all);
use v5.36; use Audio::Nama::Log qw(logpkg);
our $VERSION = 1.0;
our @ISA = 'Audio::Nama::SlaveTrack';
}
{
package Audio::Nama::MidiTrack;
use Audio::Nama::Globals qw(:all);
use v5.36;
our $VERSION = 1.0;
use SUPER;
use Audio::Nama::Log qw(logpkg);
our @ISA = qw(Audio::Nama::Track);
sub new {
my ($class, %args) = @_;
my $self = super();
$self
}
# TODO enable
sub mute {
my $track = shift;
if ( $track->exists_midi )
{
Audio::Nama::midish_cmd( 'mute ' . $_[0]->current_midi )
}
( run in 0.639 second using v1.01-cache-2.11-cpan-5735350b133 )