void audiosend_dsp(t_audiosend *x, t_signal **sp, short *count)
{
    long		numInputs = x->num_inputs;
    short		i, j;
    t_object	*hub;

    if (x->attr_target && x->attr_target != _sym_nothing) {
        hub = jamoma_get_hub_for_module_named(x->attr_target);
        if (hub != x->obj_target) {
            if (hub) {
                x->obj_target = hub;
                // we could attach to the hub here to listen for free notifications
                // but freeing it will restart the dsp anyway, so I don't think there is any need [tap]
                x->obj_direct_target = (t_object*)object_method(hub, SymbolGen("getobj_audioin"));
            }
        }
        if (x->obj_target) {
            for (i=0, j=0; i<numInputs; i++) {
                if (count[i])
                    j=i;
                x->audio_in[i] = sp[i]->s_vec;
            }
            numInputs = j+1;

            dsp_add(audiosend_perform, 2, x, numInputs);
        }
    }
}
void audioreceive_dsp(t_audioreceive *x, t_signal **sp, short *count)
{
	long		numOutputs = x->num_outputs;
	short		i, j;
	t_object	*hub;
	
	if(x->attr_target && x->attr_target != _sym_nothing){
		hub = jamoma_get_hub_for_module_named(x->attr_target);
		if(hub != x->obj_target){
			if(hub){
				x->obj_target = hub;
				// we could attach to the hub here to listen for free notifications
				// but freeing it will restart the dsp anyway, so I don't think there is any need [tap]
				x->obj_direct_target = (t_object*)object_method(hub, gensym("getobj_audioout"));
			}
		}
		if(x->obj_target){
			for(i=0, j=0; i<numOutputs; i++){
				if(count[i+1])		// the +1 is to account for the inlet in this object
					j=i;
				x->audio_out[i] = sp[i+1]->s_vec;
			}
			numOutputs = j+1;
			
			x->vs = sp[0]->s_n;
			dsp_add(audioreceive_perform, 2, x, numOutputs);
		}
	}
}
t_max_err audiosend_attr_settarget(t_audiosend *x, void *attr, long argc, t_atom *argv)
{
    t_object	*hub;

    x->attr_target = atom_getsym(argv);
    hub = jamoma_get_hub_for_module_named(x->attr_target);
    if (hub) {
        x->obj_target = hub;
        x->obj_direct_target = (t_object*)object_method(hub, SymbolGen("getobj_audioin"));
    }
    return MAX_ERR_NONE;
}