Starting/stopping the dac by program in Max 7.XX
Hi,
In our faustgen~ external we were using the following code to start/stop the "dac":
dsp_status("stop");
…so some stuff…
dsp_status("start");
void faustgen::dsp_status(const char* mess)
{
t_pxobject* dac = 0;
if ((dac = check_dac())) {
t_atom msg[1];
atom_setsym(msg, gensym(mess));
object_method_typed(dac, gensym("message"), 1, msg, 0);
} else { // Global
object_method(gensym("dsp")->s_thing, gensym(mess));
}
}
t_pxobject* faustgen::check_dac()
{
t_object *patcher, *box, *obj;
object_obex_lookup(this, gensym("
for (box = jpatcher_get_firstobject(patcher); box; box = jbox_get_nextobject(box)) {
obj = jbox_get_object(box);
if (obj) {
printf("object_classname %s\n", object_classname(obj)->s_name);
if ((object_classname(obj) == gensym("dac~"))
|| (object_classname(obj) == gensym("ezdac~"))
|| (object_classname(obj) == gensym("ezadc~"))
|| (object_classname(obj) == gensym("adc~"))) {
return (t_pxobject*)box;
}
}
}
return 0;
}
This code does not work anymore in Max 7.01, the "check_dac" function correctly discover the "dac" object in the patch, but the "dsp_status" method does not stop it anymore…
Any idea? It there any new way to start/stop the DAC in an external?
Thanks.
Stéphane Letz
Emmanuel Jourdan finally give us the solution, the following function has to be added after changer the object inlet/outlet :
// Invalidate DSP chain
dspchain_setbroken(dspchain_fromobject((t_object *)this));