This is osplay.c in view mode; [Download] [Up]
#include "../H/ugens.h"
#include "../macros/macros.h"
#include <stdio.h>
double osplay(p,n_args)
float *p;
{
/* p0=start, p1=dur, p2=pitch, p3=amp, p4=risetime, p5=decaytime */
/* assumes function 1 is waveform and function 2 is envelope*/
int i,nsamps,unit;
float val,out[2],q[9],dur,rise,decay,si,*f1,*f2,amp,phase;
int len,risef,j,z,wave;
wave = 1; risef = 2;
unit = 1; /* writing to file 1*/
nsamps = setnote(p[0],p[1],unit);
evset(p[1],p[4],p[5],risef,q);
f1 = floc(wave); /* floc and fsize locate and size makegen */
f2 = floc(risef);
len = fsize(wave);
si = cpspch(p[2]) * fsize(1)/SR;
z = SR/cpspch(p[2]);
j = phase = 0;
amp = p[3];
for(i = 0; i < nsamps; i++) {
if (!j--) {
val = amp * evp(i,f2,f2,q);
j=z;
}
OSCIL(out[0],val,si,f1,len,phase);
ADDOUT(out,unit);
}
endnote(unit);
}
int NBYTES = 32768;
profile()
{
UG_INTRO("osplay",osplay);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.