// included from SCSP.c, do not compile //LFOs #include #include #define LFO_SHIFT 8 struct _LFO { unsigned short phase; DWORD phase_step; int *table; int *scale; }; #define LFIX(v) ((unsigned int) ((float) (1<phase+=LFO->phase_step; #if LFO_SHIFT!=8 LFO->phase&=(1<<(LFO_SHIFT+8))-1; #endif p=LFO->table[LFO->phase>>LFO_SHIFT]; p=LFO->scale[p+128]; return p<<(SHIFT-LFO_SHIFT); } signed int inline ALFO_Step(_LFO *LFO) { int p; LFO->phase+=LFO->phase_step; #if LFO_SHIFT!=8 LFO->phase&=(1<<(LFO_SHIFT+8))-1; #endif p=LFO->table[LFO->phase>>LFO_SHIFT]; p=LFO->scale[p]; return p<<(SHIFT-LFO_SHIFT); } void LFO_ComputeStep(_LFO *LFO,DWORD LFOF,DWORD LFOWS,DWORD LFOS,int ALFO) { float step=(float) LFOFreq[LFOF]*256.0f/(float) srate; LFO->phase_step=(unsigned int) ((float) (1<table=ALFO_SAW; break; case 1: LFO->table=ALFO_SQR; break; case 2: LFO->table=ALFO_TRI; break; case 3: LFO->table=ALFO_NOI; break; } LFO->scale=ASCALES[LFOS]; } else { switch(LFOWS) { case 0: LFO->table=PLFO_SAW; break; case 1: LFO->table=PLFO_SQR; break; case 2: LFO->table=PLFO_TRI; break; case 3: LFO->table=PLFO_NOI; break; } LFO->scale=PSCALES[LFOS]; } }