aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/d_array.c106
-rw-r--r--pd/src/d_soundfile.c86
-rw-r--r--pd/src/g_array.c18
-rw-r--r--pd/src/g_graph.c10
-rw-r--r--pd/src/g_readwrite.c3
-rw-r--r--pd/src/m_pd.h7
-rw-r--r--pd/src/makefile.in11
-rw-r--r--pd/src/makefile.irix190
-rw-r--r--pd/src/notes.txt9
-rw-r--r--pd/src/s_audio_sgi.c460
-rw-r--r--pd/src/s_midi_sgi.c203
-rw-r--r--pd/src/s_path.c2
12 files changed, 140 insertions, 965 deletions
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index 6cfea1fc..de72ef12 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -18,7 +18,7 @@ typedef struct _tabwrite_tilde
t_object x_obj;
int x_phase;
int x_nsampsintab;
- float *x_vec;
+ t_word *x_vec;
t_symbol *x_arrayname;
float x_f;
} t_tabwrite_tilde;
@@ -52,7 +52,7 @@ static t_int *tabwrite_tilde_perform(t_int *w)
if (endphase > phase)
{
int nxfer = endphase - phase;
- float *fp = x->x_vec + phase;
+ t_word *wp = x->x_vec + phase;
if (nxfer > n) nxfer = n;
phase += nxfer;
while (nxfer--)
@@ -60,7 +60,7 @@ static t_int *tabwrite_tilde_perform(t_int *w)
float f = *in++;
if (PD_BIGORSMALL(f))
f = 0;
- *fp++ = f;
+ (wp++)->w_float = f;
}
if (phase >= endphase)
{
@@ -85,7 +85,7 @@ void tabwrite_tilde_set(t_tabwrite_tilde *x, t_symbol *s)
x->x_arrayname->s_name);
x->x_vec = 0;
}
- else if (!garray_getfloatarray(a, &x->x_nsampsintab, &x->x_vec))
+ else if (!garray_getfloatwords(a, &x->x_nsampsintab, &x->x_vec))
{
pd_error(x, "%s: bad template for tabwrite~", x->x_arrayname->s_name);
x->x_vec = 0;
@@ -146,7 +146,7 @@ typedef struct _tabplay_tilde
int x_phase;
int x_nsampsintab;
int x_limit;
- float *x_vec;
+ t_word *x_vec;
t_symbol *x_arrayname;
t_clock *x_clock;
} t_tabplay_tilde;
@@ -168,7 +168,8 @@ static void *tabplay_tilde_new(t_symbol *s)
static t_int *tabplay_tilde_perform(t_int *w)
{
t_tabplay_tilde *x = (t_tabplay_tilde *)(w[1]);
- t_float *out = (t_float *)(w[2]), *fp;
+ t_float *out = (t_float *)(w[2]);
+ t_word *wp;
int n = (int)(w[3]), phase = x->x_phase,
endphase = (x->x_nsampsintab < x->x_limit ?
x->x_nsampsintab : x->x_limit), nxfer, n3;
@@ -176,13 +177,13 @@ static t_int *tabplay_tilde_perform(t_int *w)
goto zero;
nxfer = endphase - phase;
- fp = x->x_vec + phase;
+ wp = x->x_vec + phase;
if (nxfer > n)
nxfer = n;
n3 = n - nxfer;
phase += nxfer;
while (nxfer--)
- *out++ = *fp++;
+ *out++ = (wp++)->w_float;
if (phase >= endphase)
{
clock_delay(x->x_clock, 0);
@@ -209,7 +210,7 @@ void tabplay_tilde_set(t_tabplay_tilde *x, t_symbol *s)
x->x_arrayname->s_name);
x->x_vec = 0;
}
- else if (!garray_getfloatarray(a, &x->x_nsampsintab, &x->x_vec))
+ else if (!garray_getfloatwords(a, &x->x_nsampsintab, &x->x_vec))
{
pd_error(x, "%s: bad template for tabplay~", x->x_arrayname->s_name);
x->x_vec = 0;
@@ -273,7 +274,7 @@ typedef struct _tabread_tilde
{
t_object x_obj;
int x_npoints;
- float *x_vec;
+ t_word *x_vec;
t_symbol *x_arrayname;
float x_f;
} t_tabread_tilde;
@@ -295,7 +296,7 @@ static t_int *tabread_tilde_perform(t_int *w)
t_float *out = (t_float *)(w[3]);
int n = (int)(w[4]);
int maxindex;
- float *buf = x->x_vec, *fp;
+ t_word *buf = x->x_vec;
int i;
maxindex = x->x_npoints - 1;
@@ -308,7 +309,7 @@ static t_int *tabread_tilde_perform(t_int *w)
index = 0;
else if (index > maxindex)
index = maxindex;
- *out++ = buf[index];
+ *out++ = buf[index].w_float;
}
return (w+5);
zero:
@@ -328,7 +329,7 @@ void tabread_tilde_set(t_tabread_tilde *x, t_symbol *s)
pd_error(x, "tabread~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
- else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec))
+ else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec))
{
pd_error(x, "%s: bad template for tabread~", x->x_arrayname->s_name);
x->x_vec = 0;
@@ -369,7 +370,7 @@ typedef struct _tabread4_tilde
{
t_object x_obj;
int x_npoints;
- float *x_vec;
+ t_word *x_vec;
t_symbol *x_arrayname;
float x_f;
} t_tabread4_tilde;
@@ -391,7 +392,7 @@ static t_int *tabread4_tilde_perform(t_int *w)
t_float *out = (t_float *)(w[3]);
int n = (int)(w[4]);
int maxindex;
- float *buf = x->x_vec, *fp;
+ t_word *buf = x->x_vec, *wp;
int i;
maxindex = x->x_npoints - 3;
@@ -425,11 +426,11 @@ static t_int *tabread4_tilde_perform(t_int *w)
else if (index > maxindex)
index = maxindex, frac = 1;
else frac = findex - index;
- fp = buf + index;
- a = fp[-1];
- b = fp[0];
- c = fp[1];
- d = fp[2];
+ wp = buf + index;
+ a = wp[-1].w_float;
+ b = wp[0].w_float;
+ c = wp[1].w_float;
+ d = wp[2].w_float;
/* if (!i && !(count++ & 1023))
post("fp = %lx, shit = %lx, b = %f", fp, buf->b_shit, b); */
cminusb = c-b;
@@ -457,7 +458,7 @@ void tabread4_tilde_set(t_tabread4_tilde *x, t_symbol *s)
pd_error(x, "tabread4~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
- else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec))
+ else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec))
{
pd_error(x, "%s: bad template for tabread4~", x->x_arrayname->s_name);
x->x_vec = 0;
@@ -563,7 +564,7 @@ typedef struct _tabosc4_tilde
t_object x_obj;
float x_fnpoints;
float x_finvnpoints;
- float *x_vec;
+ t_word *x_vec;
t_symbol *x_arrayname;
float x_f;
double x_phase;
@@ -595,7 +596,7 @@ static t_int *tabosc4_tilde_perform(t_int *w)
int mask = fnpoints - 1;
float conv = fnpoints * x->x_conv;
int maxindex;
- float *tab = x->x_vec, *addr;
+ t_word *tab = x->x_vec, *addr;
int i;
double dphase = fnpoints * x->x_phase + UNITBIT32;
@@ -612,10 +613,10 @@ static t_int *tabosc4_tilde_perform(t_int *w)
addr = tab + (tf.tf_i[HIOFFSET] & mask);
tf.tf_i[HIOFFSET] = normhipart;
frac = tf.tf_d - UNITBIT32;
- a = addr[0];
- b = addr[1];
- c = addr[2];
- d = addr[3];
+ a = addr[0].w_float;
+ b = addr[1].w_float;
+ c = addr[2].w_float;
+ d = addr[3].w_float;
cminusb = c-b;
*out++ = b + frac * (
cminusb - 0.1666667f * (1.-frac) * (
@@ -649,7 +650,7 @@ void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
pd_error(x, "tabosc4~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
- else if (!garray_getfloatarray(a, &pointsinarray, &x->x_vec))
+ else if (!garray_getfloatwords(a, &pointsinarray, &x->x_vec))
{
pd_error(x, "%s: bad template for tabosc4~", x->x_arrayname->s_name);
x->x_vec = 0;
@@ -704,7 +705,7 @@ static t_class *tabsend_class;
typedef struct _tabsend
{
t_object x_obj;
- float *x_vec;
+ t_word *x_vec;
int x_graphperiod;
int x_graphcount;
t_symbol *x_arrayname;
@@ -727,7 +728,7 @@ static t_int *tabsend_perform(t_int *w)
t_tabsend *x = (t_tabsend *)(w[1]);
t_float *in = (t_float *)(w[2]);
int n = w[3];
- t_float *dest = x->x_vec;
+ t_word *dest = x->x_vec;
int i = x->x_graphcount;
if (!x->x_vec) goto bad;
@@ -736,7 +737,7 @@ static t_int *tabsend_perform(t_int *w)
float f = *in++;
if (PD_BIGORSMALL(f))
f = 0;
- *dest++ = f;
+ (dest++)->w_float = f;
}
if (!i--)
{
@@ -761,7 +762,7 @@ static void tabsend_dsp(t_tabsend *x, t_signal **sp)
if (*x->x_arrayname->s_name)
pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
}
- else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
+ else if (!garray_getfloatwords(a, &vecsize, &x->x_vec))
pd_error(x, "%s: bad template for tabsend~", x->x_arrayname->s_name);
else
{
@@ -791,7 +792,7 @@ static t_class *tabreceive_class;
typedef struct _tabreceive
{
t_object x_obj;
- float *x_vec;
+ t_word *x_vec;
int x_vecsize;
t_symbol *x_arrayname;
} t_tabreceive;
@@ -801,12 +802,12 @@ static t_int *tabreceive_perform(t_int *w)
t_tabreceive *x = (t_tabreceive *)(w[1]);
t_float *out = (t_float *)(w[2]);
int n = w[3];
- t_float *from = x->x_vec;
+ t_word *from = x->x_vec;
if (from)
{
int vecsize = x->x_vecsize;
while (vecsize--)
- *out++ = *from++;
+ *out++ = (from++)->w_float;
vecsize = n - x->x_vecsize;
while (vecsize--)
*out++ = 0;
@@ -823,7 +824,7 @@ static void tabreceive_dsp(t_tabreceive *x, t_signal **sp)
if (*x->x_arrayname->s_name)
pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
}
- else if (!garray_getfloatarray(a, &x->x_vecsize, &x->x_vec))
+ else if (!garray_getfloatwords(a, &x->x_vecsize, &x->x_vec))
pd_error(x, "%s: bad template for tabreceive~", x->x_arrayname->s_name);
else
{
@@ -865,18 +866,18 @@ static void tabread_float(t_tabread *x, t_float f)
{
t_garray *a;
int npoints;
- t_float *vec;
+ t_word *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(a, &npoints, &vec))
+ else if (!garray_getfloatwords(a, &npoints, &vec))
pd_error(x, "%s: bad template for tabread", x->x_arrayname->s_name);
else
{
int n = f;
if (n < 0) n = 0;
else if (n >= npoints) n = npoints - 1;
- outlet_float(x->x_obj.ob_outlet, (npoints ? vec[n] : 0));
+ outlet_float(x->x_obj.ob_outlet, (npoints ? vec[n].w_float : 0));
}
}
@@ -916,30 +917,31 @@ static void tabread4_float(t_tabread4 *x, t_float f)
{
t_garray *a;
int npoints;
- t_float *vec;
+ t_word *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(a, &npoints, &vec))
+ else if (!garray_getfloatwords(a, &npoints, &vec))
pd_error(x, "%s: bad template for tabread4", x->x_arrayname->s_name);
else if (npoints < 4)
outlet_float(x->x_obj.ob_outlet, 0);
else if (f <= 1)
- outlet_float(x->x_obj.ob_outlet, vec[1]);
+ outlet_float(x->x_obj.ob_outlet, vec[1].w_float);
else if (f >= npoints - 2)
- outlet_float(x->x_obj.ob_outlet, vec[npoints - 2]);
+ outlet_float(x->x_obj.ob_outlet, vec[npoints - 2].w_float);
else
{
int n = f;
- float a, b, c, d, cminusb, frac, *fp;
+ float a, b, c, d, cminusb, frac;
+ t_word *wp;
if (n >= npoints - 2)
n = npoints - 3;
- fp = vec + n;
+ wp = vec + n;
frac = f - n;
- a = fp[-1];
- b = fp[0];
- c = fp[1];
- d = fp[2];
+ a = wp[-1].w_float;
+ b = wp[0].w_float;
+ c = wp[1].w_float;
+ d = wp[2].w_float;
cminusb = c-b;
outlet_float(x->x_obj.ob_outlet, b + frac * (
cminusb - 0.1666667f * (1.-frac) * (
@@ -984,11 +986,11 @@ static void tabwrite_float(t_tabwrite *x, t_float f)
{
int i, vecsize;
t_garray *a;
- t_float *vec;
+ t_word *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(a, &vecsize, &vec))
+ else if (!garray_getfloatwords(a, &vecsize, &vec))
pd_error(x, "%s: bad template for tabwrite", x->x_arrayname->s_name);
else
{
@@ -997,7 +999,7 @@ static void tabwrite_float(t_tabwrite *x, t_float f)
n = 0;
else if (n >= vecsize)
n = vecsize-1;
- vec[n] = f;
+ vec[n].w_float = f;
garray_redraw(a);
}
}
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index 9f186b2d..56c89e07 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -422,7 +422,7 @@ int open_soundfile_via_canvas(t_canvas *canvas, const char *filename, int header
static void soundfile_xferin(int sfchannels, int nvecs, float **vecs,
long itemsread, unsigned char *buf, int nitems, int bytespersamp,
- int bigendian)
+ int bigendian, int spread)
{
int i, j;
unsigned char *sp, *sp2;
@@ -435,14 +435,14 @@ static void soundfile_xferin(int sfchannels, int nvecs, float **vecs,
{
if (bigendian)
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*fp = SCALE * ((sp2[0] << 24) | (sp2[1] << 16));
}
else
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*fp = SCALE * ((sp2[1] << 24) | (sp2[0] << 16));
}
}
@@ -450,15 +450,15 @@ static void soundfile_xferin(int sfchannels, int nvecs, float **vecs,
{
if (bigendian)
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*fp = SCALE * ((sp2[0] << 24) | (sp2[1] << 16)
| (sp2[2] << 8));
}
else
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*fp = SCALE * ((sp2[2] << 24) | (sp2[1] << 16)
| (sp2[0] << 8));
}
@@ -467,15 +467,15 @@ static void soundfile_xferin(int sfchannels, int nvecs, float **vecs,
{
if (bigendian)
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*(long *)fp = ((sp2[0] << 24) | (sp2[1] << 16)
| (sp2[2] << 8) | sp2[3]);
}
else
{
- for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ for (j = 0, sp2 = sp, fp=vecs[i] + spread * itemsread;
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
*(long *)fp = ((sp2[3] << 24) | (sp2[2] << 16)
| (sp2[1] << 8) | sp2[0]);
}
@@ -824,7 +824,7 @@ baddonewrite:
static void soundfile_xferout(int nchannels, float **vecs,
unsigned char *buf, int nitems, long onset, int bytespersamp,
- int bigendian, float normalfactor)
+ int bigendian, float normalfactor, int spread)
{
int i, j;
unsigned char *sp, *sp2;
@@ -839,7 +839,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
if (bigendian)
{
for (j = 0, sp2 = sp, fp = vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
int xx = 32768. + (*fp * ff);
xx -= 32768;
@@ -854,7 +854,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
else
{
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
int xx = 32768. + (*fp * ff);
xx -= 32768;
@@ -873,7 +873,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
if (bigendian)
{
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
int xx = 8388608. + (*fp * ff);
xx -= 8388608;
@@ -889,7 +889,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
else
{
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
int xx = 8388608. + (*fp * ff);
xx -= 8388608;
@@ -908,7 +908,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
if (bigendian)
{
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
@@ -919,7 +919,7 @@ static void soundfile_xferout(int nchannels, float **vecs,
else
{
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
- j < nitems; j++, sp2 += bytesperframe, fp++)
+ j < nitems; j++, sp2 += bytesperframe, fp += spread)
{
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
@@ -975,7 +975,7 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
int fd = -1;
char endianness, *filename;
t_garray *garrays[MAXSFCHANS];
- t_float *vecs[MAXSFCHANS];
+ t_word *vecs[MAXSFCHANS];
char sampbuf[SAMPBUFSIZE];
int bufframes, nitems;
FILE *fp;
@@ -1051,7 +1051,8 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
pd_error(x, "%s: no such table", argv[i].a_w.w_symbol->s_name);
goto done;
}
- else if (!garray_getfloatarray(garrays[i], &vecsize, &vecs[i]))
+ else if (!garray_getfloatwords(garrays[i], &vecsize,
+ &vecs[i]))
error("%s: bad template for tabwrite",
argv[i].a_w.w_symbol->s_name);
if (finalsize && finalsize != vecsize && !resize)
@@ -1101,7 +1102,8 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
garray_resize(garrays[i], finalsize);
/* for sanity's sake let's clear the save-in-patch flag here */
garray_setsaveit(garrays[i], 0);
- garray_getfloatarray(garrays[i], &vecsize, &vecs[i]);
+ garray_getfloatwords(garrays[i], &vecsize,
+ &vecs[i]);
/* if the resize failed, garray_resize reported the error */
if (vecsize != framesinfile)
{
@@ -1122,8 +1124,9 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
thisread = (thisread > bufframes ? bufframes : thisread);
nitems = fread(sampbuf, channels * bytespersamp, thisread, fp);
if (nitems <= 0) break;
- soundfile_xferin(channels, argc, vecs, itemsread,
- (unsigned char *)sampbuf, nitems, bytespersamp, bigendian);
+ soundfile_xferin(channels, argc, (float **)vecs, itemsread,
+ (unsigned char *)sampbuf, nitems, bytespersamp, bigendian,
+ sizeof(t_word)/sizeof(float));
itemsread += nitems;
}
/* zero out remaining elements of vectors */
@@ -1131,18 +1134,18 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
for (i = 0; i < argc; i++)
{
int nzero, vecsize;
- garray_getfloatarray(garrays[i], &vecsize, &vecs[i]);
+ garray_getfloatwords(garrays[i], &vecsize, &vecs[i]);
for (j = itemsread; j < vecsize; j++)
- vecs[i][j] = 0;
+ vecs[i][j].w_float = 0;
}
/* zero out vectors in excess of number of channels */
for (i = channels; i < argc; i++)
{
int vecsize;
- float *foo;
- garray_getfloatarray(garrays[i], &vecsize, &foo);
+ t_word *foo;
+ garray_getfloatwords(garrays[i], &vecsize, &foo);
for (j = 0; j < vecsize; j++)
- foo[j] = 0;
+ foo[j].w_float = 0;
}
/* do all graphics updates */
for (i = 0; i < argc; i++)
@@ -1171,7 +1174,7 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
long onset, nframes, itemsleft,
maxsize = DEFMAXSIZE, itemswritten = 0;
t_garray *garrays[MAXSFCHANS];
- t_float *vecs[MAXSFCHANS];
+ t_word *vecs[MAXSFCHANS];
char sampbuf[SAMPBUFSIZE];
int bufframes, nitems;
int fd = -1;
@@ -1198,7 +1201,7 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
pd_error(obj, "%s: no such table", argv[i].a_w.w_symbol->s_name);
goto fail;
}
- else if (!garray_getfloatarray(garrays[i], &vecsize, &vecs[i]))
+ else if (!garray_getfloatwords(garrays[i], &vecsize, &vecs[i]))
error("%s: bad template for tabwrite",
argv[i].a_w.w_symbol->s_name);
if (nframes > vecsize - onset)
@@ -1206,10 +1209,10 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
for (j = 0; j < vecsize; j++)
{
- if (vecs[i][j] > biggest)
- biggest = vecs[i][j];
- else if (-vecs[i][j] > biggest)
- biggest = -vecs[i][j];
+ if (vecs[i][j].w_float > biggest)
+ biggest = vecs[i][j].w_float;
+ else if (-vecs[i][j].w_float > biggest)
+ biggest = -vecs[i][j].w_float;
}
}
if (nframes <= 0)
@@ -1244,8 +1247,9 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
{
int thiswrite = nframes - itemswritten, nitems, nbytes;
thiswrite = (thiswrite > bufframes ? bufframes : thiswrite);
- soundfile_xferout(argc, vecs, (unsigned char *)sampbuf, thiswrite,
- onset, bytespersamp, bigendian, normfactor);
+ soundfile_xferout(argc, (t_float **)vecs, (unsigned char *)sampbuf,
+ thiswrite, onset, bytespersamp, bigendian, normfactor,
+ sizeof(t_word)/sizeof(float));
nbytes = write(fd, sampbuf, nchannels * bytespersamp * thiswrite);
if (nbytes < nchannels * bytespersamp * thiswrite)
{
@@ -1789,7 +1793,7 @@ static t_int *readsf_perform(t_int *w)
{
soundfile_xferin(sfchannels, noutlets, x->x_outvec, 0,
(unsigned char *)(x->x_buf + x->x_fifotail), xfersize,
- bytespersample, bigendian);
+ bytespersample, bigendian, 1);
vecsize -= xfersize;
}
/* then zero out the (rest of the) output */
@@ -1804,7 +1808,7 @@ static t_int *readsf_perform(t_int *w)
soundfile_xferin(sfchannels, noutlets, x->x_outvec, 0,
(unsigned char *)(x->x_buf + x->x_fifotail), vecsize,
- bytespersample, bigendian);
+ bytespersample, bigendian, 1);
x->x_fifotail += wantbytes;
if (x->x_fifotail >= x->x_fifosize)
@@ -2264,7 +2268,7 @@ static t_int *writesf_perform(t_int *w)
soundfile_xferout(sfchannels, x->x_outvec,
(unsigned char *)(x->x_buf + x->x_fifohead), vecsize, 0,
- bytespersample, bigendian, 1.);
+ bytespersample, bigendian, 1., 1);
x->x_fifohead += wantbytes;
if (x->x_fifohead >= x->x_fifosize)
diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index 95819282..1b44e548 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -1130,7 +1130,7 @@ char *garray_vec(t_garray *x) /* get the contents */
/* routine that checks if we're just an array of floats and if
so returns the goods */
-int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
+int garray_getfloatwords(t_garray *x, int *size, t_word **vec)
{
int yonset, type, elemsize;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
@@ -1145,9 +1145,23 @@ int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
return (0);
}
*size = garray_npoints(x);
- *vec = (float *)garray_vec(x);
+ *vec = (t_word *)garray_vec(x);
return (1);
}
+ /* older, non-64-bit safe version, supplied for older externs */
+
+int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
+{
+ if (sizeof(t_word) != sizeof(float))
+ {
+ static int warned;
+ if (!warned)
+ post(
+ "warning: extern using garray_getfloatarray() won't work in 64-bit version");
+ warned = 1;
+ }
+ return (garray_getfloatwords(x, size, (t_word **)vec));
+}
/* set the "saveit" flag */
void garray_setsaveit(t_garray *x, int saveit)
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 97fe71e7..1f449a63 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -999,7 +999,7 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
t_garray *a = (t_garray *)(x->gl_list);
int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix);
int newx = 0.5 + glist_pixelstox(x, newxpix);
- t_float *vec;
+ t_word *vec;
int nelem, i;
float oldy = glist_pixelstoy(x, graph_lastypix);
float newy = glist_pixelstoy(x, newypix);
@@ -1008,7 +1008,7 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
/* verify that the array is OK */
if (!a || pd_class((t_pd *)a) != garray_class)
return;
- if (!garray_getfloatarray(a, &nelem, &vec))
+ if (!garray_getfloatwords(a, &nelem, &vec))
return;
if (oldx < 0) oldx = 0;
if (oldx >= nelem)
@@ -1019,16 +1019,16 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
if (oldx < newx - 1)
{
for (i = oldx + 1; i <= newx; i++)
- vec[i] = newy + (oldy - newy) *
+ vec[i].w_float = newy + (oldy - newy) *
((float)(newx - i))/(float)(newx - oldx);
}
else if (oldx > newx + 1)
{
for (i = oldx - 1; i >= newx; i--)
- vec[i] = newy + (oldy - newy) *
+ vec[i].w_float = newy + (oldy - newy) *
((float)(newx - i))/(float)(newx - oldx);
}
- else vec[newx] = newy;
+ else vec[newx].w_float = newy;
garray_redraw(a);
}
diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index 3efb6c7e..ff93a4dd 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -258,8 +258,7 @@ static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format,
else if (*format->s_name)
error("qlist_read: unknown flag: %s", format->s_name);
- if (binbuf_read_via_path(b, filename->s_name,
- canvas_getdir(canvas)->s_name, cr))
+ if (binbuf_read_via_canvas(b, filename->s_name, canvas, cr))
{
pd_error(x, "read failed");
binbuf_free(b);
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index 8f22b765..19795414 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -9,9 +9,9 @@ extern "C" {
#endif
#define PD_MAJOR_VERSION 0
-#define PD_MINOR_VERSION 40
-#define PD_BUGFIX_VERSION 1
-#define PD_TEST_VERSION ""
+#define PD_MINOR_VERSION 41
+#define PD_BUGFIX_VERSION 0
+#define PD_TEST_VERSION "test03"
/* old name for "MSW" flag -- we have to take it for the sake of many old
"nmakefiles" for externs, which will define NT and not MSW */
@@ -571,6 +571,7 @@ EXTERN_STRUCT _garray;
EXTERN t_class *garray_class;
EXTERN int garray_getfloatarray(t_garray *x, int *size, t_float **vec);
+EXTERN int garray_getfloatwords(t_garray *x, int *size, t_word **vec);
EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx);
EXTERN void garray_redraw(t_garray *x);
EXTERN int garray_npoints(t_garray *x);
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index 05a1ecf8..8b41c5bf 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -110,15 +110,14 @@ $(BIN_DIR)/pdreceive: u_pdreceive.c $(BIN_DIR)
$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
$(PDEXEC): $(OBJ) $(BIN_DIR)
- cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
- $(LIB)
-
+ cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
+
$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
- cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) \
- $(GLIB)
+ cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
-$(BIN_DIR)/pd.tk: u_main.tk
+$(BIN_DIR)/pd.tk: u_main.tk $(BIN_DIR)
cp u_main.tk $(BIN_DIR)/pd.tk
+ touch -r makefile.dependencies $(BIN_DIR)
#this is for Max OSX only...
$(BIN_DIR)/libPdTcl.dylib: $(GOBJ) $(GSRC)
diff --git a/pd/src/makefile.irix b/pd/src/makefile.irix
deleted file mode 100644
index 38c296a0..00000000
--- a/pd/src/makefile.irix
+++ /dev/null
@@ -1,190 +0,0 @@
-# Makefile mods by Olaf Matthes for use with GCC 3.3
-#
-# This makefile is made for r10000. You can change r10000 to your
-# processor type if you have problems. Just change and type
-# 'make'
-#
-# You will need to change the tck/tk paths if you want to recompile
-# The GUI part.
-
-# compile with GCC as n32 binary
-EXECUTABLE=../bin/pd-n32
-XF1=-mabi=n32 -mips4 -DN32 -funroll-loops -fomit-frame-pointer
-
-# compile with GCC as o32 binary
-#EXECUTABLE=../bin/pd-o32
-#XF1=-mcpu=r4000 -mips3 -funroll-loops -fomit-frame-pointer
-
-CC=gcc
-OBJ_DIR = ../obj
-BIN_DIR = ../bin
-PDEXEC = $(BIN_DIR)/pd
-EXT= pd_irix6
-GUINAME= pd-gui
-
-INSTALL_PREFIX = /usr/local
-GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
-
-MANDIR = ${prefix}/man
-
-MORECFLAGS = -DIRIX -DDL_OPEN -DUSEAPI_SGI -I/usr/X11R6/include -Wno-error
-
-INCLUDE = -I. -I../tk/unix/include -I../tcl/unix/include
-GINCLUDE = $(INCLUDE)
-GLIB = ../tk/unix/lib/libtk8.4.a ../tcl/unix/lib/libtcl8.4.a -lm -lX11
-
-LDFLAGS = $(XF1)
-LIB = -laudio -lmd -lm -lpthread
-
-OPT_CFLAGS = -O3
-WARN_CFLAGS = -Wall -W -Werror -Wno-unused \
- -Wno-parentheses -Wno-switch
-ARCH_CFLAGS = -DPD -DUNIX
-
-CFLAGS = $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(MORECFLAGS) $(XF1)
-
-# the sources
-
-SYSSRC = s_midi_sgi.c s_audio_sgi.c
-
-SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
- g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
- g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
- g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
- m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
- m_conf.c m_glob.c m_sched.c \
- s_main.c s_inter.c s_file.c s_print.c \
- s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
- d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
- d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
- d_delay.c d_resample.c \
- x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
- x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \
- $(SYSSRC)
-
-
-OBJ = $(SRC:.c=.o)
-
-GSRC = t_main.c t_tkcmd.c
-
-GOBJ = $(GSRC:.c=.o)
-
-#
-# ------------------ targets ------------------------------------
-#
-
-.PHONY: pd gui pd-watchdog all
-
-all: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
- $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk externs
-
-bin: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
- $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk
-
-.c.o:
- gcc $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
-
-#$(OBJ) : %.o : %.c
-# $(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
-
-#$(GOBJ) : %.o : %.c
-# $(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
-
-pd: $(PDEXEC)
-
-gui: $(BIN_DIR)/$(GUINAME)
-
-pd-watchdog: $(BIN_DIR)/pd-watchdog
-
-$(BIN_DIR)/pd-watchdog: s_watchdog.c
- gcc -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
-
-$(BIN_DIR)/pdsend: u_pdsend.c
- gcc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
-
-$(BIN_DIR)/pdreceive: u_pdreceive.c
- gcc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
-
-$(PDEXEC): $(OBJ)
- cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
- $(LIB)
-
-$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
- cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) \
- $(GLIB)
-
-$(BIN_DIR)/pd.tk: u_main.tk
- echo set pd_nt 2 > $(BIN_DIR)/pd.tk
- grep -v "set pd_nt" < u_main.tk >> $(BIN_DIR)/pd.tk
-
-INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
-MANINSTDIR = $(DESTDIR)/$(MANDIR)
-
-install: all
- install -d $(INSTDIR)/lib/pd/bin
- install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME)
- install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog
- install -m644 $(BIN_DIR)/pd.tk $(INSTDIR)/lib/pd/bin/pd.tk
- install -d $(INSTDIR)/bin
- install -m755 $(PDEXEC) $(INSTDIR)/bin/pd
- install -m 755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
- install -m 755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive
- install -d $(INSTDIR)/lib/pd/extra
- install -d $(INSTDIR)/lib/pd/externs
- install -m 644 $(EXTERNS) $(INSTDIR)/lib/pd/extra
- cp -r ../doc $(INSTDIR)/lib/pd/
- install -d $(INSTDIR)/include
- install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
- install -d $(MANINSTDIR)/man1
- gzip < ../man/pd.1 > $(MANINSTDIR)/man1/pd.1.gz
- chmod 644 $(MANINSTDIR)/man1/pd.1.gz
- gzip < ../man/pdsend.1 > $(MANINSTDIR)/man1/pdsend.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz
- gzip < ../man/pdreceive.1 > $(MANINSTDIR)/man1/pdreceive.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz
-
-local-clean:
- -rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
- $(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
- -rm -f *~
- -(cd ../doc/6.externs; rm -f *.pd_linux)
- -rm -f makefile.dependencies
- touch makefile.dependencies
- chmod 666 makefile.dependencies
-
-extra-clean:
- -rm -f `find ../extra/ -name "*.pd_*"`
- -rm -f tags
-
-clean: extra-clean local-clean
-
-distclean: clean
- rm -rf config.cache config.log config.status makefile tags \
- autom4te-*.cache
- echo all: > makefile
- echo -e "\t./configure" >> makefile
- echo -e "\tmake" >> makefile
-
-tags: $(SRC) $(GSRC); ctags *.[ch]
-
-depend:
- $(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
-
-uninstall:
- -rm -r $(INSTDIR)/lib/pd
- -rm $(INSTDIR)/bin/pd
- -rm $(INSTDIR)/bin/pdsend
- -rm $(INSTDIR)/bin/pdreceive
- -rm $(INSTDIR)/include/m_pd.h
- -rm $(MANINSTDIR)/man/man1/pd.1.gz
- -rm $(MANINSTDIR)/man/man1/pdsend.1.gz
- -rm $(MANINSTDIR)/man/man1/pdreceive.1.gz
-
-include makefile.dependencies
-
-
-
-
-
-
-
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 363741f9..93c9986b 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,4 +1,9 @@
---------------- dolist --------------------
+0.40-1:
+ http "about" broken on MSW?
+ help browser broke on Panurge
+ binbuf_read_via_canvas in x_qlist.c
+
check bug reports on sourceforge
double-click fix on mac?
http://sourceforge.net/tracker/index.php?
@@ -49,8 +54,12 @@ more demonstration patches:
vibrato using variable delay
features:
+sigmund~: sort by pitch; one-shot
+add -x flag to drawnumbers....
+grab new ALSA midi code from devel
externs able to usurp built-ins (+mem alignment for SSE)
replace gatom_escapit with a quoting mechanism (handle '[', spaces, etc.)
+unicode in filenames??? How does this work? (bug report about windows)
sprout inlet for "route", "sel" if one arg
more list functions (see x_list.c)
poly inlet to turn stealing on/off, plus mode to handle note-with-duration
diff --git a/pd/src/s_audio_sgi.c b/pd/src/s_audio_sgi.c
deleted file mode 100644
index 26ebdc81..00000000
--- a/pd/src/s_audio_sgi.c
+++ /dev/null
@@ -1,460 +0,0 @@
-
-/* ----------------------- Experimental routines for SGI -------------- */
-
-/* written by Olaf Matthes <olaf.matthes@gmx.de> */
-
-#ifdef USEAPI_SGI
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <m_pd.h>
-#include <s_stuff.h>
-
-#include <dmedia/audio.h>
-#include <dmedia/midi.h>
-#include <sys/fpu.h>
-#include <errno.h>
-
-#define SGI_MAXDEV 4 /* it's just 3, but default counts as well... */
-#define SGI_MAXCH 12 /* max. number of channels - is this enough? */
-
-static ALport sgi_iport[SGI_MAXDEV];
-static ALport sgi_oport[SGI_MAXDEV];
-static ALconfig sgi_inconfig;
-static ALconfig sgi_outconfig;
-static int sgi_nindevs, sgi_noutdevs;
-static int sgi_inchannels, sgi_outchannels;
-static int sgi_ninchans[SGI_MAXDEV], sgi_noutchans[SGI_MAXDEV];
-
-
- /*
- set the special "flush zero" but (FS, bit 24) in the
- Control Status Register of the FPU of R4k and beyond
- so that the result of any underflowing operation will
- be clamped to zero, and no exception of any kind will
- be generated on the CPU.
-
- thanks to cpirazzi@cp.esd.sgi.com (Chris Pirazzi).
- */
-
-static void sgi_flush_all_underflows_to_zero(void)
-{
- union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
-}
-
-
- /* convert the most common errors into readable strings */
-static char *sgi_get_error_message(int err)
-{
- switch (err)
- {
- case AL_BAD_CONFIG:
- return "Invalid config";
-
- case AL_BAD_DIRECTION:
- return "Invalid direction (neither \"r\" nor \"w\")";
-
- case AL_BAD_OUT_OF_MEM:
- return "Not enough memory";
-
- case AL_BAD_DEVICE_ACCESS:
- return "Audio hardware is not available or is improperly configured";
-
- case AL_BAD_DEVICE:
- return "Invalid device";
-
- case AL_BAD_NO_PORTS:
- return "No audio ports available";
-
- case AL_BAD_QSIZE:
- return "Invalid fifo size";
-
- case AL_BAD_SAMPFMT:
- return "Invalid sample format";
-
- case AL_BAD_FLOATMAX:
- return "Invalid float maximum";
-
- case AL_BAD_WIDTH:
- return "Invalid sample width";
-
- default:
- return "Unknown error";
- }
-}
-
-
-int sgi_open_audio(int nindev, int *indev, int nchin, int *chin,
- int noutdev, int *outdev, int nchout, int *chout, int rate)
-{
- ALpv pvbuf[2];
- int num_devs = 0;
- int in_dev = 0;
- int out_dev = 0;
- int inchans = 0;
- int outchans = 0;
- int err, n, gotchannels;
- char *indevnames[4] = {"DefaultIn", "AnalogIn", "AESIn", "ADATIn"};
- char *outdevnames[4] = {"DefaultOut", "AnalogOut", "AESOut", "ADATOut"};
-
- sgi_flush_all_underflows_to_zero();
-
- if (sys_verbose)
- post("opening sound input...");
-
- for (n = 0; n < nindev; n++)
- {
- int gotchannels = 0;
-
- if (indev[n] >= 0 && indev[n] < SGI_MAXDEV) /* open specified defice by name */
- {
- if (sys_verbose)
- post("opening %s", indevnames[indev[n]]);
- in_dev = alGetResourceByName(AL_SYSTEM,
- indevnames[indev[n]], AL_DEVICE_TYPE);
- }
- else /* open default device */
- {
- if(sys_verbose)post("opening %s", indevnames[0]);
- in_dev = AL_DEFAULT_INPUT;
- }
- if (!in_dev)
- {
- error("%s\n", sgi_get_error_message(in_dev));
- continue; /* try next device, if any */
- }
-
- sgi_inconfig = alNewConfig();
- alSetSampFmt(sgi_inconfig, AL_SAMPFMT_FLOAT);
- alSetFloatMax(sgi_outconfig, 1.1f);
- alSetChannels(sgi_outconfig, chin[n]);
- alSetQueueSize(sgi_inconfig, sys_advance_samples * chin[n]);
- alSetDevice(sgi_inconfig, in_dev);
- sgi_iport[n] = alOpenPort("Pd input port", "r", sgi_inconfig);
- if (!sgi_iport[n])
- fprintf(stderr,"Pd: failed to open audio read port\n");
-
- /* try to set samplerate */
- pvbuf[0].param = AL_RATE;
- pvbuf[0].value.ll = alDoubleToFixed(rate);
- if ((err = alSetParams(in_dev, pvbuf, 1)) < 0)
- {
- post("could not set specified sample rate for input (%s)\n",
- sgi_get_error_message(err));
- if(pvbuf[0].sizeOut < 0)
- post("rate was invalid\n");
- }
- /* check how many channels we actually got */
- pvbuf[0].param = AL_CHANNELS;
- if (alGetParams(in_dev, pvbuf, 1) < 0)
- {
- post("could not figure out how many input channels we got");
- gotchannels = chin[n]; /* assume we got them all */
- }
- else
- {
- gotchannels = pvbuf[0].value.i;
- }
- inchans += gotchannels; /* count total number of channels */
- sgi_ninchans[n] = gotchannels; /* remember channels for this device */
- }
-
- if (sys_verbose)
- post("opening sound output...");
-
- for (n = 0; n < noutdev; n++)
- {
- if (outdev[n] >= 0 && outdev[n] < SGI_MAXDEV) /* open specified defice by name */
- {
- if(sys_verbose)post("opening %s", outdevnames[outdev[n]]);
- out_dev = alGetResourceByName(AL_SYSTEM,
- outdevnames[outdev[n]], AL_DEVICE_TYPE);
- }
- else /* open default device */
- {
- if (sys_verbose)
- post("opening %s", outdevnames[0]);
- out_dev = AL_DEFAULT_OUTPUT;
- }
- if (!out_dev)
- {
- error("%s\n", sgi_get_error_message(out_dev));
- continue; /* try next device, if any */
- }
-
- /* configure the port before opening it */
- sgi_outconfig = alNewConfig();
- alSetSampFmt(sgi_outconfig, AL_SAMPFMT_FLOAT);
- alSetFloatMax(sgi_outconfig, 1.1f);
- alSetChannels(sgi_outconfig, chout[n]);
- alSetQueueSize(sgi_outconfig, sys_advance_samples * chout[n]);
- alSetDevice(sgi_outconfig, out_dev);
-
- /* open the port */
- sgi_oport[n] = alOpenPort("Pd ouput port", "w", sgi_outconfig);
- if (!sgi_oport[n])
- fprintf(stderr,"Pd: failed to open audio write port\n");
-
- /* now try to set sample rate */
- pvbuf[0].param = AL_RATE;
- pvbuf[0].value.ll = alDoubleToFixed(rate);
- if ((err = alSetParams(out_dev, pvbuf, 1)) < 0)
- {
- post("could not set specified sample rate for output (%s)\n",
- sgi_get_error_message(err));
- if(pvbuf[0].sizeOut < 0)
- post("rate was invalid\n");
- }
- /* check how many channels we actually got */
- pvbuf[0].param = AL_CHANNELS;
- if (alGetParams(out_dev, pvbuf, 1) < 0)
- {
- post("could not figure out how many output channels we got");
- gotchannels = chout[n];
- }
- else
- {
- gotchannels = pvbuf[0].value.i;
- }
- outchans += gotchannels;
- sgi_noutchans[n] = gotchannels;
- }
-
- sgi_noutdevs = noutdev;
- sgi_nindevs = nindev;
-
- sgi_inchannels = inchans;
- sgi_outchannels = outchans;
-
- return (!(inchans || outchans));
-}
-
-
-void sgi_close_audio(void)
-{
- int err, n;
- for (n = 0; n < sgi_nindevs; n++)
- {
- if (sgi_iport[n])
- {
- err = alClosePort(sgi_iport[n]);
- if (err < 0)
- error("closing input %d: %s (%d)", n + 1,
- alGetErrorString(oserror()), err);
- }
- }
- for (n = 0; n < sgi_noutdevs; n++)
- {
- if (sgi_oport[n])
- {
- err = alClosePort(sgi_oport[n]);
- if (err < 0)
- error("closing output %d: %s (%d)", n + 1,
- alGetErrorString(oserror()), err);
- }
- }
-}
-
-
- /* call this only if both input and output are open */
-static void sgi_checkiosync(void)
-{
- int i, result, checkit = 1, giveup = 1000, alreadylogged = 0;
- long indelay, outdelay, defect;
-
- if (!(sgi_outchannels && sgi_inchannels))
- return;
-}
-
-
-int sgi_send_dacs(void)
-{
- float buf[SGI_MAXCH * DEFDACBLKSIZE], *fp1, *fp2, *fp3, *fp4;
- static int xferno = 0;
- static int callno = 0;
- static double timenow;
- double timelast;
- int inchannels = (sys_inchannels > sgi_inchannels ?
- sgi_inchannels : sys_inchannels);
- int outchannels = (sys_outchannels > sgi_outchannels ?
- sgi_outchannels : sys_outchannels);
- long outfill[SGI_MAXDEV], infill[SGI_MAXDEV];
- int outdevchannels, indevchannels;
- int i, n, channel;
- int result;
- unsigned int outtransfersize = DEFDACBLKSIZE;
- unsigned int intransfersize = DEFDACBLKSIZE;
-
- /* no audio channels open, return */
- if (!inchannels && !outchannels)
- return (SENDDACS_NO);
-
- timelast = timenow;
- timenow = sys_getrealtime();
-
-#ifdef DEBUG_SGI_XFER
- if (timenow - timelast > 0.050)
- fprintf(stderr, "(%d)",
- (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
-
- callno++;
-
- sgi_checkiosync(); /* check I/O are in sync and data not late */
-
- /* check whether there is enough space in buffers */
- if (sgi_nindevs)
- {
- for (n = 0; n < sgi_nindevs; n++)
- {
- if (alGetFilled(sgi_iport[n]) < intransfersize)
- return SENDDACS_NO;
- }
- }
- if (sgi_noutdevs)
- {
- for(n = 0; n < sgi_noutdevs; n++)
- {
- if (alGetFillable(sgi_oport[n]) < outtransfersize)
- return SENDDACS_NO;
- }
- }
-
- /* output audio data, if we use audio out */
- if (sgi_noutdevs)
- {
- fp2 = sys_soundout; /* point to current output position in buffer */
- for(n = 0; n < sgi_noutdevs; n++)
- {
- outdevchannels = sgi_noutchans[n]; /* channels supported by this device */
-
- for (channel = 0, fp1 = buf;
- channel < outdevchannels; channel++, fp1++, fp2 += DEFDACBLKSIZE)
- {
- for (i = 0, fp3 = fp1, fp4 = fp2; i < DEFDACBLKSIZE;
- i++, fp3 += outdevchannels, fp4++)
- *fp3 = *fp4, *fp4 = 0;
- }
- alWriteFrames(sgi_oport[n], buf, DEFDACBLKSIZE);
- }
- }
-
- /* zero out the output buffer */
- memset(sys_soundout, 0, DEFDACBLKSIZE * sizeof(*sys_soundout) * sys_outchannels);
- if (sys_getrealtime() - timenow > 0.002)
- {
- #ifdef DEBUG_SGI_XFER
- fprintf(stderr, "output %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
- #endif
- timenow = sys_getrealtime();
- sys_log_error(ERR_DACSLEPT);
- }
-
- /* get audio data from input, if we use audio in */
- if (sgi_nindevs)
- {
- fp2 = sys_soundin; /* point to current input position in buffer */
- for (n = 0; n < sgi_nindevs; n++)
- {
- indevchannels = sgi_ninchans[n]; /* channels supported by this device */
-
- if (alGetFilled(sgi_iport[n]) > DEFDACBLKSIZE)
- {
- alReadFrames(sgi_iport[n], buf, DEFDACBLKSIZE);
- }
- else /* have to read but nothing's there... */
- {
- // if (sys_verbose) post("extra ADC buf");
- /* set buffer to silence */
- memset(buf, 0, intransfersize * sizeof(*sys_soundout) * sgi_ninchans[n]);
- }
- for (channel = 0, fp1 = buf;
- channel < indevchannels; channel++, fp1++, fp2 += DEFDACBLKSIZE)
- {
- for (i = 0, fp3 = fp1, fp4 = fp2; i < DEFDACBLKSIZE;
- i++, fp3 += indevchannels, fp4++)
- *fp4 = *fp3;
- }
- }
- }
-
- xferno++;
-
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_SGI_XFER
- fprintf(stderr, "routine took %d msec\n",
- (int)(1000 * (sys_getrealtime() - timenow)));
-#endif
- sys_log_error(ERR_ADCSLEPT);
- }
- return (SENDDACS_YES);
-}
-
-void sgi_getdevs(char *indevlist, int *nindevs,
- char *outdevlist, int *noutdevs, int *canmulti,
- int maxndev, int devdescsize)
-{
-#if 0
- ALpv pvs[1];
- char name[32];
- int i, ndev, err;
- *canmulti = 3; /* supports multiple devices */
-
- /* get max. number of audio ports from system */
- pvs[0].param = AL_DEVICES;
- err = alGetParams(AL_SYSTEM, pvs, 1);
- if (err < 0)
- {
- sprintf("alGetParams failed: %s\n", alGetErrorString(oserror()));
- }
- ndev = pvs[0].value.i;
-
- for (i = 0; i < ndev; i++)
- {
- pvs[0].param = AL_NAME; /* a string parameter */
- pvs[0].value.ptr = name; /* the string we've allocated */
- pvs[0].sizeIn = 32; /* the array size, in characters,
- including space for NULL */
- if (alGetParams(i, pvs, 1) < 0)
- {
- sprintf("alGetParams failed: %s\n", alGetErrorString(oserror()));
- }
- sprintf(indevlist + i * devdescsize, "%d: %s", i + 1, name);
- sprintf(outdevlist + i * devdescsize, "%d: %s", i + 1, name);
- }
- *nindevs = ndev;
- *noutdevs = ndev;
-#else
- sprintf(indevlist + 0 * devdescsize, "Default In");
- sprintf(outdevlist + 0 * devdescsize, "Default Out");
- sprintf(indevlist + 1 * devdescsize, "Analog In");
- sprintf(outdevlist + 1 * devdescsize, "Analog Out");
- sprintf(indevlist + 2 * devdescsize, "AES In");
- sprintf(outdevlist + 2 * devdescsize, "AES Out");
- sprintf(indevlist + 3 * devdescsize, "ADAT In");
- sprintf(outdevlist + 3 * devdescsize, "ADAT Out");
-
- *nindevs = 4;
- *noutdevs = 4;
- *canmulti = 3; /* supports multiple devices */
-#endif
-}
-
-
-/* list devices: only reflect the most common setup (Octane) */
-void sgi_listaudiodevs(void)
-{
- post("common devices on SGI machines:");
- post("#-1 - Default In/Out selected in Audio Panel");
- post("#1 - Analog In/Out");
- post("#2 - AES In/Out");
- post("#3 - ADAT I/O");
-}
-
-#endif /* SGI */
diff --git a/pd/src/s_midi_sgi.c b/pd/src/s_midi_sgi.c
deleted file mode 100644
index 4634b571..00000000
--- a/pd/src/s_midi_sgi.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-#include "m_pd.h"
-#include "s_stuff.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#ifdef HAVE_BSTRING_H
-#include <bstring.h>
-#endif
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include <dmedia/audio.h>
-#include <sys/fpu.h>
-#include <dmedia/midi.h>
-int mdInit(void); /* prototype was messed up in midi.h */
-/* #include "sys/select.h" */
-
-
- /*
- set the special "flush zero" but (FS, bit 24) in the
- Control Status Register of the FPU of R4k and beyond
- so that the result of any underflowing operation will
- be clamped to zero, and no exception of any kind will
- be generated on the CPU.
-
- thanks to cpirazzi@cp.esd.sgi.com (Chris Pirazzi).
- */
-
-static void sgi_flush_all_underflows_to_zero(void)
-{
- union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
-}
-
-#define NPORT 2
-
-static MDport sgi_inport[NPORT];
-static MDport sgi_outport[NPORT];
-
-void sgi_open_midi(int midiin, int midiout)
-{
- int i;
- int sgi_nports = mdInit();
- if (sgi_nports < 0) sgi_nports = 0;
- else if (sgi_nports > NPORT) sgi_nports = NPORT;
- if (sys_verbose)
- {
- if (!sgi_nports)
- {
- post("no serial ports are configured for MIDI;");
- post("if you want to use MIDI, try exiting Pd, typing");
- post("'startmidi -d /dev/ttyd2' to a shell, and restarting Pd.");
- }
- else if (sgi_nports == 1)
- post("Found one MIDI port on %s", mdGetName(0));
- else if (sgi_nports == 2)
- post("Found MIDI ports on %s and %s",
- mdGetName(0), mdGetName(1));
- }
- if (midiin)
- {
- for (i = 0; i < sgi_nports; i++)
- {
- if (!(sgi_inport[i] = mdOpenInPort(mdGetName(i))))
- error("MIDI input port %d: open failed", i+1);;
- }
- }
- if (midiout)
- {
- for (i = 0; i < sgi_nports; i++)
- {
- if (!(sgi_outport[i] = mdOpenOutPort(mdGetName(i))))
- error("MIDI output port %d: open failed", i+1);;
- }
- }
- return;
-}
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- MDevent mdv;
- if (portno >= NPORT || portno < 0 || !sgi_outport[portno]) return;
- mdv.msg[0] = a;
- mdv.msg[1] = b;
- mdv.msg[2] = c;
- mdv.msg[3] = 0;
- mdv.sysexmsg = 0;
- mdv.stamp = 0;
- mdv.msglen = 0;
- if (mdSend(sgi_outport[portno], &mdv, 1) < 0)
- error("MIDI output error\n");
- post("msg out %d %d %d", a, b, c);
-}
-
-void sys_putmidibyte(int portno, int foo)
-{
- error("MIDI raw byte output not available on SGI");
-}
-
-void inmidi_noteon(int portno, int channel, int pitch, int velo);
-void inmidi_controlchange(int portno, int channel, int ctlnumber, int value);
-void inmidi_programchange(int portno, int channel, int value);
-void inmidi_pitchbend(int portno, int channel, int value);
-void inmidi_aftertouch(int portno, int channel, int value);
-void inmidi_polyaftertouch(int portno, int channel, int pitch, int value);
-
-void sys_poll_midi(void)
-{
- int i;
- MDport *mp;
- for (i = 0, mp = sgi_inport; i < NPORT; i++, mp++)
- {
- int ret, status, b1, b2, nfds;
- MDevent mdv;
- fd_set inports;
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- if (!*mp) continue;
- FD_ZERO(&inports);
- FD_SET(mdGetFd(*mp), &inports);
-
- if (select(mdGetFd(*mp)+1 , &inports, 0, 0, &timeout) < 0)
- perror("midi select");
- if (FD_ISSET(mdGetFd(*mp),&inports))
- {
- if (mdReceive(*mp, &mdv, 1) < 0)
- error("failure receiving message\n");
- else if (mdv.msg[0] == MD_SYSEX) mdFree(mdv.sysexmsg);
-
- else
- {
- int status = mdv.msg[0];
- int channel = (status & 0xf) + 1;
- int b1 = mdv.msg[1];
- int b2 = mdv.msg[2];
- switch(status & 0xf0)
- {
- case MD_NOTEOFF:
- inmidi_noteon(i, channel, b1, 0);
- break;
- case MD_NOTEON:
- inmidi_noteon(i, channel, b1, b2);
- break;
- case MD_POLYKEYPRESSURE:
- inmidi_polyaftertouch(i, channel, b1, b2);
- break;
- case MD_CONTROLCHANGE:
- inmidi_controlchange(i, channel, b1, b2);
- break;
- case MD_PITCHBENDCHANGE:
- inmidi_pitchbend(i, channel, ((b2 << 7) + b1));
- break;
- case MD_PROGRAMCHANGE:
- inmidi_programchange(i, channel, b1);
- break;
- case MD_CHANNELPRESSURE:
- inmidi_aftertouch(i, channel, b1);
- break;
- }
- }
- }
- }
-}
-
-void sys_do_open_midi(int nmidiin, int *midiinvec,
- int nmidiout, int *midioutvec)
-{
- sgi_open_midi(nmidiin!=0, nmidiout!=0);
-}
-
-
-void sys_close_midi( void)
-{
- /* ??? */
-}
-
-
-void midi_getdevs(char *indevlist, int *nindevs,
- char *outdevlist, int *noutdevs, int maxndev, int devdescsize)
-{
- int i, nindev = 0, noutdev = 0;
- for (i = 0; i < mdInit(); i++)
- {
- if (nindev < maxndev)
- {
- strcpy(indevlist + nindev * devdescsize, mdGetName(i));
- nindev++;
-
- strcpy(outdevlist + noutdev * devdescsize, mdGetName(i));
- noutdev++;
- }
- }
- *nindevs = nindev;
- *noutdevs = noutdev;
-}
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 07520bcf..14620eac 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -262,7 +262,7 @@ ends up in the same buffer as dirresult. Exception:
if the 'name' starts with a slash or a letter, colon, and slash in MSW,
there is no search and instead we just try to open the file literally. */
-/* see also canvas_openfile() which, in addition, searches down the
+/* see also canvas_open() which, in addition, searches down the
canvas-specific path. */
static int do_open_via_path(const char *dir, const char *name,