History

tWaveset object, fade between multiple wavetables

Matthew Wang committed 5 years ago

Commit be773ed1 parent 65ab3d03 files · +910 −734Browse files

Showing the changes to TestPlugin/Source/MyTest.cpp (1 of 3 files). Show all

Unified · Split

TestPlugin/Source/MyTest.cpp+18−5
@@ -33,6 +33,7 @@ tButterworth bw; · 32 unmodified lines
3333
3434 tWavetable wt;
3535 tCompactWavetable cwt;
36+tWaveset ws;
3637
3738 tBuffer samp;
3839 tMBSampler sampler;
@@ -57,8 +58,8 @@ void LEAFTest_init (float sampleRate, int blockSize) · 18 unmodified lines
5758 {
5859 LEAF_init(&leaf, sampleRate, blockSize, memory, MSIZE, &getRandomFloat);
5960
60− tWavetable_init(&wt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
61− tCompactWavetable_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
61+// tWavetable_init(&wt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
62+// tCompactWavetable_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
6263
6364 tMBTriangle_init(&btri, &leaf);
6465 tMBPulse_init(&bpulse, &leaf);
@@ -69,6 +70,15 @@ void LEAFTest_init (float sampleRate, int blockSize) · 4 unmodified lines
6970
7071 tPhasor_init(&phasor, &leaf);
7172 tPhasor_setFreq(&phasor, 220.f);
73+
74+ float const* set[4];
75+ set[0] = __leaf_table_sinewave;
76+ set[1] = __leaf_table_triangle[0];
77+ set[2] = __leaf_table_squarewave[0];
78+ set[3] = __leaf_table_sawtooth[0];
79+
80+ tWaveset_init(&ws, set, 4, 2048, 10000.f, &leaf);
81+ tWaveset_setIndexGain(&ws, 0, -1.0f);
7282 }
7383
7484 inline double getSawFall(double angle) {
@@ -86,7 +96,8 @@ float LEAFTest_tick (float input) · 11 unmodified lines
8696 // return tSimpleRetune_tick(&sretune, input);
8797 // tMBPulse_sync(&bpulse, tPhasor_tick(&phasor) * 2.f - 1.f);
8898 // return tMBPulse_tick(&bpulse);
89− return tWavetable_tick(&wt);
99+// return tWavetable_tick(&wt);
100+ return tWaveset_tick(&ws);
90101 }
91102
92103 int firstFrame = 1;
@@ -97,12 +108,14 @@ void LEAFTest_block (void) · 4 unmodified lines
97108 tMBTriangle_setFreq(&btri, val * 440.f);
98109 tMBPulse_setFreq(&bpulse, val * 160000.f - 80000.0f);
99110 tMBSaw_setFreq(&bsaw, val * 10000.f);
100− tWavetable_setFreq(&wt, val * 160000.f - 80000.0f);
101− tCompactWavetable_setFreq(&cwt, val * 10000.);
111+// tWavetable_setFreq(&wt, val * 160000.f - 80000.0f);
112+// tCompactWavetable_setFreq(&cwt, val * 10000.);
113+ tWaveset_setFreq(&ws, val * 10000.f);
102114 // tRetune_tuneVoice(&retune, 0, val * 3.0f + 0.5f);
103115 // tSimpleRetune_tuneVoice(&sretune, 0, 300);
104116
105117 val = getSliderValue("slider2");
118+ tWaveset_setIndex(&ws, val);
106119 // tRetune_setPitchFactor(&retune, val * 3.0f + 0.5f, 1);
107120
108121 val = getSliderValue("slider3");

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