static gboolean gst_ladspa_setup (GstSignalProcessor * gsp, guint sample_rate) { GstLADSPA *ladspa; GstLADSPAClass *oclass; GstSignalProcessorClass *gsp_class; LADSPA_Descriptor *desc; int i; gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp); ladspa = (GstLADSPA *) gsp; oclass = (GstLADSPAClass *) gsp_class; desc = ladspa->descriptor; g_return_val_if_fail (ladspa->handle == NULL, FALSE); g_return_val_if_fail (ladspa->activated == FALSE, FALSE); GST_DEBUG_OBJECT (ladspa, "instantiating the plugin at %d Hz", sample_rate); ladspa->handle = desc->instantiate (desc, sample_rate); g_return_val_if_fail (ladspa->handle != NULL, FALSE); /* connect the control ports */ for (i = 0; i < gsp_class->num_control_in; i++) desc->connect_port (ladspa->handle, oclass->control_in_portnums[i], &(gsp->control_in[i])); for (i = 0; i < gsp_class->num_control_out; i++) desc->connect_port (ladspa->handle, oclass->control_out_portnums[i], &(gsp->control_out[i])); return TRUE; }
static void gst_ladspa_cleanup (GstSignalProcessor * gsp) { GstLADSPA *ladspa; LADSPA_Descriptor *desc; ladspa = (GstLADSPA *) gsp; desc = ladspa->descriptor; g_return_if_fail (ladspa->activated == FALSE); g_return_if_fail (ladspa->handle != NULL); GST_DEBUG_OBJECT (ladspa, "cleaning up"); if (desc->cleanup) desc->cleanup (ladspa->handle); ladspa->handle = NULL; }
static void gst_ladspa_stop (GstSignalProcessor * gsp) { GstLADSPA *ladspa; LADSPA_Descriptor *desc; ladspa = (GstLADSPA *) gsp; desc = ladspa->descriptor; g_return_if_fail (ladspa->activated == TRUE); g_return_if_fail (ladspa->handle != NULL); GST_DEBUG_OBJECT (ladspa, "deactivating"); if (desc->activate) desc->activate (ladspa->handle); ladspa->activated = FALSE; }
static gboolean gst_ladspa_start (GstSignalProcessor * gsp) { GstLADSPA *ladspa; LADSPA_Descriptor *desc; ladspa = (GstLADSPA *) gsp; desc = ladspa->descriptor; g_return_val_if_fail (ladspa->activated == FALSE, FALSE); g_return_val_if_fail (ladspa->handle != NULL, FALSE); GST_DEBUG_OBJECT (ladspa, "activating"); if (desc->activate) desc->activate (ladspa->handle); ladspa->activated = TRUE; return TRUE; }
static void gst_ladspa_process (GstSignalProcessor * gsp, guint nframes) { GstSignalProcessorClass *gsp_class; GstLADSPA *ladspa; GstLADSPAClass *oclass; LADSPA_Descriptor *desc; guint i; gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp); ladspa = (GstLADSPA *) gsp; oclass = (GstLADSPAClass *) gsp_class; desc = ladspa->descriptor; for (i = 0; i < gsp_class->num_audio_in; i++) desc->connect_port (ladspa->handle, oclass->audio_in_portnums[i], gsp->audio_in[i]); for (i = 0; i < gsp_class->num_audio_out; i++) desc->connect_port (ladspa->handle, oclass->audio_out_portnums[i], gsp->audio_out[i]); desc->run (ladspa->handle, nframes); }