History

removed tWaveOsc and tWaveOscS; removed unneeded arguments from tWaveSynth and tWaveSynthS; renamed tWaveSynth and tWaveSynthS to tWaveOsc and tWaveOscS

Matthew Wang committed 5 years ago

Commit 8329ace1 parent 479c76d5 files · +118 −627Browse files

Unified · Split

5 files
  1. TestPlugin/Source/MyTest.cpp +11 −16
  2. leaf/Inc/leaf-oscillators.h +58 −230
  3. leaf/Inc/leaf-physical.h +1 −1
  4. leaf/Src/leaf-oscillators.c +47 −379
  5. leaf/Src/leaf-physical.c +1 −1
TestPlugin/Source/MyTest.cpp+11−16
@@ -33,12 +33,12 @@ tButterworth bw; · 32 unmodified lines
3333
3434 tWaveTable wt;
3535 tWaveTableS cwt;
36−tWaveSynth ws;
36+tWaveOsc ws;
3737
3838 tBuffer samp;
3939 tMBSampler sampler;
4040
41−const int numWavetables = 1;
41+const int numWavetables = 4;
4242 tWaveTable wavetables[numWavetables];
4343 tSimpleRetune retune;
4444
@@ -80,13 +80,12 @@ void LEAFTest_init (float sampleRate, int blockSize) · 35 unmodified lines
8080 tPhasor_init(&phasor, &leaf);
8181 tPhasor_setFreq(&phasor, 220.f);
8282
83− float* set[4];
84− set[0] = (float*)__leaf_table_sinewave;
85− set[1] = (float*)__leaf_table_triangle[0];
86− set[2] = (float*)__leaf_table_squarewave[0];
87− set[3] = (float*)__leaf_table_sawtooth[0];
83+ tWaveTable_init(&wavetables[0], (float*)__leaf_table_sinewave, 2048, 20000.f, &leaf);
84+ tWaveTable_init(&wavetables[1], (float*)__leaf_table_triangle, 2048, 20000.f, &leaf);
85+ tWaveTable_init(&wavetables[2], (float*)__leaf_table_squarewave, 2048, 20000.f, &leaf);
86+ tWaveTable_init(&wavetables[3], (float*)__leaf_table_sawtooth, 2048, 20000.f, &leaf);
8887
89−// tWaveSynth_init(&ws, set, 2048, 4, 10000.f, &leaf);
88+ tWaveOsc_init(&ws, wavetables, numWavetables, &leaf);
9089
9190 lastLoadedAudioSize = 0;
9291 loadedAudio.clear();
@@ -103,14 +102,10 @@ inline double getSawFall(double angle) { · 10 unmodified lines
103102
104103 float LEAFTest_tick (float input)
105104 {
106− tSimpleRetune_tuneVoice(&retune, 0, mtof(roundf(ftom(tSimpleRetune_getInputFrequency(&retune)))));
107− return tSimpleRetune_tick(&retune, input);
108−
109−
110105 float out = 0.0f;
111− for (int i = 0; i < fmin(loadedAudio.size(), numWavetables); ++i)
106+ for (int i = 0; i < numWavetables; ++i)
112107 {
113−// out += tWaveTable_tick(&wavetables[i]);
108+ out += tWaveOsc_tick(&ws);
114109 }
115110 return out;
116111 }
@@ -125,12 +120,12 @@ void LEAFTest_block (void) · 8 unmodified lines
125120 tMBSaw_setFreq(&bsaw, val * 10000.f);
126121 // tWaveTable_setFreq(&wt, val * 160000.f - 80000.0f);
127122 // tWaveTableS_setFreq(&cwt, val * 10000.);
128− tWaveSynth_setFreq(&ws, val * 10000.f);
123+ tWaveOsc_setFreq(&ws, val * 2000.f);
129124 // tRetune_tuneVoice(&retune, 0, val * 3.0f + 0.5f);
130125 // tSimpleRetune_tuneVoice(&sretune, 0, 300);
131126
132127 val = getSliderValue("slider2");
133− tWaveSynth_setIndex(&ws, val);
128+ tWaveOsc_setIndex(&ws, val);
134129 // tRetune_setPitchFactor(&retune, val * 3.0f + 0.5f, 1);
135130
136131 val = getSliderValue("slider3");
leaf/Inc/leaf-oscillators.h+58−230
@@ -1005,72 +1005,24 @@ extern "C" { · 1004 unmodified lines
10051005 float maxFreq, tMempool* const mempool);
10061006 void tWaveTable_free(tWaveTable* const osc);
10071007 void tWaveTable_setSampleRate (tWaveTable* const osc, float sr);
1008−
1009− //==============================================================================
1010−
1011− /*!
1012− @defgroup twavetableosc tWaveOsc
1013− @ingroup oscillators
1014− @brief Anti-aliased wavetable oscillator.
1015− @{
1016−
1017− @fn float tWaveTable_tick (tWaveTable* const osc)
1018− @brief Tick a tWaveTable oscillator.
1019− @param osc A pointer to the relevant tWaveTable.
1020− @return The ticked sample as a float from -1 to 1.
1021−
1022− @fn void tWaveTable_setFreq (tWaveTable* const osc, float freq)
1023− @brief Set the frequency of a tWaveTable oscillator.
1024− @param osc A pointer to the relevant tWaveTable.
1025− @param freq The frequency to set the oscillator to.
1026−
1027− @} */
1028−
1029− typedef struct _tWaveOsc
1030− {
1031− tMempool mempool;
1032− tWaveTable table;
1033− float inc, freq;
1034− float phase;
1035− float phaseOffset;
1036− float invSampleRate;
1037−
1038− int oct;
1039− float w;
1040− float aa;
1041− } _tWaveOsc;
1042−
1043− typedef _tWaveOsc* tWaveOsc;
1044−
1045− void tWaveOsc_init(tWaveOsc* const osc, tWaveTable* const table, LEAF* const leaf);
1046− void tWaveOsc_initToPool(tWaveOsc* const osc, tWaveTable* const table, tMempool* const mempool);
1047− void tWaveOsc_free(tWaveOsc* const osc);
1048−
1049− float tWaveOsc_tick(tWaveOsc* const osc);
1050− void tWaveOsc_setFreq(tWaveOsc* const osc, float freq);
1051− void tWaveOsc_setAntiAliasing(tWaveOsc* const osc, float aa);
1052− void tWaveOsc_setPhaseOffset(tWaveOsc* const osc, float phase);
1053− void tWaveOsc_setSampleRate (tWaveOsc* const osc, float sr);
10541008
10551009 //==============================================================================
10561010
10571011 /*!
1058− @defgroup twavesynth tWaveSynth
1012+ @defgroup twaveosc tWaveOsc
10591013 @ingroup oscillators
10601014 @brief Set of anti-aliased wavetable oscillators that can be faded between.
10611015 @{
10621016
1063− @fn void tWaveSynth_init(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
1064− @brief Initialize a tWaveSynth to the default mempool of a LEAF instance.
1065− @param osc A pointer to the tWaveSynth to initialize.
1017+ @fn void tWaveOsc_init(tWaveOsc* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
1018+ @brief Initialize a tWaveOsc to the default mempool of a LEAF instance.
1019+ @param osc A pointer to the tWaveOsc to initialize.
10661020 @param tables An array of pointers to wavetable data.
10671021 @param n The number of wavetables.
1068− @param size The number of samples in each of the wavetables.
1069− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
10701022 @param leaf A pointer to the leaf instance.
10711023
1072− @fn void tWaveSynth_initToPool(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
1073− @brief Initialize a tWaveSynth to a specified mempool.
1024+ @fn void tWaveOsc_initToPool(tWaveOsc* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
1025+ @brief Initialize a tWaveOsc to a specified mempool.
10741026 @param osc A pointer to the tWaveTable to initialize.
10751027 @param tables An array of pointers to wavetable data.
10761028 @param n The number of wavetables.
@@ -1078,27 +1030,27 @@ extern "C" { · 1 unmodified line
10781030 @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
10791031 @param mempool A pointer to the tMempool to use.
10801032
1081− @fn void tWaveSynth_free (tWaveSynth* const osc)
1082− @brief Free a tWaveSynth from its mempool.
1083− @param osc A pointer to the tWaveSynth to free.
1033+ @fn void tWaveOsc_free (tWaveOsc* const osc)
1034+ @brief Free a tWaveOsc from its mempool.
1035+ @param osc A pointer to the tWaveOsc to free.
10841036
1085− @fn float tWaveSynth_tick (tWaveSynth* const osc)
1086− @brief Tick a tWaveSynth oscillator.
1087− @param osc A pointer to the relevant tWaveSynth.
1037+ @fn float tWaveOsc_tick (tWaveOsc* const osc)
1038+ @brief Tick a tWaveOsc oscillator.
1039+ @param osc A pointer to the relevant tWaveOsc.
10881040 @return The ticked sample as a float from -1 to 1.
10891041
1090− @fn void tWaveSynth_setFreq (tWaveSynth* const osc, float freq)
1091− @brief Set the frequency of a tWaveSynth oscillator.
1092− @param osc A pointer to the relevant tWaveSynth.
1042+ @fn void tWaveOsc_setFreq (tWaveOsc* const osc, float freq)
1043+ @brief Set the frequency of a tWaveOsc oscillator.
1044+ @param osc A pointer to the relevant tWaveOsc.
10931045 @param freq The frequency to set the oscillator to.
10941046
1095− @fn void tWaveSynth_setIndex(tWaveSynth* const osc, float index)
1047+ @fn void tWaveOsc_setIndex(tWaveOsc* const osc, float index)
10961048 @brief Set the output index of the wavetable set.
10971049 @param index The new index from 0.0 to 1.0 as a smooth fade from the first wavetable in the set to the last.
10981050
10991051 @} */
11001052
1101− typedef struct _tWaveSynth
1053+ typedef struct _tWaveOsc
11021054 {
11031055 tMempool mempool;
11041056 tWaveTable* tables;
@@ -1123,24 +1075,20 @@ extern "C" { · 18 unmodified lines
11231075 float aa;
11241076 int numSubTables;
11251077
1126− } _tWaveSynth;
1078+ } _tWaveOsc;
11271079
1128− typedef _tWaveSynth* tWaveSynth;
1080+ typedef _tWaveOsc* tWaveOsc;
11291081
1130− void tWaveSynth_init(tWaveSynth* const cy, tWaveTable* tables, int size,
1131− int numTables, float maxFreq, LEAF* const leaf);
1132−
1133− void tWaveSynth_initToPool(tWaveSynth* const cy, tWaveTable* tables, int size,
1134− int numTables, float maxFreq, tMempool* const mp);
1135− void tWaveSynth_free(tWaveSynth* const osc);
1082+ void tWaveOsc_init(tWaveOsc* const cy, tWaveTable* tables, int numTables, LEAF* const leaf);
1083+ void tWaveOsc_initToPool(tWaveOsc* const cy, tWaveTable* tables, int numTables, tMempool* const mp);
1084+ void tWaveOsc_free(tWaveOsc* const osc);
11361085
1137− float tWaveSynth_tick(tWaveSynth* const osc);
1138−
1139− void tWaveSynth_setFreq(tWaveSynth* const cy, float freq);
1140− void tWaveSynth_setAntiAliasing(tWaveSynth* const osc, float aa);
1141− void tWaveSynth_setIndex(tWaveSynth* const osc, float index);
1142− void tWaveSynth_setTables(tWaveSynth* const cy, tWaveTable* tables, int numTables, int size);
1143− void tWaveSynth_setSampleRate (tWaveSynth* const osc, float sr);
1086+ float tWaveOsc_tick(tWaveOsc* const osc);
1087+ void tWaveOsc_setFreq(tWaveOsc* const cy, float freq);
1088+ void tWaveOsc_setAntiAliasing(tWaveOsc* const osc, float aa);
1089+ void tWaveOsc_setIndex(tWaveOsc* const osc, float index);
1090+ void tWaveOsc_setTables(tWaveOsc* const cy, tWaveTable* tables, int numTables);
1091+ void tWaveOsc_setSampleRate (tWaveOsc* const osc, float sr);
11441092
11451093 //==============================================================================
11461094
@@ -1196,168 +1144,51 @@ extern "C" { · 49 unmodified lines
11961144 void tWaveTableS_free(tWaveTableS* const osc);
11971145 void tWaveTableS_setSampleRate (tWaveTableS* const osc, float sr);
11981146
1147+
1148+ //==============================================================================
11991149 /*!
12001150 @defgroup twaveoscs tWaveOscS
12011151 @ingroup oscillators
1202− @brief A more space-efficient anti-aliased wavetable oscillator than tWaveOsc but with slightly worse fidelity.
1152+ @brief Set of anti-aliased wavetable oscillators that can be faded between.
12031153 @{
12041154
1205− @fn void tWaveOscS_init (tWaveOscS* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
1155+ @fn void tWaveOscS_init(tWaveOsc* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
12061156 @brief Initialize a tWaveOscS to the default mempool of a LEAF instance.
12071157 @param osc A pointer to the tWaveOscS to initialize.
1208− @param table A pointer to the wavetable data.
1209− @param size The number of samples in the wavetable.
1210− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
1158+ @param tables An array of pointers to wavetable data.
1159+ @param n The number of wavetables.
12111160 @param leaf A pointer to the leaf instance.
12121161
1213− @fn void tWaveOscS_initToPool (tWaveOscS* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
1162+ @fn void tWaveOscS_initToPool(tWaveOsc* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
12141163 @brief Initialize a tWaveOscS to a specified mempool.
1215− @param osc A pointer to the tWaveOscS to initialize.
1216− @param table A pointer to the wavetable data.
1217− @param size The number of samples in the wave table.
1164+ @param osc A pointer to the tWaveTableS to initialize.
1165+ @param tables An array of pointers to wavetable data.
1166+ @param n The number of wavetables.
1167+ @param size The number of samples in each of the wavetables.
12181168 @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
12191169 @param mempool A pointer to the tMempool to use.
12201170
1221− @fn void tWaveOscS_free (tWaveOscS* const osc)
1171+ @fn void tWaveOscS_free (tWaveOsc* const osc)
12221172 @brief Free a tWaveOscS from its mempool.
12231173 @param osc A pointer to the tWaveOscS to free.
12241174
1225− @fn float tWaveOscS_tick (tWaveOscS* const osc)
1175+ @fn float tWaveOscS_tick (tWaveOsc* const osc)
12261176 @brief Tick a tWaveOscS oscillator.
12271177 @param osc A pointer to the relevant tWaveOscS.
12281178 @return The ticked sample as a float from -1 to 1.
12291179
1230− @fn void tWaveOscS_setFreq (tWaveOscS* const osc, float freq)
1180+ @fn void tWaveOscS_setFreq (tWaveOsc* const osc, float freq)
12311181 @brief Set the frequency of a tWaveOscS oscillator.
12321182 @param osc A pointer to the relevant tWaveOscS.
12331183 @param freq The frequency to set the oscillator to.
12341184
1235− @} */
1236−
1237− typedef struct _tWaveOscS
1238− {
1239− tMempool mempool;
1240− tWaveTableS table;
1241− float inc, freq;
1242− float phase;
1243− float phaseOffset;
1244− float invSampleRate;
1245− int oct;
1246− float w;
1247− float aa;
1248− } _tWaveOscS;
1249−
1250− typedef _tWaveOscS* tWaveOscS;
1251−
1252− void tWaveOscS_init(tWaveOscS* const osc, tWaveTableS* const table, LEAF* const leaf);
1253− void tWaveOscS_initToPool(tWaveOscS* const osc, tWaveTableS* const table, tMempool* const mempool);
1254− void tWaveOscS_free(tWaveOscS* const osc);
1255−
1256− float tWaveOscS_tick(tWaveOscS* const osc);
1257− void tWaveOscS_setFreq(tWaveOscS* const osc, float freq);
1258− void tWaveOscS_setAntiAliasing(tWaveOscS* const osc, float aa);
1259− void tWaveOscS_setPhaseOffset(tWaveOscS* const osc, float phase);
1260− void tWaveOscS_setSampleRate (tWaveOscS* const osc, float sr);
1261−
1262− //==============================================================================
1263− /*!
1264− @defgroup twaveoscs tWaveOscS
1265− @ingroup oscillators
1266− @brief A more space-efficient anti-aliased wavetable oscillator than tWaveOsc but with slightly worse fidelity.
1267− @{
1268−
1269− @fn void tWaveOscS_init (tWaveOscS* const osc, float* table, int size, float maxFreq, LEAF* const leaf)
1270− @brief Initialize a tWaveOscS to the default mempool of a LEAF instance.
1271− @param osc A pointer to the tWaveOscS to initialize.
1272− @param table A pointer to the wavetable data.
1273− @param size The number of samples in the wavetable.
1274− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
1275− @param leaf A pointer to the leaf instance.
1276−
1277− @fn void tWaveOscS_initToPool (tWaveOscS* const osc, float* table, int size, float maxFreq, tMempool* const mempool)
1278− @brief Initialize a tWaveOscS to a specified mempool.
1279− @param osc A pointer to the tWaveOscS to initialize.
1280− @param table A pointer to the wavetable data.
1281− @param size The number of samples in the wave table.
1282− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
1283− @param mempool A pointer to the tMempool to use.
1284−
1285− @fn void tWaveOscS_free (tWaveOscS* const osc)
1286− @brief Free a tWaveOscS from its mempool.
1287− @param osc A pointer to the tWaveOscS to free.
1288−
1289− @fn float tWaveOscS_tick (tWaveOscS* const osc)
1290− @brief Tick a tWaveOscS oscillator.
1291− @param osc A pointer to the relevant tWaveOscS.
1292− @return The ticked sample as a float from -1 to 1.
1293−
1294− @fn void tWaveOscS_setFreq (tWaveOscS* const osc, float freq)
1295− @brief Set the frequency of a tWaveOscS oscillator.
1296− @param osc A pointer to the relevant tWaveOscS.
1297− @param freq The frequency to set the oscillator to.
1298−
1299− @} */
1300−
1301− typedef struct _tWaveSubOscS
1302− {
1303− tMempool mempool;
1304− tWaveTableS table;
1305−
1306− } _tWaveSubOscS;
1307−
1308− typedef _tWaveSubOscS* tWaveSubOscS;
1309−
1310− void tWaveSubOscS_init(tWaveSubOscS* const osc, tWaveTableS* const table, LEAF* const leaf);
1311− void tWaveSubOscS_initToPool(tWaveSubOscS* const osc, tWaveTableS* const table, tMempool* const mempool);
1312− void tWaveSubOscS_free(tWaveSubOscS* const osc);
1313− float tWaveSubOscS_tick(tWaveSubOscS* const cy, float phase, int oct, float w);
1314−
1315− //==============================================================================
1316− /*!
1317− @defgroup twavesynths tWaveSynthS
1318− @ingroup oscillators
1319− @brief Set of anti-aliased wavetable oscillators that can be faded between.
1320− @{
1321−
1322− @fn void tWaveSynthS_init(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, LEAF* const leaf)
1323− @brief Initialize a tWaveSynthS to the default mempool of a LEAF instance.
1324− @param osc A pointer to the tWaveSynthS to initialize.
1325− @param tables An array of pointers to wavetable data.
1326− @param n The number of wavetables.
1327− @param size The number of samples in each of the wavetables.
1328− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
1329− @param leaf A pointer to the leaf instance.
1330−
1331− @fn void tWaveSynthS_initToPool(tWaveSynth* const osc, const float** tables, int n, int size, float maxFreq, tMempool* const mempool)
1332− @brief Initialize a tWaveSynthS to a specified mempool.
1333− @param osc A pointer to the tWaveTableS to initialize.
1334− @param tables An array of pointers to wavetable data.
1335− @param n The number of wavetables.
1336− @param size The number of samples in each of the wavetables.
1337− @param maxFreq The maximum expected frequency of the oscillator. The higher this is, the more memory will be needed.
1338− @param mempool A pointer to the tMempool to use.
1339−
1340− @fn void tWaveSynthS_free (tWaveSynth* const osc)
1341− @brief Free a tWaveSynthS from its mempool.
1342− @param osc A pointer to the tWaveSynthS to free.
1343−
1344− @fn float tWaveSynthS_tick (tWaveSynth* const osc)
1345− @brief Tick a tWaveSynthS oscillator.
1346− @param osc A pointer to the relevant tWaveSynthS.
1347− @return The ticked sample as a float from -1 to 1.
1348−
1349− @fn void tWaveSynthS_setFreq (tWaveSynth* const osc, float freq)
1350− @brief Set the frequency of a tWaveSynthS oscillator.
1351− @param osc A pointer to the relevant tWaveSynthS.
1352− @param freq The frequency to set the oscillator to.
1353−
1354− @fn void tWaveSynthS_setIndex(tWaveSynth* const osc, float index)
1185+ @fn void tWaveOscS_setIndex(tWaveOsc* const osc, float index)
13551186 @brief Set the output index of the wavetable set.
13561187 @param index The new index from 0.0 to 1.0 as a smooth fade from the first wavetable in the set to the last.
13571188
13581189 @} */
13591190
1360− typedef struct _tWaveSynthS
1191+ typedef struct _tWaveOscS
13611192 {
13621193 tMempool mempool;
13631194
@@ -1365,7 +1196,6 @@ extern "C" { · 1 unmodified line
13651196
13661197 tWaveTableS* tables;
13671198
1368− tWaveSubOscS* oscs;
13691199 int numTables;
13701200 float index;
13711201 float maxFreq;
@@ -1387,22 +1217,20 @@ extern "C" { · 15 unmodified lines
13871217 float aa;
13881218 int numSubTables;
13891219
1390− } _tWaveSynthS;
1391−
1392− typedef _tWaveSynthS* tWaveSynthS;
1393−
1394− void tWaveSynthS_init(tWaveSynthS* const cy, tWaveTableS* tables, int size,
1395− int numTables, float maxFreq, LEAF* const leaf);
1396− void tWaveSynthS_initToPool(tWaveSynthS* const osc, tWaveTableS* tables, int size,
1397− int numTables, float maxFreq, tMempool* const mempool);
1398− void tWaveSynthS_free(tWaveSynthS* const osc);
1399−
1400− float tWaveSynthS_tick(tWaveSynthS* const osc);
1401− void tWaveSynthS_setFreq(tWaveSynthS* const osc, float freq);
1402− void tWaveSynthS_setAntiAliasing(tWaveSynthS* const osc, float aa);
1403− void tWaveSynthS_setIndex(tWaveSynthS* const osc, float index);
1404−// void tWaveSynthS_setIndexTable(tWaveSynthS* const osc, int i, float* table, int size);
1405− void tWaveSynthS_setSampleRate (tWaveSynthS* const osc, float sr);
1220+ } _tWaveOscS;
1221+
1222+ typedef _tWaveOscS* tWaveOscS;
1223+
1224+ void tWaveOscS_init(tWaveOscS* const cy, tWaveTableS* tables, int numTables, LEAF* const leaf);
1225+ void tWaveOscS_initToPool(tWaveOscS* const osc, tWaveTableS* tables, int numTables, tMempool* const mempool);
1226+ void tWaveOscS_free(tWaveOscS* const osc);
1227+
1228+ float tWaveOscS_tick(tWaveOscS* const osc);
1229+ void tWaveOscS_setFreq(tWaveOscS* const osc, float freq);
1230+ void tWaveOscS_setAntiAliasing(tWaveOscS* const osc, float aa);
1231+ void tWaveOscS_setIndex(tWaveOscS* const osc, float index);
1232+// void tWaveOscS_setIndexTable(tWaveOscS* const osc, int i, float* table, int size);
1233+ void tWaveOscS_setSampleRate (tWaveOscS* const osc, float sr);
14061234
14071235 #ifdef __cplusplus
14081236 }
leaf/Inc/leaf-physical.h+1−1
@@ -604,7 +604,7 @@ extern "C" { · 603 unmodified lines
604604 float tLivingString2_tick (tLivingString2* const, float input);
605605 float tLivingString2_tickEfficient (tLivingString2* const, float input);
606606
607− float tLivingString2_udpateDelays(tLivingString2* const pl); //necessary if using tickEfficient (so that parameter setting can be put in a slower process). included in standard tick.
607+ void tLivingString2_updateDelays(tLivingString2* const pl); //necessary if using tickEfficient (so that parameter setting can be put in a slower process). included in standard tick.
608608 float tLivingString2_sample (tLivingString2* const);
609609 void tLivingString2_setFreq (tLivingString2* const, float freq);
610610 void tLivingString2_setWaveLength (tLivingString2* const, float waveLength); // in samples
leaf/Src/leaf-oscillators.c+47−379
@@ -1925,137 +1925,18 @@ void tWaveTable_setSampleRate(tWaveTable* const cy, float sr) · 1924 unmodified lines
19251925 tButterworth_free(&c->bl);
19261926 }
19271927
1928−//=======================================================================================
1929−//=======================================================================================
1930−
1931−void tWaveOsc_init(tWaveOsc* const cy, tWaveTable* const table, LEAF* const leaf)
1932−{
1933− tWaveOsc_initToPool(cy, table, &leaf->mempool);
1934−}
1935−
1936−void tWaveOsc_initToPool(tWaveOsc* const cy, tWaveTable* const table, tMempool* const mp)
1937−{
1938− _tMempool* m = *mp;
1939− _tWaveOsc* c = *cy = (_tWaveOsc*) mpool_alloc(sizeof(_tWaveOsc), m);
1940− c->mempool = m;
1941− LEAF* leaf = c->mempool->leaf;
1942−
1943− c->table = *table;
1944−
1945− c->inc = 0.0f;
1946− c->phase = 0.0f;
1947− c->phaseOffset = 0.0f;
1948− c->aa = 0.5f;
1949−
1950− c->invSampleRate = leaf->invSampleRate;
1951−
1952− tWaveOsc_setFreq(cy, 220);
1953−}
1954−
1955−void tWaveOsc_free(tWaveOsc* const cy)
1956−{
1957− _tWaveOsc* c = *cy;
1958− mpool_free((char*)c, c->mempool);
1959−}
1960−
1961−float tWaveOsc_tick(tWaveOsc* const cy)
1962−{
1963− _tWaveOsc* c = *cy;
1964−
1965− float temp;
1966− int idx;
1967− float frac;
1968− float samp0;
1969− float samp1;
1970−
1971− int size = c->table->size;
1972− int sizeMask = c->table->sizeMask;
1973− float** tables = c->table->tables;
1974−
1975− // Phasor increment
1976− c->phase += c->inc;
1977− if (c->phase + c->phaseOffset >= 1.0f) c->phase -= 1.0f;
1978− if (c->phase + c->phaseOffset < 0.0f) c->phase += 1.0f;
1979−
1980− // Wavetable synthesis
1981− temp = size * (c->phase + c->phaseOffset);
1982−
1983− idx = (int)temp;
1984− frac = temp - (float)idx;
1985− samp0 = tables[c->oct][idx];
1986− idx = (idx + 1) & sizeMask;
1987− if (++idx >= size) idx = 0;
1988− samp1 = tables[c->oct][idx];
1989−
1990− float oct0 = (samp0 + (samp1 - samp0) * frac);
1991−
1992− idx = (int)temp;
1993− samp0 = tables[c->oct+1][idx];
1994− idx = (idx + 1) & sizeMask;
1995− samp1 = tables[c->oct+1][idx];
1996−
1997− float oct1 = (samp0 + (samp1 - samp0) * frac);
1998−
1999− return oct0 + (oct1 - oct0) * c->w;
2000−}
2001−
2002−void tWaveOsc_setFreq(tWaveOsc* const cy, float freq)
2003−{
2004− _tWaveOsc* c = *cy;
2005−
2006− c->freq = freq;
2007−
2008− c->inc = c->freq * c->invSampleRate;
2009− c->inc -= (int)c->inc;
2010−
2011− // abs for negative frequencies
2012− c->w = fabsf(c->freq * c->table->invBaseFreq);
2013−
2014− // Probably ok to use a log2 approx here; won't effect tuning at all, just crossfading between octave tables
2015− c->w = log2f_approx(c->w) + c->aa; // adding an offset here will shift our table selection upward, reducing aliasing but lower high freq fidelity. +1.0f should remove all aliasing
2016− if (c->w < 0.0f) c->w = 0.0f; // If c->w is < 0.0f, then freq is less than our base freq
2017− c->oct = (int)c->w;
2018− c->w -= c->oct;
2019−
2020− // When out of range of our tables, this will prevent a crash.
2021− // Also causes a blip but fine since we're above maxFreq at this point.
2022− if (c->oct >= c->table->numTables - 1) c->oct = c->table->numTables - 2;
2023−}
2024−
2025−void tWaveOsc_setAntiAliasing(tWaveOsc* const cy, float aa)
2026−{
2027− _tWaveOsc* c = *cy;
2028− c->aa = aa;
2029− tWaveOsc_setFreq(cy, c->freq);
2030−}
2031−
2032−void tWaveOsc_setPhaseOffset(tWaveOsc* const cy, float phase)
2033−{
2034− _tWaveOsc* c = *cy;
2035− c->phaseOffset = phase - (int)phase;
2036−}
2037−
2038−void tWaveOsc_setSampleRate(tWaveOsc* const cy, float sr)
2039−{
2040− _tWaveOsc* c = *cy;
2041− c->invSampleRate = 1.0f/sr;
2042− tWaveOsc_setFreq(cy, c->freq);
2043−}
2044−
20451928 //================================================================================================
20461929 //================================================================================================
20471930
2048−void tWaveSynth_init(tWaveSynth* const cy, tWaveTable* tables, int size,
2049− int numTables, float maxFreq, LEAF* const leaf)
1931+void tWaveOsc_init(tWaveOsc* const cy, tWaveTable* tables, int numTables, LEAF* const leaf)
20501932 {
2051− tWaveSynth_initToPool(cy, tables, size, numTables, maxFreq, &leaf->mempool);
1933+ tWaveOsc_initToPool(cy, tables, numTables, &leaf->mempool);
20521934 }
20531935
2054−void tWaveSynth_initToPool(tWaveSynth* const cy, tWaveTable* tables, int size,
2055− int numTables, float maxFreq, tMempool* const mp)
1936+void tWaveOsc_initToPool(tWaveOsc* const cy, tWaveTable* tables, int numTables, tMempool* const mp)
20561937 {
20571938 _tMempool* m = *mp;
2058− _tWaveSynth* c = *cy = (_tWaveSynth*) mpool_alloc(sizeof(_tWaveSynth), m);
1939+ _tWaveOsc* c = *cy = (_tWaveOsc*) mpool_alloc(sizeof(_tWaveOsc), m);
20591940
20601941 c->mempool = m;
20611942
@@ -2070,29 +1951,28 @@ void tWaveSynth_initToPool(tWaveSynth* const cy, tWaveTable* tables, int size, · 8 unmodified lines
20701951 c->phase = 0;
20711952 c->inc = 0;
20721953 c->oct = 0;
2073− c->size = size;
1954+ c->size = c->tables[0]->size;
20741955 c->w = 0.0f;
20751956 c->aa = 0.5f;
20761957 c->sampleRate = leaf->sampleRate;
20771958 // Determine base frequency
2078− c->baseFreq = c->sampleRate / (float) size;
1959+ c->baseFreq = c->sampleRate / (float) c->size;
20791960 c->invBaseFreq = 1.0f / c->baseFreq;
20801961 c->numSubTables = c->tables[0]->numTables;
20811962
20821963 c->invSampleRateTimesTwoTo32 = leaf->invSampleRate * TWO_TO_32;
2083− c->maxFreq = maxFreq;
1964+ c->maxFreq = c->tables[0]->maxFreq;
20841965 }
20851966
2086−void tWaveSynth_free(tWaveSynth* const cy)
1967+void tWaveOsc_free(tWaveOsc* const cy)
20871968 {
2088− _tWaveSynth* c = *cy;
1969+ _tWaveOsc* c = *cy;
20891970 mpool_free((char*)c, c->mempool);
20901971 }
20911972
2092−
2093−float tWaveSynth_tick(tWaveSynth* const cy)
1973+float tWaveOsc_tick(tWaveOsc* const cy)
20941974 {
2095− _tWaveSynth* c = *cy;
1975+ _tWaveOsc* c = *cy;
20961976
20971977 // Phasor increment (unsigned 32bit int wraps automatically with overflow so no need for if branch checks, as you need with float)
20981978 c->phase += c->inc;
@@ -2159,9 +2039,9 @@ float tWaveSynth_tick(tWaveSynth* const cy) · 60 unmodified lines
21592039 return s1 + (s2 - s1) * c->mix;
21602040 }
21612041
2162−void tWaveSynth_setFreq(tWaveSynth* const cy, float freq)
2042+void tWaveOsc_setFreq(tWaveOsc* const cy, float freq)
21632043 {
2164− _tWaveSynth* c = *cy;
2044+ _tWaveOsc* c = *cy;
21652045
21662046 c->freq = freq;
21672047
@@ -2179,15 +2059,15 @@ void tWaveSynth_setFreq(tWaveSynth* const cy, float freq) · 11 unmodified lines
21792059 if (c->oct >= c->numSubTables - 1) c->oct = c->numSubTables - 2;
21802060 }
21812061
2182−void tWaveSynth_setAntiAliasing(tWaveSynth* const cy, float aa)
2062+void tWaveOsc_setAntiAliasing(tWaveOsc* const cy, float aa)
21832063 {
2184− _tWaveSynth* c = *cy;
2064+ _tWaveOsc* c = *cy;
21852065 c->aa = aa;
21862066 }
21872067
2188−void tWaveSynth_setIndex(tWaveSynth* const cy, float index)
2068+void tWaveOsc_setIndex(tWaveOsc* const cy, float index)
21892069 {
2190− _tWaveSynth* c = *cy;
2070+ _tWaveOsc* c = *cy;
21912071 c->index = index;
21922072 float f = c->index * (c->numTables - 1);
21932073
@@ -2197,26 +2077,26 @@ void tWaveSynth_setIndex(tWaveSynth* const cy, float index) · 3 unmodified lines
21972077 c->mix = f - c->o1;
21982078 }
21992079
2200−void tWaveSynth_setTables(tWaveSynth* const cy, tWaveTable* tables, int numTables, int size)
2080+void tWaveOsc_setTables(tWaveOsc* const cy, tWaveTable* tables, int numTables)
22012081 {
2202− _tWaveSynth* c = *cy;
2082+ _tWaveOsc* c = *cy;
22032083 LEAF* leaf = c->mempool->leaf;
22042084 c->tables = tables;
22052085 c->numTables = numTables;
2206− c->size = size;
2086+ c->size = c->tables[0]->size;
22072087
22082088 c->sampleRate = leaf->sampleRate;
22092089 // Determine base frequency
2210− c->baseFreq = c->sampleRate / (float) size;
2090+ c->baseFreq = c->sampleRate / (float) c->size;
22112091 c->invBaseFreq = 1.0f / c->baseFreq;
22122092 c->numSubTables = c->tables[0]->numTables;
22132093
22142094 }
22152095
22162096 /*//// eventually gotta finish this so you can X/Y control the indices and fade between non-adjacent tables
2217−void tWaveSynthS_setIndexXY(tWaveSynthS* const cy, float indexX, float indexY)
2097+void tWaveOscS_setIndexXY(tWaveOscS* const cy, float indexX, float indexY)
22182098 {
2219− _tWaveSynthS* c = *cy;
2099+ _tWaveOscS* c = *cy;
22202100 c->index = index;
22212101 float f1 = c->index * (c->numTables - 1);
22222102
@@ -2229,9 +2109,9 @@ void tWaveSynthS_setIndexXY(tWaveSynthS* const cy, float indexX, float indexY) · 6 unmodified lines
22292109 }
22302110 */
22312111
2232−void tWaveSynth_setSampleRate(tWaveSynth* const cy, float sr)
2112+void tWaveOsc_setSampleRate(tWaveOsc* const cy, float sr)
22332113 {
2234− _tWaveSynth* c = *cy;
2114+ _tWaveOsc* c = *cy;
22352115 //TODO: need to fix this -JS
22362116 for (int i = 0; i < c->numTables; ++i)
22372117 {
@@ -2407,198 +2287,15 @@ void tWaveTableS_setSampleRate(tWaveTableS* const cy, float sr) · 169 unmodified lines
24072287 //================================================================================================
24082288 //================================================================================================
24092289
2410−void tWaveOscS_init(tWaveOscS* const cy, tWaveTableS* const table, LEAF* const leaf)
2290+void tWaveOscS_init(tWaveOscS* const cy, tWaveTableS* tables, int numTables, LEAF* const leaf)
24112291 {
2412− tWaveOscS_initToPool(cy, table, &leaf->mempool);
2292+ tWaveOscS_initToPool(cy, tables, numTables, &leaf->mempool);
24132293 }
24142294
2415−void tWaveOscS_initToPool(tWaveOscS* const cy, tWaveTableS* const table, tMempool* const mp)
2295+void tWaveOscS_initToPool(tWaveOscS* const cy, tWaveTableS* tables, int numTables, tMempool* const mp)
24162296 {
24172297 _tMempool* m = *mp;
24182298 _tWaveOscS* c = *cy = (_tWaveOscS*) mpool_alloc(sizeof(_tWaveOscS), m);
2419− c->mempool = m;
2420− LEAF* leaf = c->mempool->leaf;
2421−
2422− c->table = *table;
2423−
2424− c->invSampleRate = leaf->invSampleRate;
2425− c->inc = 0.0f;
2426− c->phase = 0.0f;
2427− c->phaseOffset = 0.0f;
2428− c->aa = 0.5f;
2429−
2430− tWaveOscS_setFreq(cy, 220);
2431−}
2432−
2433−void tWaveOscS_free(tWaveOscS* const cy)
2434−{
2435− _tWaveOscS* c = *cy;
2436− mpool_free((char*)c, c->mempool);
2437−}
2438−
2439−float tWaveOscS_tick(tWaveOscS* const cy)
2440−{
2441− _tWaveOscS* c = *cy;
2442−
2443− float temp;
2444− int idx;
2445− float frac;
2446− float samp0;
2447− float samp1;
2448−
2449− // Phasor increment
2450− c->phase += c->inc;
2451− if (c->phase >= 1.0f) c->phase -= 1.0f;
2452− if (c->phase < 0.0f) c->phase += 1.0f;
2453−
2454− int* sizes = c->table->sizes;
2455− int* sizeMasks = c->table->sizeMasks;
2456− float** tables = c->table->tables;
2457−
2458− // Wavetable synthesis
2459− temp = sizes[c->oct] * (c->phase + c->phaseOffset);
2460− idx = (int)temp;
2461− frac = temp - (float)idx;
2462− samp0 = tables[c->oct][idx];
2463− idx = (idx + 1) & sizeMasks[c->oct];
2464− samp1 = tables[c->oct][idx];
2465−
2466− float oct0 = (samp0 + (samp1 - samp0) * frac);
2467−
2468− temp = sizes[c->oct+1] * (c->phase + c->phaseOffset);
2469− idx = (int)temp;
2470− frac = temp - (float)idx;
2471− samp0 = tables[c->oct+1][idx];
2472− idx = (idx + 1) & sizeMasks[c->oct + 1];
2473− samp1 = tables[c->oct+1][idx];
2474−
2475− float oct1 = (samp0 + (samp1 - samp0) * frac);
2476−
2477− return oct0 + (oct1 - oct0) * c->w;
2478−}
2479−
2480−void tWaveOscS_setFreq(tWaveOscS* const cy, float freq)
2481−{
2482− _tWaveOscS* c = *cy;
2483−
2484− c->freq = freq;
2485−
2486− c->inc = c->freq * c->invSampleRate;
2487− c->inc -= (int)c->inc;
2488−
2489− // abs for negative frequencies
2490− c->w = fabsf(c->freq * c->table->invBaseFreq);
2491−
2492− // Probably ok to use a log2 approx here; won't effect tuning at all, just crossfading between octave tables
2493− // I bet we could turn this into a lookup and save a lot of processing
2494− c->w = log2f_approx(c->w) + c->aa;//+ LEAF_SQRT2 - 1.0f; adding an offset here will shift our table selection upward, reducing aliasing but lower high freq fidelity. +1.0f should remove all aliasing
2495− if (c->w < 0.0f) c->w = 0.0f; // If c->w is < 0.0f, then freq is less than our base freq
2496− c->oct = (int)c->w;
2497− c->w -= c->oct;
2498− if (c->oct >= c->table->numTables - 1) c->oct = c->table->numTables - 2;
2499−}
2500−
2501−void tWaveOscS_setAntiAliasing(tWaveOscS* const cy, float aa)
2502−{
2503− _tWaveOscS* c = *cy;
2504− c->aa = aa;
2505− tWaveOscS_setFreq(cy, c->freq);
2506−}
2507−
2508−void tWaveOscS_setPhaseOffset(tWaveOscS* const cy, float phase)
2509−{
2510− _tWaveOscS* c = *cy;
2511− c->phaseOffset = phase - (int)phase;
2512−}
2513−
2514−void tWaveOscS_setSampleRate(tWaveOscS* const cy, float sr)
2515−{
2516− _tWaveOscS* c = *cy;
2517− c->invSampleRate = 1.0f/sr;
2518− tWaveOscS_setFreq(cy, c->freq);
2519−}
2520−
2521−//================================================================================================
2522−//================================================================================================
2523−
2524−
2525−
2526−
2527−
2528−void tWaveSubOscS_init(tWaveSubOscS* const cy, tWaveTableS* const table, LEAF* const leaf)
2529−{
2530− tWaveSubOscS_initToPool(cy, table, &leaf->mempool);
2531−}
2532−
2533−void tWaveSubOscS_initToPool(tWaveSubOscS* const cy, tWaveTableS* const table, tMempool* const mp)
2534−{
2535− _tMempool* m = *mp;
2536− _tWaveSubOscS* c = *cy = (_tWaveSubOscS*) mpool_alloc(sizeof(_tWaveSubOscS), m);
2537− c->mempool = m;
2538−
2539− c->table = *table;
2540−}
2541−
2542−void tWaveSubOscS_free(tWaveSubOscS* const cy)
2543−{
2544− _tWaveSubOscS* c = *cy;
2545− mpool_free((char*)c, c->mempool);
2546−}
2547−
2548−float tWaveSubOscS_tick(tWaveSubOscS* const cy, float phase, int oct, float w)
2549−{
2550− _tWaveSubOscS* c = *cy;
2551−
2552− float temp;
2553− int idx;
2554− float frac;
2555− float samp0;
2556− float samp1;
2557−
2558− int* sizes = c->table->sizes;
2559− int* sizeMasks = c->table->sizeMasks;
2560− float** tables = c->table->tables;
2561−
2562− // Wavetable synthesis
2563− temp = sizes[oct] * phase;
2564− idx = (int)temp;
2565− frac = temp - (float)idx;
2566− samp0 = tables[oct][idx];
2567− idx = (idx + 1) & sizeMasks[oct];
2568− samp1 = tables[oct][idx];
2569−
2570− float oct0 = (samp0 + (samp1 - samp0) * frac);
2571−
2572− temp = sizes[oct+1] * phase;
2573− idx = (int)temp;
2574− frac = temp - (float)idx;
2575− samp0 = tables[oct+1][idx];
2576− idx = (idx + 1) & sizeMasks[oct+1];
2577− samp1 = tables[oct+1][idx];
2578−
2579− float oct1 = (samp0 + (samp1 - samp0) * frac);
2580−
2581− return oct0 + (oct1 - oct0) * w;
2582−}
2583−
2584−
2585−
2586−
2587−
2588−//================================================================================================
2589−//================================================================================================
2590−
2591−void tWaveSynthS_init(tWaveSynthS* const cy, tWaveTableS* tables, int size,
2592− int numTables, float maxFreq, LEAF* const leaf)
2593−{
2594− tWaveSynthS_initToPool(cy, tables, size, numTables, maxFreq, &leaf->mempool);
2595−}
2596−
2597−void tWaveSynthS_initToPool(tWaveSynthS* const cy, tWaveTableS* tables, int size,
2598− int numTables, float maxFreq, tMempool* const mp)
2599−{
2600− _tMempool* m = *mp;
2601− _tWaveSynthS* c = *cy = (_tWaveSynthS*) mpool_alloc(sizeof(_tWaveSynthS), m);
26022299
26032300 c->mempool = m;
26042301
@@ -2606,16 +2303,6 @@ void tWaveSynthS_initToPool(tWaveSynthS* const cy, tWaveTableS* tables, int size · 1 unmodified line
26062303 c->tables = tables;
26072304 c->numTables = numTables;
26082305
2609− //c->oscs = (tWaveSubOscS*) mpool_alloc(sizeof(tWaveSubOscS*) * c->numTables, m);
2610−
2611−// int i = 0;
2612− //for (int t = 0; t < numTables; ++t)
2613− //{
2614− //tWaveTableS_initToPool(&c->tables[i], table + (size*t), size, maxFreq, mp); //is the sizeoffloat necessary? is the pointer location in bytes or 32-bit words?
2615− //tWaveSubOscS_initToPool(&c->oscs[i], tables[i], mp);
2616− //i++;
2617− //}
2618−
26192306 c->index = 0.0f;
26202307 c->o1 = 0;
26212308 c->o2 = 1;
@@ -2623,46 +2310,36 @@ void tWaveSynthS_initToPool(tWaveSynthS* const cy, tWaveTableS* tables, int size · 1 unmodified line
26232310 c->phase = 0;
26242311 c->inc = 0;
26252312 c->oct = 0;
2626− c->size = size;
2313+ c->size = c->tables[0]->sizes[0];
26272314 c->w = 0.0f;
26282315 c->aa = 0.5f;
26292316 c->sampleRate = leaf->sampleRate;
26302317 // Determine base frequency
2631− c->baseFreq = c->sampleRate / (float) size;
2318+ c->baseFreq = c->sampleRate / (float) c->size;
26322319 c->invBaseFreq = 1.0f / c->baseFreq;
26332320 c->numSubTables = c->tables[0]->numTables;
26342321
26352322 c->invSampleRateTimesTwoTo32 = leaf->invSampleRate * TWO_TO_32;
2636− c->maxFreq = maxFreq;
2323+ c->maxFreq = c->tables[0]->maxFreq;
26372324 }
26382325
2639−void tWaveSynthS_free(tWaveSynthS* const cy)
2326+void tWaveOscS_free(tWaveOscS* const cy)
26402327 {
2641− _tWaveSynthS* c = *cy;
2328+ _tWaveOscS* c = *cy;
26422329
2643− for (int i = 0; i < c->numTables; ++i)
2644− {
2645− //tWaveSubOscS_free(&c->oscs[i]);
2646− //mpool_free((char*)c->oscs[i], c->mempool);
2647− }
2648− //mpool_free((char*)c->oscs, c->mempool);
26492330 mpool_free((char*)c, c->mempool);
26502331 }
26512332
26522333 volatile int errorCounter = 0;
2653−float tWaveSynthS_tick(tWaveSynthS* const cy)
2334+float tWaveOscS_tick(tWaveOscS* const cy)
26542335 {
2655− _tWaveSynthS* c = *cy;
2336+ _tWaveOscS* c = *cy;
26562337
26572338 // Phasor increment (unsigned 32bit int wraps automatically with overflow so no need for if branch checks, as you need with float)
26582339 c->phase += c->inc;
26592340 float floatPhase = (double)c->phase * 2.32830643654e-10;
26602341 float s1 = 0.f, s2 = 0.f;
26612342
2662− //s1 = tWaveSubOscS_tick(&c->oscs[c->o1], floatPhase, c->oct, c->w);
2663− //s2 = tWaveSubOscS_tick(&c->oscs[c->o2], floatPhase, c->oct, c->w);
2664−
2665−
26662343 float temp;
26672344 int idx;
26682345 float frac;
@@ -2671,7 +2348,6 @@ float tWaveSynthS_tick(tWaveSynthS* const cy) · 2 unmodified lines
26712348
26722349 int oct = c->oct;
26732350
2674−
26752351 int* sizeMasks = c->tables[c->o1]->sizeMasks;
26762352 float** tables = c->tables[c->o1]->tables;
26772353
@@ -2685,8 +2361,6 @@ float tWaveSynthS_tick(tWaveSynthS* const cy) · 7 unmodified lines
26852361
26862362 float oct0 = (samp0 + (samp1 - samp0) * frac);
26872363
2688−
2689−
26902364 temp = sizeMasks[oct+1] * floatPhase;
26912365 idx = (int)temp;
26922366 frac = temp - (float)idx;
@@ -2698,7 +2372,6 @@ float tWaveSynthS_tick(tWaveSynthS* const cy) · 5 unmodified lines
26982372
26992373 s1 = oct0 + (oct1 - oct0) * c->w;
27002374
2701−
27022375 sizeMasks = c->tables[c->o2]->sizeMasks;
27032376 tables = c->tables[c->o2]->tables;
27042377
@@ -2727,9 +2400,9 @@ float tWaveSynthS_tick(tWaveSynthS* const cy) · 22 unmodified lines
27272400 return s1 + (s2 - s1) * c->mix;
27282401 }
27292402
2730−void tWaveSynthS_setFreq(tWaveSynthS* const cy, float freq)
2403+void tWaveOscS_setFreq(tWaveOscS* const cy, float freq)
27312404 {
2732− _tWaveSynthS* c = *cy;
2405+ _tWaveOscS* c = *cy;
27332406
27342407 c->freq = freq;
27352408
@@ -2747,15 +2420,15 @@ void tWaveSynthS_setFreq(tWaveSynthS* const cy, float freq) · 11 unmodified lines
27472420 if (c->oct >= c->numSubTables - 1) c->oct = c->numSubTables - 2;
27482421 }
27492422
2750−void tWaveSynthS_setAntiAliasing(tWaveSynthS* const cy, float aa)
2423+void tWaveOscS_setAntiAliasing(tWaveOscS* const cy, float aa)
27512424 {
2752− _tWaveSynthS* c = *cy;
2425+ _tWaveOscS* c = *cy;
27532426 c->aa = aa;
27542427 }
27552428
2756−void tWaveSynthS_setIndex(tWaveSynthS* const cy, float index)
2429+void tWaveOscS_setIndex(tWaveOscS* const cy, float index)
27572430 {
2758− _tWaveSynthS* c = *cy;
2431+ _tWaveOscS* c = *cy;
27592432 c->index = index;
27602433 float f = c->index * (c->numTables - 1);
27612434
@@ -2766,9 +2439,9 @@ void tWaveSynthS_setIndex(tWaveSynthS* const cy, float index) · 4 unmodified lines
27662439 }
27672440
27682441 /*//// eventually gotta finish this so you can X/Y control the indices and fade between non-adjacent tables
2769−void tWaveSynthS_setIndexXY(tWaveSynthS* const cy, float indexX, float indexY)
2442+void tWaveOscS_setIndexXY(tWaveOscS* const cy, float indexX, float indexY)
27702443 {
2771− _tWaveSynthS* c = *cy;
2444+ _tWaveOscS* c = *cy;
27722445 c->index = index;
27732446 float f1 = c->index * (c->numTables - 1);
27742447
@@ -2781,25 +2454,20 @@ void tWaveSynthS_setIndexXY(tWaveSynthS* const cy, float indexX, float indexY) · 6 unmodified lines
27812454 }
27822455 */
27832456
2784−void tWaveSynthS_setSampleRate(tWaveSynthS* const cy, float sr)
2457+void tWaveOscS_setSampleRate(tWaveOscS* const cy, float sr)
27852458 {
2786− _tWaveSynthS* c = *cy;
2459+ _tWaveOscS* c = *cy;
27872460 //TODO: need to fix this -JS
27882461 for (int i = 0; i < c->numTables; ++i)
27892462 {
27902463 tWaveTableS_setSampleRate(&c->tables[i], sr);
2791− //tWaveSubOscS_setSampleRate(&c->oscs[i], sr);
27922464 }
27932465 }
27942466 //
2795−//void tWaveSynthS_setIndexTable(tWaveSynthS* const cy, int i, float* table, int size)
2467+//void tWaveOscS_setIndexTable(tWaveOscS* const cy, int i, float* table, int size)
27962468 //{
2797−// _tWaveSynthS* c = *cy;
2469+// _tWaveOscS* c = *cy;
27982470 // if (i >= c->numTables) return;
27992471 // tWaveTableS_free(&c->tables[i]);
28002472 // tWaveTableS_initToPool(&c->tables[i], table, size, c->maxFreq, &c->mempool);
2801−// for (int v = 0; v < c->numVoices; ++v)
2802−// {
2803−// tWaveOscS_setFreq(&c->oscs[i][v], c->oscs[i][v]->freq);
2804−// }
28052473 //}
leaf/Src/leaf-physical.c+1−1
@@ -1233,7 +1233,7 @@ float tLivingString2_tickEfficient(tLivingString2* const pl, float input) · 1232 unmodified lines
12331233 }
12341234
12351235
1236−float tLivingString2_udpateDelays(tLivingString2* const pl)
1236+void tLivingString2_updateDelays(tLivingString2* const pl)
12371237 {
12381238 _tLivingString2* p = *pl;
12391239

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t