예제 #1
0
파일: jack_rack.c 프로젝트: mcfrisk/mlt
void
jack_rack_add_saved_plugin (jack_rack_t * jack_rack, saved_plugin_t * saved_plugin)
{
  plugin_t * plugin = jack_rack_instantiate_plugin (jack_rack, saved_plugin->settings->desc);
  if (!plugin)
    return;
  jack_rack->saved_plugins = g_slist_append (jack_rack->saved_plugins, saved_plugin);
  process_add_plugin (jack_rack->procinfo, plugin);
  jack_rack_add_plugin (jack_rack, plugin);
}
예제 #2
0
파일: jack_rack.c 프로젝트: bmatherly/mlt
void
jack_rack_add_saved_plugin (jack_rack_t * jack_rack, saved_plugin_t * saved_plugin)
{
  plugin_t * plugin = jack_rack_instantiate_plugin (jack_rack, saved_plugin->settings->desc);
  if (!plugin)
    {
      mlt_log_warning( NULL, "%s: could not instantiate object file '%s'\n",
                       __FUNCTION__, saved_plugin->settings->desc->object_file);
      return;
    }
  jack_rack->saved_plugins = g_slist_append (jack_rack->saved_plugins, saved_plugin);
  process_add_plugin (jack_rack->procinfo, plugin);
  jack_rack_add_plugin (jack_rack, plugin);
}
예제 #3
0
파일: producer_ladspa.c 프로젝트: aib/mlt
static jack_rack_t* initialise_jack_rack( mlt_properties properties, int channels )
{
	jack_rack_t *jackrack = NULL;
	unsigned long plugin_id = mlt_properties_get_int64( properties, "_pluginid" );

	// Start JackRack
	if ( plugin_id )
	{
		// Create JackRack without Jack client name so that it only uses LADSPA
		jackrack = jack_rack_new( NULL, channels );
		mlt_properties_set_data( properties, "_jackrack", jackrack, 0,
			(mlt_destructor) jack_rack_destroy, NULL );

		// Load one LADSPA plugin by its UniqueID
		plugin_desc_t *desc = plugin_mgr_get_any_desc( jackrack->plugin_mgr, plugin_id );
		plugin_t *plugin;

		if ( desc && ( plugin = jack_rack_instantiate_plugin( jackrack, desc ) ) )
		{
			LADSPA_Data value;
			int index, c;

			plugin->enabled = TRUE;
			plugin->wet_dry_enabled = FALSE;
			for ( index = 0; index < desc->control_port_count; index++ )
			{
				// Apply the control port values
				char key[20];
				value = plugin_desc_get_default_control_value( desc, index, sample_rate );
				snprintf( key, sizeof(key), "%d", index );
				if ( mlt_properties_get( properties, key ) )
					value = mlt_properties_get_double( properties, key );
				for ( c = 0; c < plugin->copies; c++ )
					plugin->holders[c].control_memory[index] = value;
			}
			process_add_plugin( jackrack->procinfo, plugin );
		}
		else
		{
			mlt_log_error( properties, "failed to load plugin %lu\n", plugin_id );
		}
	}

	return jackrack;
}
예제 #4
0
파일: filter_ladspa.c 프로젝트: amongll/mlt
static jack_rack_t* initialise_jack_rack( mlt_properties properties, int channels )
{
	jack_rack_t *jackrack = NULL;
	char *resource = mlt_properties_get( properties, "resource" );
	if ( !resource && mlt_properties_get( properties, "src" ) )
		resource = mlt_properties_get( properties, "src" );

	// Start JackRack
	if ( resource || mlt_properties_get_int64( properties, "_pluginid" ) )
	{
		// Create JackRack without Jack client name so that it only uses LADSPA
		jackrack = jack_rack_new( NULL, channels );
		mlt_properties_set_data( properties, "jackrack", jackrack, 0,
			(mlt_destructor) jack_rack_destroy, NULL );

		if ( resource )
			// Load JACK Rack XML file
			jack_rack_open_file( jackrack, resource );
		else if ( mlt_properties_get_int64( properties, "_pluginid" ) )
		{
			// Load one LADSPA plugin by its UniqueID
			unsigned long id = mlt_properties_get_int64( properties, "_pluginid" );
			plugin_desc_t *desc = plugin_mgr_get_any_desc( jackrack->plugin_mgr, id );
			plugin_t *plugin;
			if ( desc && ( plugin = jack_rack_instantiate_plugin( jackrack, desc ) ) )
			{
				plugin->enabled = TRUE;
				process_add_plugin( jackrack->procinfo, plugin );
				mlt_properties_set_int( properties, "instances", plugin->copies );
			}
			else
			{
				mlt_log_error( properties, "failed to load plugin %lu\n", id );
				return jackrack;
			}

			if ( plugin && plugin->desc && plugin->copies == 0 )
			{
				mlt_log_warning( properties, "Not compatible with %d channels. Requesting %d channels instead.\n", channels, plugin->desc->channels );
				jackrack = initialise_jack_rack( properties, plugin->desc->channels );
			}
		}
	}
	return jackrack;
}
예제 #5
0
static jack_rack_t* initialise_jack_rack( mlt_properties properties, int channels )
{
	jack_rack_t *jackrack = NULL;
	char *resource = mlt_properties_get( properties, "resource" );
	if ( !resource && mlt_properties_get( properties, "src" ) )
		resource = mlt_properties_get( properties, "src" );

	// Start JackRack
	if ( resource || mlt_properties_get_int64( properties, "_pluginid" ) )
	{
		// Create JackRack without Jack client name so that it only uses LADSPA
		jackrack = jack_rack_new( NULL, channels );
		mlt_properties_set_data( properties, "jackrack", jackrack, 0,
			(mlt_destructor) jack_rack_destroy, NULL );

		if ( resource )
			// Load JACK Rack XML file
			jack_rack_open_file( jackrack, resource );
		else if ( mlt_properties_get_int64( properties, "_pluginid" ) )
		{
			// Load one LADSPA plugin by its UniqueID
			unsigned long id = mlt_properties_get_int64( properties, "_pluginid" );
			plugin_desc_t *desc = plugin_mgr_get_any_desc( jackrack->plugin_mgr, id );
			plugin_t *plugin;
			if ( desc && ( plugin = jack_rack_instantiate_plugin( jackrack, desc ) ) )
			{
				plugin->enabled = TRUE;
				process_add_plugin( jackrack->procinfo, plugin );
				mlt_properties_set_int( properties, "instances", plugin->copies );
			}
			else
			{
				mlt_log_error( properties, "failed to load plugin %lu\n", id );
				return jackrack;
			}

			if ( plugin && plugin->desc && plugin->copies == 0 )
			{
				// Calculate the number of channels that will work with this plugin
				int request_channels = plugin->desc->channels;
				while ( request_channels < channels )
					request_channels += plugin->desc->channels;

				if ( request_channels != channels )
				{
					// Try to load again with a compatible number of channels.
					mlt_log_warning( properties, "Not compatible with %d channels. Requesting %d channels instead.\n",
						channels, request_channels );
					jack_rack_destroy( jackrack );
					jackrack = initialise_jack_rack( properties, request_channels );
				}
				else
				{
					mlt_log_error( properties, "Invalid plugin configuration: %lu\n", id );
					return jackrack;
				}
			}

			if ( plugin && plugin->desc && plugin->copies )
				mlt_log_debug( properties, "Plugin Initialized. Channels: %lu\tCopies: %d\tTotal: %lu\n", plugin->desc->channels, plugin->copies, jackrack->channels );
		}
	}
	return jackrack;
}
예제 #6
0
int process_control_messages (process_info_t * procinfo)
{
  static int quitting = 0;
  ctrlmsg_t ctrlmsg;
  int err = 0;
  
  if (quitting)
	  return quitting;
  
  while (lff_read (procinfo->ui_to_process, &ctrlmsg) == 0)
    {
  
    switch (ctrlmsg.type)
      {
      /* add a link to the end of the plugin chain */
      case CTRLMSG_ADD:
        process_add_plugin (procinfo, ctrlmsg.data.add.plugin);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
        
      /* remove a link (plugin will be sent back) */
      case CTRLMSG_REMOVE:
        ctrlmsg.data.remove.plugin =
          process_remove_plugin (procinfo, ctrlmsg.data.remove.plugin);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
        
      /* enable/disable a plugin */
      case CTRLMSG_ABLE:
        process_ablise_plugin (procinfo,
                               ctrlmsg.data.ablise.plugin,
                               ctrlmsg.data.ablise.enable);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
      
      /* enable/disable wet/dry controls */
      case CTRLMSG_ABLE_WET_DRY:
        process_ablise_plugin_wet_dry (procinfo,
                               ctrlmsg.data.ablise.plugin,
                               ctrlmsg.data.ablise.enable);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
        
      /* move a plugin up or down */  
      case CTRLMSG_MOVE:
        process_move_plugin (procinfo,
                             ctrlmsg.data.move.plugin,
                             ctrlmsg.data.move.up);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
              
      /* change an existing plugin for a new one (existing plugin
         will be sent back) */
      case CTRLMSG_CHANGE:
        ctrlmsg.data.change.old_plugin = 
          process_change_plugin (procinfo,
                                 ctrlmsg.data.change.old_plugin,
                                 ctrlmsg.data.change.new_plugin);
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break;
      
      /* remove all the plugins and send them back */
/*      case CTRLMSG_CLEAR:
        ctrlmsg.data.clear.chain = procinfo->chain;
        procinfo->chain = NULL;
        procinfo->chain_end = NULL;
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        break; */
        
      case CTRLMSG_QUIT:
        quitting = 1;
        err = lff_write (procinfo->process_to_ui, &ctrlmsg);
        return 1;

      default:
        break;
      }
    
    if (err)
      {
        _display_error ( _error_cb_data, E_ERROR, _("%s: GUI FIFO is out of space\n"), __FUNCTION__ );
        return err;
      }
      
    }
    
  return 0;
}