Exemple #1
0
static void limiter_tilde_helper(t_limiter *x)
{
  post("\n\n%c %d-channel limiter-object: mode %d", HEARTSYMBOL, x->number_of_inlets, x->mode);
  poststring("\n'mode <mode>'\t\t\t: (0_limiter, 1_crack-limiter, 2_compressor)");
  poststring("\n'LIMIT'\t\t\t\t: set to LIMITer");
  poststring("\n'CRACK'\t\t\t\t: set to CRACK-limiter");
  poststring("\n'COMPRESS'\t\t\t\t: set to COMPRESSor");

  switch (x->mode) {
  case LIMIT0:
    poststring("\n'limit <limit>'\t\t\t: set limit (in dB)"
	       "\n'set <limit><htime><rtime>'\t: set limiter");
    break;
  case LIMIT1:
    poststring("\n'limits <limit1><limit2>'\t: set limits (in dB)"
	       "\n'set  <limit1><htime1><rtime1>'\t: set limiter 1"
	       "\n'set2 <limit2><htime2><rtime2>'\t: set crack-limiter");
    break;
  case COMPRESS:
    poststring("\n'ratio <compressratio>'\t\t: set compressratio (Ž0.5Ž instead of Ž1:2Ž)"
	       "\n'treshold <treshold>'\t\t: set treshold of the compressor"
	       "\n'compress <limit><treshold><ratio>'\t: set compressor"
	       "\n..........note that <limit> is the same for COMPRESSOR and LIMITER..........");
    break;
  default:
    break;
  }
  poststring("\n'print'\t\t\t\t: view actual settings"	
	     "\n'help'\t\t\t\t: view this\n");
  poststring("\ncreating arguments are :\n"
	     "\"limiter~ [<in1> [<in2> [<in3> [...]]]]\":	<in*> may be anything\n");
  endpost();
}
Exemple #2
0
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");
}
Exemple #3
0
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();
}
Exemple #4
0
/* 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();
    }
}