Analog synthesis engine for Klang Modular
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
544 B

#ifndef __LUTS_H__
#define __LUTS_H__
#include <algorithm>
#include "globals.h"
#include "util.h"
#define SIN_LUT_SIZE 256
#define K_LUT_SIZE 256
extern float sinLUT[SIN_LUT_SIZE];
extern float kLUT[K_LUT_SIZE];
void genLUTs();
inline float fastSin(float t) {
t += randFrac() * (1.f / SIN_LUT_SIZE);
return sinLUT[(size_t) (t * SIN_LUT_SIZE) & (SIN_LUT_SIZE - 1)];
}
inline float fastCVtoK(float cv) {
return kLUT[std::min(K_LUT_SIZE - (size_t) 1, (size_t) (cv * (K_LUT_SIZE - 1) * (1.f / (float) FILTER_CV_MAX)))];
}
#endif