This is Oscili.m in view mode; [Download] [Up]
#import "Oscili.h"
@implementation Oscili : Object
{
float phs,si,amp,*floc;
}
+ create {
id newInstance; // local variable declaration
printf("in create\n");
newInstance = [ self new ]; // create new instance
[ newInstance phs : 0 ];
return newInstance; // return the new instance
}
- phs: (float) aPhs{
phs = aPhs;
return self;
}
- si: (float) aSi {
si = aSi;
return self;
}
- amp: (float) aAmp {
amp = aAmp;
return self;
}
- floc: (float *) aFloc {
floc = aFloc ;
return self;
}
- (float) value {
register i = phs;
register k = (i+1) % 512;
float frac = phs - i;
phs += si;
while(phs >= 512)
phs -= 512;
return(*(floc+i) + (*(floc+k) - *(floc+i)) * frac) * amp;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.