Audio-Nama

 view release on metacpan or  search on metacpan

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

# ----------- Ecasound cleanup (post-recording) -----------
package Audio::Nama::EcasoundCleanup;
use Role::Tiny;
use Modern::Perl '2020';
our $VERSION = 1.0;
sub cleanup {
	my $self = shift;
	Audio::Nama::rec_cleanup();
}


package Audio::Nama;
use Modern::Perl '2020';
use Cwd;
use File::Spec::Functions qw(splitpath);
use Audio::Nama::Globals qw(:all);

sub rec_cleanup {  
	logsub((caller(0))[3]);
	logpkg(__FILE__,__LINE__,'debug',"transport still running, can't cleanup"), return if $this_engine->running;
	if( my (@files) = new_files_were_recorded() )
	{
		if( my @rec_tracks = Audio::Nama::ChainSetup::engine_wav_out_tracks() )
		{
			$project->{playback_position} = 0;
			$setup->{_last_rec_tracks} = \@rec_tracks;
		}

		if( grep /Mixdown/, @files) { 
				mixdown_postprocessing() ;
				mixplay();
		}
		post_rec_configure() 
	}
}
sub mixdown_postprocessing {
	logsub((caller(0))[3]);
	nama_cmd('mixplay');
	my ($oldfile) = $tn{Mixdown}->full_path =~ m{([^/]+)$};
	$oldfile = join_path('.wav',$oldfile);
	my $tag_name = join '-', $project->{name}, current_branch();
	my $version = $tn{Mixdown}->playback_version;

	# simplify the tagname basename 
	# 
	# 	untitled-master        -> untitled
	#   untitled-premix-branch -> untitled-premix
	
	$tag_name =~ s/-branch$//;
	$tag_name =~ s/-master$//;
	$tag_name .= "_$version";

	delete_existing_mixdown_tag_and_convenience_encodings($tag_name);

	# create symlink in project_dir()
	
	my $was_in = getcwd;
	chdir project_dir() or die "couldn't chdir: $!";
	my $newfile = "$tag_name.wav";
	logpkg(__FILE__,__LINE__,'debug',"symlinking oldfile: $oldfile, newfile: $newfile");
	symlink $oldfile, $newfile or throw("symlink didn't work: $!");
	tag_mixdown_commit($tag_name, $newfile, $oldfile) if $config->{use_git};

	my $sha = git_sha(); # possibly undef
	my $encoding = $config->{mixdown_encodings};
	my $comment;
	if ($sha or $encoding){
		$comment .= "tagged " if $sha;
		$comment .= "and " if $sha and $encoding;
		$comment .= "encoded " if $encoding;
		$comment .= "as $tag_name ";
		$comment .= "(commit $sha)" if $sha;
	}

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

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