Audio-Nama

 view release on metacpan or  search on metacpan

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

## -------------- Effects registry ---------------

package Audio::Nama;
use Modern::Perl '2020';
use Audio::Nama::Util qw(round);
no warnings 'uninitialized';

## register data about LADSPA plugins, and Ecasound effects and
#  presets (names, ids, parameters, hints) 

sub prepare_static_effects_data{
	my $source = shift; 
	
	logsub((caller(0))[3]);

	if (not is_test_script() ){
		logpkg(__FILE__,__LINE__,'debug', join "\n", "newplugins:", new_plugins());
		if (! $source and ($config->{opts}->{r} or new_plugins())){ 

			rename $file->effects_cache, $file->effects_cache . ".bak";
			print "Regenerating effects data cache\n";
		}
	}

	# maybe $source
	
	if ($config->{opts}->{T} )
	{
		logpkg(__FILE__,__LINE__,'debug', "using dummy effects data");
		$source = $fx_cache->{fake};
	}
	elsif (-f $file->effects_cache and ! $config->{opts}->{C})
	{  
		logpkg(__FILE__,__LINE__,'debug', "found effects cache: ",$file->effects_cache);
		$source = read_file($file->effects_cache); # scalar assign
	} 
	if ($source)
	{
		assign(
			data => decode($source, 'json'),
			vars => [qw($fx_cache)],
			class => 'Audio::Nama'
		);
	}
	else 
	{
		logpkg(__FILE__,__LINE__,'debug', "reading in effects data, please wait...");
		initialize_effect_index();
		read_in_effects_data();  
		# cop-register, preset-register, ctrl-register, ladspa-register
		get_ladspa_hints();     
		get_lv2_hints() unless $config->{opts}->{J};
		integrate_ladspa_hints();
		integrate_cop_hints();
		sort_ladspa_effects();
		logpkg(__FILE__,__LINE__,'debug', "updating effects cache on disk: ",$file->effects_cache);
		serialize (
			file => $file->effects_cache, 
			vars => [qw($fx_cache)],
			class => 'Audio::Nama',
			format => 'json') unless is_test_script();
				
	}
	generate_mappings_for_shortcuts();

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

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