Exemple #1
0
static void runAddingDj_eq(LADSPA_Handle instance, unsigned long sample_count) {
	Dj_eq *plugin_data = (Dj_eq *)instance;
	LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;

	/* Lo gain (dB) (float value) */
	const LADSPA_Data lo = *(plugin_data->lo);

	/* Mid gain (dB) (float value) */
	const LADSPA_Data mid = *(plugin_data->mid);

	/* Hi gain (dB) (float value) */
	const LADSPA_Data hi = *(plugin_data->hi);

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

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

	/* Output L (array of floats of length sample_count) */
	LADSPA_Data * const left_output = plugin_data->left_output;

	/* Output R (array of floats of length sample_count) */
	LADSPA_Data * const right_output = plugin_data->right_output;
	biquad * filters = plugin_data->filters;
	float fs = plugin_data->fs;

#line 42 "dj_eq_1901.xml"
	unsigned long pos;
	unsigned int i;
	float samp;

	for (i=0; i<2; i++) {
	  eq_set_params(&filters[i*BANDS + 0], 100.0f, lo, PEAK_BW, fs);
	  eq_set_params(&filters[i*BANDS + 1], 1000.0f, mid, PEAK_BW, fs);
	  hs_set_params(&filters[i*BANDS + 2], 10000.0f, hi, SHELF_SLOPE, fs);
	}

	for (pos = 0; pos < sample_count; pos++) {
	  samp = biquad_run(&filters[0], left_input[pos]);
	  samp = biquad_run(&filters[1], samp);
	  samp = biquad_run(&filters[2], samp);
	  buffer_write(left_output[pos], samp);

	  samp = biquad_run(&filters[3], right_input[pos]);
	  samp = biquad_run(&filters[4], samp);
	  samp = biquad_run(&filters[5], samp);
	  buffer_write(right_output[pos], samp);
	}

	*(plugin_data->latency) = 3; //XXX is this right?
}
Exemple #2
0
static 
LADSPA_Handle 
instantiate_eq(const LADSPA_Descriptor *descriptor, unsigned long s_rate) {

	eq *ptr = (eq *)malloc(sizeof(eq));
	biquad *filters = NULL;
	float fs;

	fs = s_rate;
	
	filters = calloc(8, sizeof(biquad));

	ptr->filters = filters;
	ptr->fs = fs;
	ptr->run_adding_gain = 1.0f;

	eq_set_params(&filters[0], 100.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[1], 200.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[2], 400.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[3], 1000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[4], 3000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[5], 6000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[6], 12000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[7], 15000.0f, 0.0f, BWIDTH, fs);

	return (LADSPA_Handle)ptr;
}
Exemple #3
0
static
LV2_Handle
instantiate_eq(const LV2_Descriptor *descriptor, double s_rate, const char* bundle_path, const LV2_Feature* const* features) {

	eq *ptr = (eq *)malloc(sizeof(eq));
	biquad *filters = NULL;
	float fs;

	fs = s_rate;

	memset(ptr, 0, sizeof(eq));

	filters = calloc(8, sizeof(biquad));

	ptr->filters = filters;
	ptr->fs = fs;

	ptr->old_ch0f = 100.0f;
	ptr->old_ch0g = 0.0f;
	ptr->old_ch0b = BWIDTH;

	ptr->old_ch1f = 200.0f;
	ptr->old_ch1g = 0.0f;
	ptr->old_ch1b = BWIDTH;

	ptr->old_ch2f = 400.0f;
	ptr->old_ch2g = 0.0f;
	ptr->old_ch2b = BWIDTH;

	ptr->old_ch3f = 1000.0f;
	ptr->old_ch3g = 0.0f;
	ptr->old_ch3b = BWIDTH;

	ptr->old_ch4f = 3000.0f;
	ptr->old_ch4g = 0.0f;
	ptr->old_ch4b = BWIDTH;

	ptr->old_ch5f = 6000.0f;
	ptr->old_ch5g = 0.0f;
	ptr->old_ch5b = BWIDTH;

	ptr->old_ch6f = 12000.0f;
	ptr->old_ch6g = 0.0f;
	ptr->old_ch6b = BWIDTH;

	ptr->old_ch7f = 15000.0f;
	ptr->old_ch7g = 0.0f;
	ptr->old_ch7b = BWIDTH;

	eq_set_params(&filters[0], 100.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[1], 200.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[2], 400.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[3], 1000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[4], 3000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[5], 6000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[6], 12000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[7], 15000.0f, 0.0f, BWIDTH, fs);

	return (LV2_Handle)ptr;
}
Exemple #4
0
static void activateDj_eq_mono(LADSPA_Handle instance) {
	Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
	biquad *filters = plugin_data->filters;
	float fs = plugin_data->fs;
#line 33 "dj_eq_1901.xml"
	biquad_init(&filters[0]);
	eq_set_params(&filters[0], 100.0f, 0.0f, PEAK_BW, fs);
	biquad_init(&filters[1]);
	eq_set_params(&filters[1], 1000.0f, 0.0f, PEAK_BW, fs);
	biquad_init(&filters[2]);
	hs_set_params(&filters[2], 10000.0f, 0.0f, SHELF_SLOPE, fs);
	plugin_data->filters = filters;
	plugin_data->fs = fs;

}
Exemple #5
0
static void runAddingSinglePara(LADSPA_Handle instance, unsigned long sample_count) {
	SinglePara *plugin_data = (SinglePara *)instance;
	LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;

	/* Gain (dB) (float value) */
	const LADSPA_Data gain = *(plugin_data->gain);

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

	/* Bandwidth (octaves) (float value) */
	const LADSPA_Data bw = *(plugin_data->bw);

	/* 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;
	biquad * filter = plugin_data->filter;
	float fs = plugin_data->fs;

#line 34 "single_para_1203.xml"
	unsigned long pos;

	eq_set_params(filter, fc, gain, bw, fs);

	for (pos = 0; pos < sample_count; pos++) {
	  buffer_write(output[pos], biquad_run(filter, input[pos]));
	}
}
Exemple #6
0
void kr_eq_process2(kr_eq *eq, float *input, float *output, int num_samples,
 int broadcast) {

  int b, s;
  int recompute;
  int recompute_default;
  void *ptr;

  ptr = NULL;

  if (eq->new_sample_rate != eq->sample_rate) {
    eq->sample_rate = eq->new_sample_rate;
    recompute_default = 1;
  } else {
    recompute_default = 0;
  }

  for (b = 0; b < KR_EQ_MAX_BANDS; b++) {
    //if ((kr_eq->band[b].db == 0.0f) && (!kr_eq->band[b].krad_easing_db.active)) {
    //  continue;
    //}
   // eq->address.sub_id2 = b;
    recompute = recompute_default;
    if (kr_easer_active(&eq->band[b].hz_easer)) {
      eq->band[b].hz = kr_easer_process(&eq->band[b].hz_easer, eq->band[b].hz, &ptr);
      recompute = 1;
      if (broadcast == 1) {
//        krad_radio_broadcast_subunit_control(eq->mixer->broadcaster,
//         &eq->address, HZ, eq->band[b].hz, ptr);
      }
    }
    if (kr_easer_active(&eq->band[b].db_easer)) {
      eq->band[b].db = kr_easer_process(&eq->band[b].db_easer, eq->band[b].db, &ptr);
      recompute = 1;
      if (broadcast == 1) {
//        krad_radio_broadcast_subunit_control(eq->mixer->broadcaster, &eq->address, DB, eq->band[b].db, ptr);
      }
    }
    if (kr_easer_active(&eq->band[b].bw_easer)) {
      eq->band[b].bw = kr_easer_process(&eq->band[b].bw_easer, eq->band[b].bw, &ptr);
      recompute = 1;
      if (broadcast == 1) {
//        krad_radio_broadcast_subunit_control(eq->mixer->broadcaster, &eq->address, BW, eq->band[b].bw, ptr);
      }
    }
    if (recompute == 1) {
      eq_set_params(&eq->band[b].filter, eq->band[b].hz, eq->band[b].db,
       eq->band[b].bw, eq->sample_rate);
    }
    if (eq->band[b].db != 0.0f) {
      for (s = 0; s < num_samples; s++) {
        output[s] = biquad_run(&eq->band[b].filter, input[s]);
      }
    }
  }
}
Exemple #7
0
static void activateDj_eq(LADSPA_Handle instance) {
	Dj_eq *plugin_data = (Dj_eq *)instance;
	biquad *filters = plugin_data->filters;
	float fs = plugin_data->fs;
#line 33 "dj_eq_1901.xml"
	int i;

	for (i=0; i<2; i++) {
	  biquad_init(&filters[i*BANDS + 0]);
	  eq_set_params(&filters[i*BANDS + 0], 100.0f, 0.0f, PEAK_BW, fs);
	  biquad_init(&filters[i*BANDS + 1]);
	  eq_set_params(&filters[i*BANDS + 1], 1000.0f, 0.0f, PEAK_BW, fs);
	  biquad_init(&filters[i*BANDS + 2]);
	  hs_set_params(&filters[i*BANDS + 2], 10000.0f, 0.0f, SHELF_SLOPE, fs);
	}
	plugin_data->filters = filters;
	plugin_data->fs = fs;

}
Exemple #8
0
static 
LADSPA_Handle 
instantiate_eq(const LADSPA_Descriptor *descriptor, unsigned long s_rate) {

	eq *ptr = (eq *)malloc(sizeof(eq));
	biquad *filters = NULL;
	float fs;

	fs = s_rate;

	memset(ptr, 0, sizeof(eq));
	
	filters = calloc(8, sizeof(biquad));

	ptr->filters = filters;
	ptr->fs = fs;
	ptr->run_adding_gain = 1.0f;

	ptr->old_ch0f = 100.0f;
	ptr->old_ch0g = 0;

	ptr->old_ch1f = 200.0f;
	ptr->old_ch1g = 0;

	ptr->old_ch2f = 400.0f;
	ptr->old_ch2g = 0;

	ptr->old_ch3f = 1000.0f;
	ptr->old_ch3g = 0;

	ptr->old_ch4f = 3000.0f;
	ptr->old_ch4g = 0;

	ptr->old_ch5f = 6000.0f;
	ptr->old_ch5g = 0;

	ptr->old_ch6f = 12000.0f;
	ptr->old_ch6g = 0;

	ptr->old_ch7f = 15000.0f;
	ptr->old_ch7g = 0;

	eq_set_params(&filters[0], 100.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[1], 200.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[2], 400.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[3], 1000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[4], 3000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[5], 6000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[6], 12000.0f, 0.0f, BWIDTH, fs);
	eq_set_params(&filters[7], 15000.0f, 0.0f, BWIDTH, fs);

	return (LADSPA_Handle)ptr;
}
Exemple #9
0
djeq_t *djeq_create() {

	djeq_t *djeq = calloc(1, sizeof(djeq_t));
	
	djeq->rate = 44100.0f;

	djeq->filters = calloc(BANDS * CHANNELS, sizeof(biquad));
      
	for (djeq->i = 0; djeq->i < CHANNELS; djeq->i++) {
		biquad_init(&djeq->filters[djeq->i*BANDS + 0]);
		eq_set_params(&djeq->filters[djeq->i*BANDS + 0], 100.0f, 0.0f, LOW_BW, djeq->rate);
		biquad_init(&djeq->filters[djeq->i*BANDS + 1]);
		eq_set_params(&djeq->filters[djeq->i*BANDS + 1], 1000.0f, 0.0f, MID_BW, djeq->rate);
		biquad_init(&djeq->filters[djeq->i*BANDS + 2]);
		eq_set_params(&djeq->filters[djeq->i*BANDS + 2], 10000.0f, 0.0f, HIGH_BW, djeq->rate);
	}
	
	return djeq;

}
Exemple #10
0
void djeq_run(djeq_t *djeq, float *left_input, float *right_input, float *left_output, float *right_output, int sample_count) {

	for (djeq->i = 0; djeq->i < CHANNELS; djeq->i++) {
		eq_set_params(&djeq->filters[djeq->i*BANDS + 0], 100.0f, djeq->low, LOW_BW, djeq->rate);
		eq_set_params(&djeq->filters[djeq->i*BANDS + 1], 1000.0f, djeq->mid, MID_BW, djeq->rate);
		eq_set_params(&djeq->filters[djeq->i*BANDS + 2], 10000.0f, djeq->high, HIGH_BW, djeq->rate);
	}

	for (djeq->pos = 0; djeq->pos < sample_count; djeq->pos++) {
		djeq->samp = biquad_run(&djeq->filters[0], left_input[djeq->pos]);
		djeq->samp = biquad_run(&djeq->filters[1], djeq->samp);
		djeq->samp = biquad_run(&djeq->filters[2], djeq->samp);
		left_output[djeq->pos] = djeq->samp;

		djeq->samp = biquad_run(&djeq->filters[3], right_input[djeq->pos]);
		djeq->samp = biquad_run(&djeq->filters[4], djeq->samp);
		djeq->samp = biquad_run(&djeq->filters[5], djeq->samp);
		right_output[djeq->pos] = djeq->samp;
	}

      //*(plugin_data->latency) = 3; //XXX is this right?

}
Exemple #11
0
static void runDj_eq_mono(LADSPA_Handle instance, unsigned long sample_count) {
	Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;

	/* Lo gain (dB) (float value) */
	const LADSPA_Data lo = *(plugin_data->lo);

	/* Mid gain (dB) (float value) */
	const LADSPA_Data mid = *(plugin_data->mid);

	/* Hi gain (dB) (float value) */
	const LADSPA_Data hi = *(plugin_data->hi);

	/* 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;
	biquad * filters = plugin_data->filters;
	float fs = plugin_data->fs;

#line 42 "dj_eq_1901.xml"
	unsigned long pos;
	float samp;

	eq_set_params(&filters[0], 100.0f, lo, PEAK_BW, fs);
	eq_set_params(&filters[1], 1000.0f, mid, PEAK_BW, fs);
	hs_set_params(&filters[2], 10000.0f, hi, SHELF_SLOPE, fs);

	for (pos = 0; pos < sample_count; pos++) {
	  samp = biquad_run(&filters[0], input[pos]);
	  samp = biquad_run(&filters[1], samp);
	  samp = biquad_run(&filters[2], samp);
	  buffer_write(output[pos], samp);
	}

	*(plugin_data->latency) = 3; //XXX is this right?
}
Exemple #12
0
static
void
run_adding_eq(LADSPA_Handle instance, unsigned long sample_count) {

	eq * ptr = (eq *)instance;

	const LADSPA_Data ch0f = LIMIT(*(ptr->ch0f),40.0f,280.0f);
	const LADSPA_Data ch0g = LIMIT(*(ptr->ch0g),-50.0f,20.0f);
	const LADSPA_Data ch0b = LIMIT(*(ptr->ch0b),0.1f,5.0f);
	const LADSPA_Data ch1f = LIMIT(*(ptr->ch1f),100.0f,500.0f);
	const LADSPA_Data ch1g = LIMIT(*(ptr->ch1g),-50.0f,20.0f);
	const LADSPA_Data ch1b = LIMIT(*(ptr->ch1b),0.1f,5.0f);
	const LADSPA_Data ch2f = LIMIT(*(ptr->ch2f),200.0f,1000.0f);
	const LADSPA_Data ch2g = LIMIT(*(ptr->ch2g),-50.0f,20.0f);
	const LADSPA_Data ch2b = LIMIT(*(ptr->ch2b),0.1f,5.0f);
	const LADSPA_Data ch3f = LIMIT(*(ptr->ch3f),400.0f,2800.0f);
	const LADSPA_Data ch3g = LIMIT(*(ptr->ch3g),-50.0f,20.0f);
	const LADSPA_Data ch3b = LIMIT(*(ptr->ch3b),0.1f,5.0f);
	const LADSPA_Data ch4f = LIMIT(*(ptr->ch4f),1000.0f,5000.0f);
	const LADSPA_Data ch4g = LIMIT(*(ptr->ch4g),-50.0f,20.0f);
	const LADSPA_Data ch4b = LIMIT(*(ptr->ch4b),0.1f,5.0f);
	const LADSPA_Data ch5f = LIMIT(*(ptr->ch5f),3000.0f,9000.0f);
	const LADSPA_Data ch5g = LIMIT(*(ptr->ch5g),-50.0f,20.0f);
	const LADSPA_Data ch5b = LIMIT(*(ptr->ch5b),0.1f,5.0f);
	const LADSPA_Data ch6f = LIMIT(*(ptr->ch6f),6000.0f,18000.0f);
	const LADSPA_Data ch6g = LIMIT(*(ptr->ch6g),-50.0f,20.0f);
	const LADSPA_Data ch6b = LIMIT(*(ptr->ch6b),0.1f,5.0f);
	const LADSPA_Data ch7f = LIMIT(*(ptr->ch7f),10000.0f,20000.0f);
	const LADSPA_Data ch7g = LIMIT(*(ptr->ch7g),-50.0f,20.0f);
	const LADSPA_Data ch7b = LIMIT(*(ptr->ch7b),0.1f,5.0f);

	const LADSPA_Data * input = ptr->input;
	LADSPA_Data * output = ptr->output;

	biquad * filters = ptr->filters;
	float fs = ptr->fs;

	unsigned long pos;
	float samp;


	if ((ch0f != ptr->old_ch0f) ||
	    (ch0g != ptr->old_ch0g) ||
	    (ch0b != ptr->old_ch0b)) {
		ptr->old_ch0f = ch0f;
		ptr->old_ch0g = ch0g;
		ptr->old_ch0b = ch0b;
		eq_set_params(&filters[0], ch0f, ch0g, ch0b, fs);
	}
	if ((ch1f != ptr->old_ch1f) ||
	    (ch1g != ptr->old_ch1g) ||
	    (ch1b != ptr->old_ch1b)) {
		ptr->old_ch1f = ch1f;
		ptr->old_ch1g = ch1g;
		ptr->old_ch1b = ch1b;
		eq_set_params(&filters[1], ch1f, ch1g, ch1b, fs);
	}
	if ((ch2f != ptr->old_ch2f) ||
	    (ch2g != ptr->old_ch2g) ||
	    (ch2b != ptr->old_ch2b)) {
		ptr->old_ch2f = ch2f;
		ptr->old_ch2g = ch2g;
		ptr->old_ch2b = ch2b;
		eq_set_params(&filters[2], ch2f, ch2g, ch2b, fs);
	}
	if ((ch3f != ptr->old_ch3f) ||
	    (ch3g != ptr->old_ch3g) ||
	    (ch3b != ptr->old_ch3b)) {
		ptr->old_ch3f = ch3f;
		ptr->old_ch3g = ch3g;
		ptr->old_ch3b = ch3b;
		eq_set_params(&filters[3], ch3f, ch3g, ch3b, fs);
	}
	if ((ch4f != ptr->old_ch4f) ||
	    (ch4g != ptr->old_ch4g) ||
	    (ch4b != ptr->old_ch4b)) {
		ptr->old_ch4f = ch4f;
		ptr->old_ch4g = ch4g;
		ptr->old_ch4b = ch4b;
		eq_set_params(&filters[4], ch4f, ch4g, ch4b, fs);
	}
	if ((ch5f != ptr->old_ch5f) ||
	    (ch5g != ptr->old_ch5g) ||
	    (ch5b != ptr->old_ch5b)) {
		ptr->old_ch5f = ch5f;
		ptr->old_ch5g = ch5g;
		ptr->old_ch5b = ch5b;
		eq_set_params(&filters[5], ch5f, ch5g, ch5b, fs);
	}
	if ((ch6f != ptr->old_ch6f) ||
	    (ch6g != ptr->old_ch6g) ||
	    (ch6b != ptr->old_ch6b)) {
		ptr->old_ch6f = ch6f;
		ptr->old_ch6g = ch6g;
		ptr->old_ch6b = ch6b;
		eq_set_params(&filters[6], ch6f, ch6g, ch6b, fs);
	}
	if ((ch7f != ptr->old_ch7f) ||
	    (ch7g != ptr->old_ch7g) ||
	    (ch7b != ptr->old_ch7b)) {
		ptr->old_ch7f = ch7f;
		ptr->old_ch7g = ch7g;
		ptr->old_ch7b = ch7b;
		eq_set_params(&filters[7], ch7f, ch7g, ch7b, fs);
	}

	for (pos = 0; pos < sample_count; pos++) {
		samp = input[pos];
		if (ch0g != 0.0f)
			samp = biquad_run(&filters[0], samp);
		if (ch1g != 0.0f)
			samp = biquad_run(&filters[1], samp);
		if (ch2g != 0.0f)
			samp = biquad_run(&filters[2], samp);
		if (ch3g != 0.0f)
			samp = biquad_run(&filters[3], samp);
		if (ch4g != 0.0f)
			samp = biquad_run(&filters[4], samp);
		if (ch5g != 0.0f)
			samp = biquad_run(&filters[5], samp);
		if (ch6g != 0.0f)
			samp = biquad_run(&filters[6], samp);
		if (ch7g != 0.0f)
			samp = biquad_run(&filters[7], samp);
		output[pos] += ptr->run_adding_gain * samp;
	}
}