Exemplo n.º 1
0
static void runAddingBandpass_iir(LADSPA_Handle instance, unsigned long sample_count) {
	Bandpass_iir *plugin_data = (Bandpass_iir *)instance;

	/* Center Frequency (Hz) (float value) */
	const LADSPA_Data center = *(plugin_data->center);

	/* Bandwidth (Hz) (float value) */
	const LADSPA_Data width = *(plugin_data->width);

	/* Stages(2 poles per stage) (float value) */
	const LADSPA_Data stages = *(plugin_data->stages);

	/* Input (array of floats of length sample_count) */
	const LADSPA_Data * const input = plugin_data->input;

	/* Output (array of floats of length sample_count) */
	LADSPA_Data * const output = plugin_data->output;
	iir_stage_t* first = plugin_data->first;
	iir_stage_t* gt = plugin_data->gt;
	iirf_t* iirf = plugin_data->iirf;
	float lfc = plugin_data->lfc;
	long sample_rate = plugin_data->sample_rate;
	iir_stage_t* second = plugin_data->second;
	float ufc = plugin_data->ufc;

	ufc = (center + width*0.5f)/(float)sample_rate;
	lfc = (center - width*0.5f)/(float)sample_rate;
	combine_iir_stages(IIR_STAGE_BANDPASS, gt, first, second,
	                   chebyshev(iirf, first,  2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS,  ufc, 0.5f),
	                   chebyshev(iirf, second, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f));
	iir_process_buffer_ns_5(iirf, gt, input, output, sample_count,RUN_ADDING);
}
Exemplo n.º 2
0
static void runBandpass_iir(LV2_Handle instance, uint32_t sample_count)
{
  Bandpass_iir *plugin_data = (Bandpass_iir *)instance;

  const float center = *(plugin_data->center);
  const float width = *(plugin_data->width);
  const float stages = *(plugin_data->stages);
  const float * const input = plugin_data->input;
  float * const output = plugin_data->output;
  iirf_t* iirf = plugin_data->iirf;
  iir_stage_t* gt = plugin_data->gt;
  iir_stage_t* first = plugin_data->first;
  iir_stage_t* second = plugin_data->second;
  long sample_rate = plugin_data->sample_rate;
  float ufc = plugin_data->ufc;
  float lfc = plugin_data->lfc;
  
                  ufc = (center + width*0.5f)/(float)sample_rate;
                  lfc = (center - width*0.5f)/(float)sample_rate;
                  combine_iir_stages(IIR_STAGE_BANDPASS, gt, first, second,
                                     chebyshev(iirf, first,  2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS,  ufc, 0.5f),
                                     chebyshev(iirf, second, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f));
                  iir_process_buffer_ns_5(iirf, gt, input, output, sample_count);
                
}
Exemplo n.º 3
0
static void activateBandpass_iir(LV2_Handle instance)
{
  Bandpass_iir *plugin_data = (Bandpass_iir *)instance;
  iirf_t* iirf __attribute__ ((unused)) = plugin_data->iirf;
  iir_stage_t* gt __attribute__ ((unused)) = plugin_data->gt;
  iir_stage_t* first __attribute__ ((unused)) = plugin_data->first;
  iir_stage_t* second __attribute__ ((unused)) = plugin_data->second;
  long sample_rate __attribute__ ((unused)) = plugin_data->sample_rate;
  float ufc __attribute__ ((unused)) = plugin_data->ufc;
  float lfc __attribute__ ((unused)) = plugin_data->lfc;
                    
                  plugin_data->ufc = (*(plugin_data->center) + *(plugin_data->width)*0.5f)/(float)sample_rate;
                  plugin_data->lfc = (*(plugin_data->center) - *(plugin_data->width)*0.5f)/(float)sample_rate;
                  plugin_data->first = init_iir_stage(IIR_STAGE_LOWPASS,10,3,2);
                  plugin_data->second = init_iir_stage(IIR_STAGE_HIGHPASS,10,3,2);                  
                  plugin_data->gt = init_iir_stage(IIR_STAGE_BANDPASS,20,3,2); 
                  plugin_data->iirf = init_iirf_t(plugin_data->gt);
                  chebyshev(plugin_data->iirf, plugin_data->first, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_LOWPASS, plugin_data->ufc, 0.5f);
                  chebyshev(plugin_data->iirf, plugin_data->second, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_HIGHPASS, plugin_data->lfc, 0.5f);
                  combine_iir_stages(IIR_STAGE_BANDPASS, plugin_data->gt, plugin_data->first, plugin_data->second,0,0);
                
}