This is Allpass.m in view mode; [Download] [Up]
#import "Allpass.h"
@implementation Allpass: Object
{
float rev,sr,*delayLine;
int phs,len;
}
+ create {
id newInstance;
newInstance = [ self new ];
return newInstance;
}
-loopt:(float)loop sRate:(int)aSR revTime:(float)arevtime {
char *malloc();
double pow();
sr = aSR;
len = loop * aSR + .5;
rev = (float)pow(.001,(double)(loop/arevtime));
if((delayLine = (float *)malloc((int)(len * 4))) == 0) {
printf("can't malloc memory for delayline\n");
exit(-1);
}
for(phs = 0; phs< len; phs++) delayLine[phs] = 0;
phs = 0;
}
- gain: (float) again {
rev = again;
}
- (float)bang: (float) sample {
float temp;
if(phs >= len) phs = 0;
temp = delayLine[phs];
delayLine[phs] = delayLine[phs++] * rev + sample;
return (temp - rev * delayLine[phs-1]) ;
}
- freeup {
free(delayLine);
return;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.