home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Education Sampler 1992 [NeXTSTEP]
/
Education_1992_Sampler.iso
/
SoundAndMusic
/
cmix
/
lib
/
resontest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-21
|
510b
|
29 lines
#define PI2 6.2831853
#include <math.h>
#define SR 22050
main()
{
float a[10];
rsnset(100.,.1,0.,0.,a);
}
rsnset(cf,bw,scl,xinit,a)
float cf,bw,scl,xinit,*a;
{
double exp(),cos(),sqrt();
float c,temp;
if(!xinit) {
a[4] = 0;
a[3] = 0;
}
a[2] = exp(-PI2 * bw/SR);
temp = 1. - a[2];
c = a[2] + 1;
a[1] = 4. * a[2]/c * cos(PI2 * cf/SR);
printf("%f %f\n",a[2],a[1]);
if(scl < 0) a[0] = 1;
if(scl) a[0] = sqrt(temp/c*(c*c-a[1]*a[1]));
if(!scl) a[0] = temp*sqrt(1.-a[1]*a[1]/(4.*a[2]));
}