void *irextract_new (t_symbol *s, short argc, t_atom *argv)
{
    t_irextract *x = (t_irextract *)object_alloc (this_class);

	x->process_done = bangout(x);
	
	init_HIRT_common_attributes(x);
	
	x->bandlimit = 1;
	x->amp = -1;
	x->inv_amp = 0;
	
	x->fft_size = 0;
	x->sample_rate = 0;
	x->out_length_samps = 0;
	x->out_length = 0;
	x->gen_length = 0;
	
	alloc_mem_swap(&x->out_mem, 0, 0);
	
	x->measure_mode = SWEEP;

	attr_args_process(x, argc, argv);

	return(x);
}
void *bufreverse_new()
{
    t_bufreverse *x = (t_bufreverse *)object_alloc (this_class);

    x->process_done = bangout(x);

    init_HIRT_common_attributes(x);

    return(x);
}
void *bufconvolve_new  (t_symbol *s, short argc, t_atom *argv)

{
    t_bufconvolve *x = (t_bufconvolve *)object_alloc (this_class);
	
	x->process_done = bangout(x);
	
	init_HIRT_common_attributes(x);
	attr_args_process(x, argc, argv);
	
	return(x);
}
void *irreference_new (t_symbol *s, short argc, t_atom *argv)
{
    t_irreference *x = (t_irreference *)object_alloc (this_class);
    t_atom_long num_in_chans = 1;

    if (argc && atom_gettype(argv) == A_LONG)
    {
        num_in_chans = atom_getlong(argv++);
        num_in_chans = num_in_chans < 1 ? 1 : num_in_chans;
        num_in_chans = num_in_chans > HIRT_MAX_MEASURE_CHANS ? HIRT_MAX_MEASURE_CHANS : num_in_chans;
        argc--;
    }

    dsp_setup((t_pxobject *)x, (long) (num_in_chans + 1));

    x->process_done = bangout(x);
    outlet_new(x, "signal");

    init_HIRT_common_attributes(x);

    x->abs_progress = 0;

    x->T = 0;
    x->current_t = 0;
    x->fft_size = 0;
    x->start_rec = 0;
    x->stop_rec = 0;
    x->sample_rate = sys_getsr();

    if (!x->sample_rate)
        x->sample_rate = 44100;

    alloc_mem_swap(&x->rec_mem, 0, 0);
    alloc_mem_swap(&x->out_mem, 0, 0);

    x->current_length = 0;
    x->current_out_length = 0;
    x->out_length = 0;
    x->num_in_chans = (long) num_in_chans;
    x->num_active_ins = (long) num_in_chans;
    x->current_num_active_ins = (long) num_in_chans;

    x->smooth_mode = 1;

    atom_setlong(&x->deconvolve_delay, 10);

    attr_args_process(x, argc, argv);

    return(x);
}
void *irphase_new (t_symbol *s, short argc, t_atom *argv)
{
    t_irphase *x = (t_irphase *)object_alloc (this_class);
	
	x->process_done = bangout(x);
	
	init_HIRT_common_attributes(x);
	
	// Change filter specifier to more appropriate default
	
	atom_setlong(x->deconvolve_filter_specifier + 0, -1000);
	atom_setlong(&x->deconvolve_delay, 0);
	x->deconvolve_num_filter_specifiers = 1;
	
	attr_args_process(x, argc, argv);

	return(x);
}
void *irmeasure_new(t_symbol *s, short argc, t_atom *argv)
{
    t_irmeasure *x = (t_irmeasure *)object_alloc(this_class);
    t_atom_long num_out_chans = 1;
    t_atom_long num_in_chans = 1;
    long i;

    if (argc && atom_gettype(argv) == A_LONG)
    {
        num_in_chans = atom_getlong(argv++);
        num_in_chans = num_in_chans < 1 ? 1 : num_in_chans;
        num_in_chans = num_in_chans > HIRT_MAX_MEASURE_CHANS ? HIRT_MAX_MEASURE_CHANS : num_in_chans;
        argc--;
    }

    if (argc && atom_gettype(argv) == A_LONG)
    {
        num_out_chans = atom_getlong(argv++);
        num_out_chans = num_out_chans < 1 ? 1 : num_out_chans;
        num_out_chans = num_out_chans > HIRT_MAX_MEASURE_CHANS ? HIRT_MAX_MEASURE_CHANS : num_out_chans;
        argc--;
    }

    x->process_done = bangout(x);

    for (i = 0; i < num_out_chans + 1; i++)
        outlet_new(x, "signal");
    dsp_setup((t_pxobject *)x, (long) num_in_chans);

    init_HIRT_common_attributes(x);

    x->bandlimit = 1;
    x->abs_progress = 0;
    x->amp = -1.0;
    x->inv_amp = 0;

    x->T2 = 0;
    x->current_t = 0;
    x->fft_size = 0;
    x->start_measurement = 0;
    x->stop_measurement = 0;
    x->test_tone = 0;
    x->no_dsp = 1;
    x->sample_rate = sys_getsr();

    if (!x->sample_rate)
        x->sample_rate = 44100.0;


    alloc_mem_swap(&x->rec_mem, 0, 0);
    alloc_mem_swap(&x->out_mem, 0, 0);

    x->num_in_chans = (long) num_in_chans;
    x->num_out_chans = (long) num_out_chans;
    x->num_active_ins = (long) num_in_chans;
    x->num_active_outs = (long) num_out_chans;
    x->current_num_active_ins = (long) num_in_chans;
    x->current_num_active_outs = (long) num_out_chans;

    x->measure_mode = SWEEP;
    x->phase = 0.0;

    attr_args_process(x, argc, argv);

    return(x);
}