void zexy_setup(void) { int i; startpost("\n\t"); for (i=0; i<3; i++) startpost("%c", HEARTSYMBOL); endpost(); post("\t%c the zexy external "VERSION, HEARTSYMBOL); post("\t%c (c) 1999-2012 IOhannes m zmölnig", HEARTSYMBOL); post("\t%c forum::für::umläute", HEARTSYMBOL); post("\t%c iem @ kug", HEARTSYMBOL); post("\t%c compiled: "__DATE__, HEARTSYMBOL); post("\t%c send me a 'help' message", HEARTSYMBOL); startpost("\t"); for (i=0; i<3; i++) startpost("%c", HEARTSYMBOL); endpost(); endpost(); zexy_class = class_new(gensym("zexy"), zexy_new, 0, sizeof(t_zexy), 0, 0); class_addmethod(zexy_class, zexy_help, gensym("help"), 0); zexy_register("zexy"); /* ************************************** */ z_zexy_setup(); }
imageloaderMeta(void) : m_canThread(true) { gem::PluginFactory<gem::plugins::imageloader>::loadPlugins("image"); std::vector<std::string>available_ids=gem::PluginFactory<gem::plugins::imageloader>::getIDs(); addLoader(available_ids, "magick"); addLoader(available_ids); if(m_ids.size()>0) { startpost("Image loading support:"); unsigned int i; for(i=0; i<m_ids.size(); i++) { startpost(" %s", m_ids[i].c_str()); } endpost(); } m_canThread=true; unsigned int i; for(i=0; i<m_loaders.size(); i++) { if(!m_loaders[i]->isThreadable()) { m_canThread=false; break; } } }
static void muse_peek(t_muse *x, t_symbol *s) { int i; t_float *fp = x->x_scl; if (*s->s_name) startpost("%s: ", s->s_name); for (i=x->x_n; i--; fp++) startpost("%g ", *fp); endpost(); }
imagesaverMeta(void) : m_threadable(true) { gem::PluginFactory<imagesaver>::loadPlugins("image"); std::vector<std::string>available_ids=gem::PluginFactory<imagesaver>::getIDs(); addSaver(available_ids); static bool firsttime=true; if(firsttime && m_ids.size()>0) { startpost("GEM: image saving support:"); unsigned int i; for(i=0; i<m_ids.size(); i++) { startpost(" %s", m_ids[i].c_str()); } endpost(); } firsttime=false; unsigned int i; for(i=0; i<m_savers.size(); i++) { if(!m_savers[i]->isThreadable()) { m_threadable=false; break; } } }
static void ccdummies_bang(t_pd *x) { if (dummy_nreps) { char *msg = "replacement abstractions are: "; int i, len = strlen(msg); t_dummy_slot *sl; startpost(msg); for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++) { if (!dummy_classes[i]) { /* name field is valid here (reps are never mapped) */ int l = 1 + strlen(sl->s_name); if ((len += l) > 66) { endpost(); startpost(" "); len = 3 + l; } poststring(sl->s_name); } } endpost(); } else post("no replacement abstractions"); }
///////////////////////////////////////////////////////// // add backends // ///////////////////////////////////////////////////////// bool pix_video :: addHandle( std::vector<std::string>available, std::string ID) { unsigned int i=0; int count=0; std::vector<std::string>id; if(!ID.empty()) { // if requested 'cid' is in 'available' add it to the list of 'id's if(std::find(available.begin(), available.end(), ID)!=available.end()) { id.push_back(ID); } else { // request for an unavailable ID logpost(NULL, 6, "backend '%s' unavailable", ID.c_str()); return false; } } else { // no 'ID' given: add all available IDs id=available; } for(i=0; i<id.size(); i++) { std::string key=id[i]; logpost(NULL, 6, "trying to add '%s' as backend", key.c_str()); if(std::find(m_ids.begin(), m_ids.end(), key)==m_ids.end()) { // not yet added, do so now! gem::plugins::video *handle=NULL; startpost("backend #%d='%s'\t", m_videoHandles.size(), key.c_str()); try { handle=gem::PluginFactory<gem::plugins::video>::getInstance(key); } catch (GemException ex) { } if(NULL==handle) { post("<--- DISABLED"); continue; } std::vector<std::string>devs=handle->provides(); if(devs.size()>0) { startpost(": "); unsigned int i=0; for(i=0; i<devs.size(); i++) { startpost("%s ", devs[i].c_str()); } } endpost(); m_ids.push_back(key); m_videoHandles.push_back(handle); count++; logpost(NULL, 6, "added backend#%d '%s' @ 0x%x", m_videoHandles.size()-1, key.c_str(), handle); } } return (count>0); }
static void rawprint_any(t_rawprint *x, t_symbol*s, int argc, t_atom*argv) { char buf[MAXPDSTRING]; if(x->label) { startpost("%s: ", x->label->s_name); } startpost("\"%s\"", s->s_name); while(argc--) { switch(argv->a_type) { case A_FLOAT: snprintf(buf, MAXPDSTRING-1, "%f", atom_getfloat(argv)); break; case A_SYMBOL: snprintf(buf, MAXPDSTRING-1, "'%s'", atom_getsymbol(argv)->s_name); break; case A_POINTER: snprintf(buf, MAXPDSTRING-1, "pointer[%p]", argv->a_w.w_gpointer); break; case A_SEMI: snprintf(buf, MAXPDSTRING-1, "SEMI"); break; case A_COMMA: snprintf(buf, MAXPDSTRING-1, "COMMA"); break; case A_DEFFLOAT: snprintf(buf, MAXPDSTRING-1, "DEFFLOAT[%f]", atom_getfloat(argv)); break; case A_DEFSYM: snprintf(buf, MAXPDSTRING-1, "DEFSYM['%s']", atom_getsymbol(argv)->s_name); break; case A_DOLLAR: snprintf(buf, MAXPDSTRING-1, "DOLLAR['%s']", atom_getsymbol(argv)->s_name); break; case A_DOLLSYM: snprintf(buf, MAXPDSTRING-1, "DOLLSYM['%s']", atom_getsymbol(argv)->s_name); break; case A_GIMME: snprintf(buf, MAXPDSTRING-1, "GIMME"); break; case A_CANT: // we _really_ cannot do CANT snprintf(buf, MAXPDSTRING-1, "CANT"); break; default: snprintf(buf, MAXPDSTRING-1, "unknown[%d]", argv->a_type); } buf[MAXPDSTRING-1]=0; startpost(" %s", buf); argv++; } endpost(); }
/*------------------------------------------------------------- * print() */ static void holmes_mask_print(t_holmes_mask *x) { int i, j; for (i=0; i < 3; i++) { if (i == 0) startpost("holmes_mask:"); else startpost(" "); for (j=0; j < 10 && (i*10+j) < num_Features; j++) { startpost(" %s=%d", FeatureNames[i*10+j], ((x->x_mask & Features[i*10+j]) ? 1 : 0)); } endpost(); } post(" = %ld", x->x_mask); }
void amixer_setup(void) { post("amixer: ALSA soundcard control"); post(" Copyright (C) 1999-2000 Jaroslav Kysela"); post(" ported to pure-data by IOhannes m zmölnig 2005"); post(" institute of electronic music and acoustics (iem)"); post(" published under the GNU General Public License version 2"); #ifdef AMIXER_VERSION startpost(" version:"AMIXER_VERSION); #endif post("\tcompiled: "__DATE__""); amixer_class = class_new(gensym("amixer"), (t_newmethod)amixer_new, (t_method)amixer_free, sizeof(t_amixer), 0, 0); #ifdef HAVE_ALSA class_addmethod(amixer_class, (t_method)amixer_card,gensym("card"), A_GIMME, 0); class_addmethod(amixer_class, (t_method)amixer_cget,gensym("get"), A_GIMME, 0); class_addmethod(amixer_class, (t_method)amixer_cset,gensym("set"), A_GIMME, 0); class_addmethod(amixer_class, (t_method)amixer_cget,gensym("cget"), A_GIMME, 0); class_addmethod(amixer_class, (t_method)amixer_cset,gensym("cset"), A_GIMME, 0); // class_addmethod(amixer_class, (t_method)amixer_listdevices,gensym(""), A_DEFSYM, 0); class_addbang(amixer_class, (t_method)amixer_bang); #endif /* ALSA */ }
static void canvas_readerror(int natoms, t_atom *vec, int message, int nline, char *s) { error("%s", s); startpost("line was:"); postatom(nline, vec + message); endpost(); }
static void pddplink_anything(t_pddplink *x, t_symbol *s, int ac, t_atom *av) { if (x->x_ishit) { startpost("pddplink: internal error (%s", (s ? s->s_name : "")); postatom(ac, av); post(")"); } }
static t_int *print_perform(t_int *w) { t_print *x = (t_print *)(w[1]); t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); if (x->x_count) { int i=0; startpost("%s:", x->x_sym->s_name); for(i=0; i<n; i++) { if(i%8==0)endpost(); startpost("%.4g ", in[i]); } endpost(); x->x_count--; } return (w+4); }
//////////////////////////////////////////////////////// // render // ///////////////////////////////////////////////////////// void TextBase :: renderLine(const char*line, float dist) { float x1=0, y1=0, z1=0, x2=0, y2=0, z2=0; #if 0 startpost("renderline: "); { const char*c=line; while(c) { startpost("%c (%x)", c, c); c++; } } #endif m_font->BBox(line, x1, y1, z1, x2, y2, z2); // FTGL glPushMatrix(); glNormal3f(0.0, 0.0, 1.0); justifyFont(x1, y1, z1, x2, y2, z2, dist); m_font->Render(line); glPopMatrix(); }
static void canvas_readerror(int natoms, t_atom *vec, int message, int nline, char *s) { #ifdef ROCKBOX (void) natoms; #endif error(s); startpost("line was:"); postatom(nline, vec + message); endpost(); }
void pix_video :: driverMess() { // a little bit of info if(m_videoHandle) { post("current driver: '%s'", m_videoHandle->getName().c_str()); } if(m_videoHandles.size()>1) { unsigned int i=0; post("available drivers:"); for(i=0; i<m_videoHandles.size(); i++) { gem::plugins::video*handle= m_videoHandles[i]; if(NULL==handle)continue; startpost("\t'%s' provides ", handle->getName().c_str()); std::vector<std::string>backends=handle->provides(); unsigned int j=0; for(j=0; j<backends.size(); j++) { startpost("'%s' ", backends[j].c_str()); } if(j==0)startpost("<nothing>"); endpost(); } } }
static void hammergui_anything(t_hammergui *snk, t_symbol *s, int ac, t_atom *av) { /* Dummy method, filtering out messages from gui to the masters. This is needed in order to keep Pd's message system happy in a ``gray period'' -- after last master is unbound, and before gui bindings are cleared. */ #ifdef HAMMERGUI_DEBUG /* FIXME */ startpost("%s", s->s_name); postatom(ac, av); post(" (sink %x)", (int)snk); #endif }
void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv) { int i; char str[80]; startpost("%s: unknown message %s", class_getname(pd_class(x)), s->s_name); for (i = 0; i < argc; i++) { atom_string(argv+i, str, 80); poststring(str); } endpost(); }
int iemnet_debug(int debuglevel, const char*file, unsigned int line, const char*function) { #ifdef IEMNET_HAVE_DEBUG int debuglevel_=0; pthread_mutex_lock(&debug_mtx); debuglevel_=iemnet_debuglevel_; pthread_mutex_unlock(&debug_mtx); if(debuglevel_ & debuglevel) { startpost("[%s:%d#%d] ", function, line, debuglevel); return 1; } #endif return 0; }
void loud_error(t_pd *x, char *fmt, ...) { char buf[MAXPDSTRING]; va_list ap; va_start(ap, fmt); vsprintf(buf, fmt, ap); if (x) { startpost("%s's ", class_getname(*x)); //pd_error(x, buf); } else post("%s %s", LOUD_ERROR_DEFAULT, buf); va_end(ap); }
/* adapted dogensym() from m_class.c */ t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym) { t_symbol **sym1, *sym2; unsigned int hash1 = 0, hash2 = 0; int length = 0; char *s2 = s; int mask = x->d_hashsize - 1; #ifdef DICT_DEBUG startpost("make symbol-key from \"%s\"", s); #endif while (*s2) { hash1 += *s2; hash2 += hash1; length++; s2++; } sym1 = x->d_hashtable + (hash2 & mask); #ifdef DICT_DEBUG post(" in slot %d", (hash2 & mask)); #endif while (sym2 = *sym1) { #ifdef DICT_DEBUG post("try \"%s\"", sym2->s_name); #endif if (!strcmp(sym2->s_name, s)) { #ifdef DICT_DEBUG post("found at address %x", (int)sym2); #endif return(sym2); } sym1 = &sym2->s_next; } if (oldsym) sym2 = oldsym; else { sym2 = (t_symbol *)t_getbytes(sizeof(*sym2)); sym2->s_name = t_getbytes(length+1); sym2->s_next = 0; sym2->s_thing = 0; strcpy(sym2->s_name, s); } *sym1 = sym2; #ifdef DICT_DEBUG post("appended at address %x", (int)sym2); #endif return (sym2); }
static void printmatrix(const ambix_matrix_t*mtx) { if(mtx) { float32_t**data=mtx->data; uint32_t r, c; post(" [%dx%d] = %p", mtx->rows, mtx->cols, mtx->data); for(r=0; r<mtx->rows; r++) { for(c=0; c<mtx->cols; c++) { startpost("%08f ", data[r][c]); } endpost(); } } endpost(); }
void binbuf_print(t_binbuf *x) { int i, startedpost = 0, newline = 1; for (i = 0; i < x->b_n; i++) { if (newline) { if (startedpost) endpost(); startpost(""); startedpost = 1; } postatom(1, x->b_vec + i); if (x->b_vec[i].a_type == A_SEMI) newline = 1; else newline = 0; } if (startedpost) endpost(); }
void binbuf_add(t_binbuf *x, int argc, t_atom *argv) { int newsize = x->b_n + argc, i; t_atom *ap; if((ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), newsize * sizeof(*x->b_vec)))) x->b_vec = ap; else { error("binbuf_addmessage: out of space"); return; } #if 0 startpost("binbuf_add: "); postatom(argc, argv); endpost(); #endif for (ap = x->b_vec + x->b_n, i = argc; i--; ap++) *ap = *(argv++); x->b_n = newsize; }
void hdspmmixer_setup(void) { post("hdspmmixer: ALSA HDSP Mixer control"); post(" Copyright (C) Winfried Ritsch"); post(" institute of electronic music and acoustics (iem)"); post(" published under the GNU General Public License version 2"); #ifdef VERSION startpost(" version:"VERSION); #endif post("\tcompiled: "__DATE__""); hdspmmixer_class = class_new(gensym("hdspmmixer"), (t_newmethod)hdspmmixer_new, (t_method)hdspmmixer_free, sizeof(t_hdspmmixer), 0, 0); class_addbang(hdspmmixer_class, (t_method)hdspmmixer_bang); class_addmethod(hdspmmixer_class, (t_method)hdspmmixer_bang,gensym("find"), 0); class_addmethod(hdspmmixer_class, (t_method)hdspmmixer_get,gensym("get"), A_GIMME, 0); class_addmethod(hdspmmixer_class, (t_method)hdspmmixer_set,gensym("set"), A_GIMME, 0); // class_addmethod(hdspmmixer_class, (t_method)hdspmmixer_listdevices,gensym(""), A_DEFSYM, 0); }
void loudx_error(t_loudcontext *lc, char *fmt, ...) { char buf[MAXPDSTRING]; va_list ap; va_start(ap, fmt); vsprintf(buf, fmt, ap); if (lc->lc_caller) { startpost("%s's ", (lc->lc_callername ? lc->lc_callername : class_getname(*lc->lc_caller))); //pd_error(lc->lc_caller, buf); } else { if (lc->lc_callername) post("error (%s): %s", lc->lc_callername, buf); else if (lc->lc_selector) post("error (%s): %s", lc->lc_selector->s_name, buf); else post("%s %s", LOUD_ERROR_DEFAULT, buf); } va_end(ap); }
static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname) { char path[MAXPDSTRING]; FILE *fp; /* FIXME use open_via_path() */ if (x->x_glist) canvas_makefilename(x->x_glist, fname->s_name, path, MAXPDSTRING); else { strncpy(path, fname->s_name, MAXPDSTRING); path[MAXPDSTRING-1] = 0; } /* CHECKED no global message */ if (fp = sys_fopen(path, "r")) { t_mtrack *tp = 0; char linebuf[MTR_FILEBUFSIZE]; t_binbuf *bb = binbuf_new(); while (fgets(linebuf, MTR_FILEBUFSIZE, fp)) { char *line = linebuf; int linelen; while (*line && (*line == ' ' || *line == '\t')) line++; if (linelen = strlen(line)) { if (tp) { if (!strncmp(line, "end;", 4)) { post("ok"); tp = 0; } else { int ac; binbuf_text(bb, line, linelen); if (ac = binbuf_getnatom(bb)) { t_atom *ap = binbuf_getvec(bb); if (!binbuf_getnatom(tp->tr_binbuf)) { if (ap->a_type != A_FLOAT) { t_atom at; SETFLOAT(&at, 0.); binbuf_add(tp->tr_binbuf, 1, &at); } else if (ap->a_w.w_float < 0.) ap->a_w.w_float = 0.; } binbuf_add(tp->tr_binbuf, ac, ap); } } } else if (!strncmp(line, "track ", 6)) { int id = strtol(line + 6, 0, 10); startpost("Track %d... ", id); if (id < 1 || id > x->x_ntracks) post("no such track"); /* LATER rethink */ else if (target) { if (id == target->tr_id) tp = target; post("skipped"); /* LATER rethink */ } else tp = x->x_tracks[id - 1]; if (tp) { binbuf_clear(tp->tr_binbuf); } } } } fclose(fp); binbuf_free(bb); } else { /* CHECKED no complaint, open dialog not presented... */ /* LATER rethink */ hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle, 0); } }
///////////////////////////////////////////////////////// // printInfo // ///////////////////////////////////////////////////////// void glsl_program :: printInfo() { int i; if(!m_linked) { error("no GLSL-program linked"); return; } post("glsl_program Info"); post("================="); if(GLEW_VERSION_2_0) { startpost("linked shaders"); for (i = 0; i < m_num; i++) { startpost( " %d", m_shaderObj[i] ); } post(": %d", m_program); } else { startpost("linked ARB-shaders"); for (i = 0; i < m_num; i++) { startpost( " %d", m_shaderObjARB[i] ); } post(": %d", m_programARB); } post(""); for (i=0; i<m_uniformCount; i++) { startpost("uvar#%d: \"%s\": ", i, m_symname[i]->s_name); #define SWITCHPOST(label) case label: post("%s", #label); break switch (m_type[i]) { SWITCHPOST(GL_FLOAT); SWITCHPOST(GL_FLOAT_VEC2); SWITCHPOST(GL_FLOAT_VEC3); SWITCHPOST(GL_FLOAT_VEC4); SWITCHPOST(GL_INT); SWITCHPOST(GL_INT_VEC2); SWITCHPOST(GL_INT_VEC3); SWITCHPOST(GL_INT_VEC4); SWITCHPOST(GL_BOOL); SWITCHPOST(GL_BOOL_VEC2); SWITCHPOST(GL_BOOL_VEC3); SWITCHPOST(GL_BOOL_VEC4); SWITCHPOST(GL_FLOAT_MAT2); SWITCHPOST(GL_FLOAT_MAT3); SWITCHPOST(GL_FLOAT_MAT4); SWITCHPOST(GL_SAMPLER_1D); SWITCHPOST(GL_SAMPLER_2D); SWITCHPOST(GL_SAMPLER_3D); SWITCHPOST(GL_SAMPLER_CUBE); SWITCHPOST(GL_SAMPLER_1D_SHADOW); SWITCHPOST(GL_SAMPLER_2D_SHADOW); // SWITCHPOST(GL_SAMPLER_2D_RECT); default: switch(m_type[i]) { // SWITCHPOST(GL_FLOAT_ARB); SWITCHPOST(GL_FLOAT_VEC2_ARB); SWITCHPOST(GL_FLOAT_VEC3_ARB); SWITCHPOST(GL_FLOAT_VEC4_ARB); // SWITCHPOST(GL_INT_ARB); SWITCHPOST(GL_INT_VEC2_ARB); SWITCHPOST(GL_INT_VEC3_ARB); SWITCHPOST(GL_INT_VEC4_ARB); SWITCHPOST(GL_BOOL_ARB); SWITCHPOST(GL_BOOL_VEC2_ARB); SWITCHPOST(GL_BOOL_VEC3_ARB); SWITCHPOST(GL_BOOL_VEC4_ARB); SWITCHPOST(GL_FLOAT_MAT2_ARB); SWITCHPOST(GL_FLOAT_MAT3_ARB); SWITCHPOST(GL_FLOAT_MAT4_ARB); SWITCHPOST(GL_SAMPLER_1D_ARB); SWITCHPOST(GL_SAMPLER_2D_ARB); SWITCHPOST(GL_SAMPLER_3D_ARB); SWITCHPOST(GL_SAMPLER_CUBE_ARB); SWITCHPOST(GL_SAMPLER_1D_SHADOW_ARB); SWITCHPOST(GL_SAMPLER_2D_SHADOW_ARB); SWITCHPOST(GL_SAMPLER_2D_RECT_ARB); default: post("unknown (0x%X)", m_type[i]); break; } break; } } }
/* LATER analyse various cases of mixed (midi/nonmidi) binbufs and try to find a better way of adjusting time in such cases */ static int mfbb_parse(t_binbuf *x, t_mifi_stream *stp, t_squtt *tt, t_mfbb_parsinghook hook) { t_mifi_event *evp = stp->s_auxeve; t_mfbb_parsinghook thehook = (hook ? hook : mfbb_analyse_hook); int natoms = x->b_n; t_atom *ap= x->b_vec; uint32 thisticks = 0, pastticks = 0; int track, hookresult; t_symbol *tname = 0; if (!hook) { /* LATER make sure we are called after mifi_stream_new() or after reinitialization */ } while (natoms >= MFBB_PARTICLE_SIZE) { t_atom *ap1 = ap; t_float f, delaytime = 0; if (ap1->a_type != A_FLOAT || (delaytime = ap1->a_w.w_float) < 0) goto nextmessage; ap1++; #if 1 /* assume folded time */ thisticks += (uint32)(delaytime * stp->s_timecoef); #else /* but keep unfolded version ready */ thisticks = (uint32)(delaytime * stp->s_timecoef); #endif if (!(track = squtt_checkatom(tt, ap1))) goto nextmessage; tname = ap1->a_w.w_symbol; ap1++; if (mfbb_parse_status(ap1, evp)) ap1++; else goto nextmessage; if (mfbb_parse_data(ap1, evp, 0)) ap1++; else goto nextmessage; if (MIFI_ONE_DATABYTE(evp->e_status)) { if (mfbb_parse_channel(ap1, evp)) ap1++; else goto nextmessage; evp->e_data[1] = 0, ap1++; /* accept this being just anything... */ } else { if (mfbb_parse_data(ap1, evp, 1)) ap1++; else goto nextmessage; if (mfbb_parse_channel(ap1, evp)) ap1++; else goto nextmessage; } if (ap1->a_type != A_SEMI) /* ...but this is required */ goto nextmessage; evp->e_delay = thisticks - pastticks; if (!(hookresult = thehook(stp, evp, track, tname))) return (0); if (hookresult > 0) pastticks = thisticks; natoms -= MFBB_PARTICLE_SIZE; ap += MFBB_PARTICLE_SIZE; continue; nextmessage: #ifdef MFBB_DEBUG if (!hook) { /* print this only once, i.e. during a default (analysis) pass */ startpost("skip"); postatom(1, ap); poststring("with"); postatom(6, ap+1); poststring("bad"); postatom(1, ap1); endpost(); } #endif while (natoms-- > MFBB_PARTICLE_SIZE && (ap++)->a_type != A_SEMI); } return (1); }
/* this is broken now... used to work when "timestamp" was derived from QueryPerformanceCounter() instead of the gates approved timeGetSystemTime() call in the MIDI callback routine below. */ return (nt_tixtotime(timestamp) - nt_hibuftime); } #endif /* MIDI_TIMESTAMP */ static int nt_fill = 0; #define WRAPFWD(x) ((x) >= nt_naudiobuffer ? (x) - nt_naudiobuffer: (x)) #define WRAPBACK(x) ((x) < 0 ? (x) + nt_naudiobuffer: (x)) #define MAXRESYNC 500 #if 0 /* this is used for debugging */ static void nt_printaudiostatus(void) { int nad, nda; for (nad = 0; nad < nt_nwavein; nad++) { int phase = ntsnd_inphase[nad]; int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0; int firstphasedone = -1, firstphasebusy = -1; for (count = 0; count < nt_naudiobuffer; count++) { int donethis = (ntsnd_invec[nad][phase2].lpWaveHdr->dwFlags & WHDR_DONE); int donenext = (ntsnd_invec[nad][phase3].lpWaveHdr->dwFlags & WHDR_DONE); if (donethis && !donenext) { if (firstphasebusy >= 0) goto multipleadc; firstphasebusy = count; } if (!donethis && donenext) { if (firstphasedone >= 0) goto multipleadc; firstphasedone = count; } phase2 = phase3; phase3 = WRAPFWD(phase2 + 1); } post("nad %d phase %d busy %d done %d", nad, phase, firstphasebusy, firstphasedone); continue; multipleadc: startpost("nad %d phase %d: oops:", nad, phase); for (count = 0; count < nt_naudiobuffer; count++) { char buf[80]; sprintf(buf, " %d", (ntsnd_invec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE)); poststring(buf); } endpost(); } for (nda = 0; nda < nt_nwaveout; nda++) { int phase = ntsnd_outphase[nad]; int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0; int firstphasedone = -1, firstphasebusy = -1; for (count = 0; count < nt_naudiobuffer; count++) { int donethis = (ntsnd_outvec[nda][phase2].lpWaveHdr->dwFlags & WHDR_DONE); int donenext = (ntsnd_outvec[nda][phase3].lpWaveHdr->dwFlags & WHDR_DONE); if (donethis && !donenext) { if (firstphasebusy >= 0) goto multipledac; firstphasebusy = count; } if (!donethis && donenext) { if (firstphasedone >= 0) goto multipledac; firstphasedone = count; } phase2 = phase3; phase3 = WRAPFWD(phase2 + 1); } if (firstphasebusy < 0) post("nda %d phase %d all %d", nda, phase, (ntsnd_outvec[nad][0].lpWaveHdr->dwFlags & WHDR_DONE)); else post("nda %d phase %d busy %d done %d", nda, phase, firstphasebusy, firstphasedone); continue; multipledac: startpost("nda %d phase %d: oops:", nda, phase); for (count = 0; count < nt_naudiobuffer; count++) { char buf[80]; sprintf(buf, " %d", (ntsnd_outvec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE)); poststring(buf); } endpost(); } }
void number_post(t_pd_obj_number *x) { startpost("%s",*x->x_sym); postfloat(*x->x_number); endpost(); }