leaf-tables.h
1 /*==============================================================================
2 
3  leaf-tables.h
4  Created: 4 Dec 2016 9:42:41pm
5  Author: Michael R Mulshine
6 
7  ==============================================================================*/
8 
9 #ifndef LEAF_TABLES_H_INCLUDED
10 #define LEAF_TABLES_H_INCLUDED
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16  //==============================================================================
17 
18 #include "leaf-math.h"
19 
20  //==============================================================================
21 
27 #define COEFFS_SIZE 32
28  extern const float* __leaf_tableref_firCoeffs[COEFFS_SIZE];
29  extern const float __leaf_tablesize_firNumTaps[COEFFS_SIZE];
30  extern const float __leaf_table_fir2XLow[32];
31  extern const float __leaf_table_fir4XLow[64];
32  extern const float __leaf_table_fir8XLow[64];
33  extern const float __leaf_table_fir16XLow[128];
34  extern const float __leaf_table_fir32XLow[256];
35  extern const float __leaf_table_fir64XLow[256];
36  extern const float __leaf_table_fir2XHigh[128];
37  extern const float __leaf_table_fir4XHigh[256];
38  extern const float __leaf_table_fir8XHigh[256];
39  extern const float __leaf_table_fir16XHigh[512];
40  extern const float __leaf_table_fir32XHigh[512];
41  extern const float __leaf_table_fir64XHigh[1024];
42 
43 // typedef enum TableName
44 // {
45 // T20 = 0,
46 // T40,
47 // T80,
48 // T160,
49 // T320,
50 // T640,
51 // T1280,
52 // T2560,
53 // T5120,
54 // T10240,
55 // T20480,
56 // TableNameNil
57 // } TableName;
58 
59 
60 #define SHAPER1_TABLE_SIZE 65536
61  extern const float __leaf_table_shaper1[SHAPER1_TABLE_SIZE];
62 
63  // mtof lookup table based on input range [0.0,1.0) in 4096 increments - midi frequency values scaled between m25 and m134 (from the Snyderphonics DrumBox code)
64 #define MTOF1_TABLE_SIZE 4096
65  extern const float __leaf_table_mtof1[MTOF1_TABLE_SIZE];
66 
67 #define EXP_DECAY_TABLE_SIZE 65536
68  extern const float __leaf_table_exp_decay[EXP_DECAY_TABLE_SIZE];
69 
70 #define ATTACK_DECAY_INC_TABLE_SIZE 65536
71  extern const float __leaf_table_attack_decay_inc[ATTACK_DECAY_INC_TABLE_SIZE];
72 
73 #define FILTERTAN_TABLE_SIZE 4096
74  extern const float __leaf_table_filtertan[FILTERTAN_TABLE_SIZE];
75 
76 #define TANH1_TABLE_SIZE 65536
77  extern const float __leaf_table_tanh1[TANH1_TABLE_SIZE];
78 
79  //==============================================================================
80 
81  /* Sine wave table ripped from http://aquaticus.info/pwm-sine-wave. */
82 #define SINE_TABLE_SIZE 2048
83  extern const float __leaf_table_sinewave[SINE_TABLE_SIZE];
84 
85 #define TRI_TABLE_SIZE 2048
86  extern const float __leaf_table_triangle[11][TRI_TABLE_SIZE];
87 
88 #define SQR_TABLE_SIZE 2048
89  extern const float __leaf_table_squarewave[11][SQR_TABLE_SIZE];
90 
91 #define SAW_TABLE_SIZE 2048
92  extern const float __leaf_table_sawtooth[11][SAW_TABLE_SIZE];
93 
94  //==============================================================================
95 
96 
97  // From https://github.com/MrBlueXav/Dekrispator_v2 minblep_tables.h
98 
99  /* minBLEP constants */
100  /* minBLEP table oversampling factor (must be a power of two): */
101 #define MINBLEP_PHASES 64
102  /* MINBLEP_PHASES minus one: */
103 #define MINBLEP_PHASE_MASK 63
104  /* length in samples of (truncated) step discontinuity delta: */
105 #define STEP_DD_PULSE_LENGTH 72
106  /* length in samples of (truncated) slope discontinuity delta: */
107 #define SLOPE_DD_PULSE_LENGTH 71
108  /* the longer of the two above: */
109 #define LONGEST_DD_PULSE_LENGTH STEP_DD_PULSE_LENGTH
110  /* delay between start of DD pulse and the discontinuity, in samples: */
111 #define DD_SAMPLE_DELAY 4
112 
113  typedef struct { float value, delta; } float_value_delta;
114 
115  /* in minblep_tables.c: */
116  extern const float_value_delta step_dd_table[];
117  extern const float slope_dd_table[];
118 
121  //==============================================================================
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif // LEAF_TABLES_H_INCLUDED
128 
129 //==============================================================================
130