xlerrprint(char *hdr, char *cmsg, char *emsg, NODE *arg) { sprintf(buf,"%s: %s",hdr,emsg); stdputstr(buf); if (arg != s_unbound) { stdputstr(" - "); stdprint(arg); } else xlterpri(((s_stdout)->n_info.n_xsym.xsy_value)); if (cmsg) { sprintf(buf,"if continued: %s\n",cmsg); stdputstr(buf); } }
LVAL prepare_audio(LVAL play, snd_type snd, snd_type player) { long flags; if (play == NIL) return NIL; player->format = snd->format; player->u.audio.devicename[0] = 0; player->u.audio.interfacename[0] = 0; if (snd_open(player, &flags) != SND_SUCCESS) { xlabort("snd_save -- could not open audio output"); } /* make sure player and snd are compatible -- if not, set player to NULL * and print a warning message */ if (player->format.channels == snd->format.channels && player->format.mode == snd->format.mode && player->format.bits == snd->format.bits) { /* ok so far, check out the sample rate */ if (player->format.srate != snd->format.srate) { char msg[100]; sprintf(msg, "%s(%g)%s(%g).\n", "Warning: file sample rate ", snd->format.srate, " differs from audio playback sample rate ", player->format.srate); stdputstr(msg); } } else { stdputstr("File format not supported by audio output.\n"); return NIL; } return play; }
void tonev_print_tree(snd_susp_type a_susp, int n) { tonev_susp_type susp = (tonev_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); indent(n); stdputstr("hz:"); sound_print_tree_1(susp->hz, n); }
void coterm_print_tree(snd_susp_type a_susp, int n) { coterm_susp_type susp = (coterm_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); indent(n); stdputstr("s2:"); sound_print_tree_1(susp->s2, n); }
void pvshell_print_tree(snd_susp_type a_susp, int n) { pvshell_susp_type susp = (pvshell_susp_type) a_susp; indent(n); stdputstr("f:"); sound_print_tree_1(susp->pvshell.f, n); indent(n); stdputstr("g:"); sound_print_tree_1(susp->pvshell.g, n); }
/* xinfo - show information on control-t */ LVAL xinfo() { char buf[80]; sprintf(buf,"\n[ Free: %d, GC calls: %d, Total: %ld", nfree, gccalls, total); stdputstr(buf); print_local_gc_info(); stdputstr("]\n"); return NULL; }
void flute_freq_print_tree(snd_susp_type a_susp, int n) { flute_freq_susp_type susp = (flute_freq_susp_type) a_susp; indent(n); stdputstr("breath_env:"); sound_print_tree_1(susp->breath_env, n); indent(n); stdputstr("freq_env:"); sound_print_tree_1(susp->freq_env, n); }
void alpassvc_print_tree(snd_susp_type a_susp, int n) { alpassvc_susp_type susp = (alpassvc_susp_type) a_susp; indent(n); stdputstr("input:"); sound_print_tree_1(susp->input, n); indent(n); stdputstr("delaysnd:"); sound_print_tree_1(susp->delaysnd, n); }
void trigger_print_tree(trigger_susp_type susp, int n) { indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); indent(n); stdputstr("closure:"); stdprint(susp->closure); indent(n); stdputstr("s2:"); sound_print_tree_1(susp->s2, n); }
int nosc_poll() { fd_set rfds; struct timeval tv; int retval; if (SAFE_NYQUIST) return 0; // loop, receiving all pending OSC messages while (true) { FD_ZERO(&rfds); FD_SET(lo_fd, &rfds); tv.tv_sec = 0; tv.tv_usec = 0; retval = select(lo_fd + 1, &rfds, NULL, NULL, &tv); if (retval == -1) { stdputstr("select() error in nosc_poll\n"); return -1; } else if (retval > 0 && FD_ISSET(lo_fd, &rfds)) { /* printf("lo_server_recv_noblock 1\n"); */ lo_server_recv_noblock(the_server, 0); } else { return 0; } } return 0; }
void reson_print_tree(snd_susp_type a_susp, int n) { reson_susp_type susp = (reson_susp_type) a_susp; indent(n); stdputstr("s:"); sound_print_tree_1(susp->s, n); }
void normalize_print_tree(snd_susp_type a_susp, int n) { normalize_susp_type susp = (normalize_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); }
void recip_print_tree(snd_susp_type a_susp, int n) { recip_susp_type susp = (recip_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); }
/* xltoplevel - go back to the top level */ void xltoplevel(void) { close_loadingfiles(); local_toplevel(); stdputstr("[ back to top level ]\n"); findandjump(CF_TOPLEVEL,"no top level"); }
void clarinet_print_tree(snd_susp_type a_susp, int n) { clarinet_susp_type susp = (clarinet_susp_type) a_susp; indent(n); stdputstr("breath_env:"); sound_print_tree_1(susp->breath_env, n); }
void stkchorus_print_tree(snd_susp_type a_susp, int n) { stkchorus_susp_type susp = (stkchorus_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); }
/* Added by Ning Hu May.2001 xsetdir - set current directory of the process */ LVAL xsetdir() { TCHAR ssCurDir[MAX_PATH], szCurDir[MAX_PATH]; int verbose = TRUE; strcpy(ssCurDir, getstring(xlgastring())); if (moreargs()) { verbose = (xlgetarg() != NIL); } xllastarg(); if (ok_to_open(ssCurDir, "r")) { if (SetCurrentDirectory(ssCurDir)) { if (GetCurrentDirectory( sizeof(szCurDir)/sizeof(TCHAR), szCurDir)) { return cvstring(szCurDir); /* create the result string stdputstr("Current Directory: "); stdputstr(szCurDir); stdputstr("\n"); */ } } } if (verbose) stdputstr("Directory Setting Error\n"); /* return nil on error*/ return NIL; }
void quantize_print_tree(snd_susp_type a_susp, int n) { quantize_susp_type susp = (quantize_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); }
/* xsort - built-in function 'sort' */ LVAL xsort(void) { LVAL sortlist(); LVAL list,fcn; /* protect some pointers */ xlstkcheck(2); xlsave(list); xlsave(fcn); /* get the list to sort and the comparison function */ list = xlgalist(); fcn = xlgetarg(); xllastarg(); /* sort the list */ list = sortlist(list,fcn); if (list && (ntype(list) == FREE_NODE)) { stdputstr("error in sort 2"); } /* restore the stack and return the sorted list */ xlpopn(2); return (list); }
void abs_print_tree(snd_susp_type a_susp, int n) { abs_susp_type susp = (abs_susp_type) a_susp; indent(n); stdputstr("input:"); sound_print_tree_1(susp->input, n); }
void follow_print_tree(snd_susp_type a_susp, int n) { follow_susp_type susp = (follow_susp_type) a_susp; indent(n); stdputstr("sndin:"); sound_print_tree_1(susp->sndin, n); }
void clip_print_tree(snd_susp_type a_susp, int n) { clip_susp_type susp = (clip_susp_type) a_susp; indent(n); stdputstr("s:"); sound_print_tree_1(susp->s, n); }
void convolve_print_tree(snd_susp_type a_susp, int n) { convolve_susp_type susp = (convolve_susp_type) a_susp; indent(n); stdputstr("x_snd:"); sound_print_tree_1(susp->x_snd, n); }
void offset_print_tree(snd_susp_type a_susp, int n) { offset_susp_type susp = (offset_susp_type) a_susp; indent(n); stdputstr("s1:"); sound_print_tree_1(susp->s1, n); }
static int breakloop(char *hdr, char *cmsg, char *emsg, NODE *arg, int cflag) { NODE ***oldstk,*expr,*val; CONTEXT cntxt; int type; xlerrprint(hdr,cmsg,emsg,arg); xlflush(); if (((s_tracenable)->n_info.n_xsym.xsy_value)) { val = ((s_tlimit)->n_info.n_xsym.xsy_value); xlbaktrace(((val) && (val)->n_type == 5) ? (int)((val)->n_info.n_xint.xi_int) : -1); } oldstk = xlsave(&expr,(NODE **)0); xldebug++; xlbegin(&cntxt,8|16|32,true); for (type = 0; type == 0; ) { if (type = setjmp(cntxt.c_jmpbuf)) switch (type) { case 8: xlflush(); type = 0; continue; case 16: continue; case 32: if (cflag) { stdputstr("[ continue from break loop ]\n"); continue; } else xlabort("this error can't be continued"); } if (!xlread(((s_stdin)->n_info.n_xsym.xsy_value),&expr,0)) { type = 16; break; } expr = xleval(expr); xlprint(((s_stdout)->n_info.n_xsym.xsy_value),expr,1); xlterpri(((s_stdout)->n_info.n_xsym.xsy_value)); } xlend(&cntxt); xldebug--; xlstack = oldstk; if (type == 16) { stdputstr("[ abort to previous level ]\n"); xlsignal(0,(NODE *)0); } }
void print_local_gc_info(void) { char buf[50]; /* print sample blocks */ sprintf(buf, "; samples %dKB, %dKB free", (sample_block_total * max_sample_block_len) / 1024, ((sample_block_total - sample_block_used) * max_sample_block_len) / 1024); stdputstr(buf); }
void pop_xlenv(void) { char s[10]; if (envstack_top <= 0) { sprintf(s, ", %d! ", envstack_top); stdputstr(s); xlabort("envstack underflow!"); } else envstack_top--; /* sprintf(s, "%d> ", envstack_top); stdputstr(s); */ }
void sax_all_print_tree(snd_susp_type a_susp, int n) { sax_all_susp_type susp = (sax_all_susp_type) a_susp; indent(n); stdputstr("breath_env:"); sound_print_tree_1(susp->breath_env, n); indent(n); stdputstr("freq_env:"); sound_print_tree_1(susp->freq_env, n); indent(n); stdputstr("reed_stiffness:"); sound_print_tree_1(susp->reed_stiffness, n); indent(n); stdputstr("noise_env:"); sound_print_tree_1(susp->noise_env, n); indent(n); stdputstr("blow_pos:"); sound_print_tree_1(susp->blow_pos, n); indent(n); stdputstr("reed_table_offset:"); sound_print_tree_1(susp->reed_table_offset, n); }
/* stats - print memory statistics */ LOCAL void stats(void) { sprintf(buf,"Nodes: %ld\n",nnodes); stdputstr(buf); sprintf(buf,"Free nodes: %ld\n",nfree); stdputstr(buf); sprintf(buf,"Segments: %d\n",nsegs); stdputstr(buf); sprintf(buf,"Allocate: %d\n",anodes); stdputstr(buf); sprintf(buf,"Total: %ld\n",total); stdputstr(buf); sprintf(buf,"Collections: %d\n",gccalls); stdputstr(buf); }
/* xrestore - restore a saved memory image */ LVAL xrestore(void) { extern jmp_buf top_level; unsigned char *name; /* get the file name, verbose flag and print flag */ name = getstring(xlgetfname()); xllastarg(); /* restore the saved memory image */ if (!xlirestore((char *) name)) return (NIL); /* return directly to the top level */ stdputstr("[ returning to the top level ]\n"); longjmp(top_level,1); }