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
33 33
34tWavetable wt;34tWavetable wt;
35tCompactWavetable cwt;35tCompactWavetable cwt;
36tWaveset ws;
36 37
37tBuffer samp;38tBuffer samp;
38tMBSampler sampler;39tMBSampler sampler;
@@ -57,8 +58,8 @@ void LEAFTest_init (float sampleRate, int blockSize) · 18 unmodified lines
57{58{
58 LEAF_init(&leaf, sampleRate, blockSize, memory, MSIZE, &getRandomFloat);59 LEAF_init(&leaf, sampleRate, blockSize, memory, MSIZE, &getRandomFloat);
59 60
60 tWavetable_init(&wt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);61// tWavetable_init(&wt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
61 tCompactWavetable_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);62// tCompactWavetable_init(&cwt, __leaf_table_sawtooth[0], 2048, 10000.f, &leaf);
62 63
63 tMBTriangle_init(&btri, &leaf);64 tMBTriangle_init(&btri, &leaf);
64 tMBPulse_init(&bpulse, &leaf);65 tMBPulse_init(&bpulse, &leaf);
@@ -69,6 +70,15 @@ void LEAFTest_init (float sampleRate, int blockSize) · 4 unmodified lines
69 70
70 tPhasor_init(&phasor, &leaf);71 tPhasor_init(&phasor, &leaf);
71 tPhasor_setFreq(&phasor, 220.f);72 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);
72}82}
73 83
74inline double getSawFall(double angle) {84inline double getSawFall(double angle) {
@@ -86,7 +96,8 @@ float LEAFTest_tick (float input) · 11 unmodified lines
86// return tSimpleRetune_tick(&sretune, input);96// return tSimpleRetune_tick(&sretune, input);
87// tMBPulse_sync(&bpulse, tPhasor_tick(&phasor) * 2.f - 1.f);97// tMBPulse_sync(&bpulse, tPhasor_tick(&phasor) * 2.f - 1.f);
88// return tMBPulse_tick(&bpulse);98// return tMBPulse_tick(&bpulse);
89 return tWavetable_tick(&wt);99// return tWavetable_tick(&wt);
100 return tWaveset_tick(&ws);
90}101}
91 102
92int firstFrame = 1;103int firstFrame = 1;
@@ -97,12 +108,14 @@ void LEAFTest_block (void) · 4 unmodified lines
97 tMBTriangle_setFreq(&btri, val * 440.f);108 tMBTriangle_setFreq(&btri, val * 440.f);
98 tMBPulse_setFreq(&bpulse, val * 160000.f - 80000.0f);109 tMBPulse_setFreq(&bpulse, val * 160000.f - 80000.0f);
99 tMBSaw_setFreq(&bsaw, val * 10000.f);110 tMBSaw_setFreq(&bsaw, val * 10000.f);
100 tWavetable_setFreq(&wt, val * 160000.f - 80000.0f);111// tWavetable_setFreq(&wt, val * 160000.f - 80000.0f);
101 tCompactWavetable_setFreq(&cwt, val * 10000.);112// tCompactWavetable_setFreq(&cwt, val * 10000.);
113 tWaveset_setFreq(&ws, val * 10000.f);
102// tRetune_tuneVoice(&retune, 0, val * 3.0f + 0.5f);114// tRetune_tuneVoice(&retune, 0, val * 3.0f + 0.5f);
103// tSimpleRetune_tuneVoice(&sretune, 0, 300);115// tSimpleRetune_tuneVoice(&sretune, 0, 300);
104 116
105 val = getSliderValue("slider2");117 val = getSliderValue("slider2");
118 tWaveset_setIndex(&ws, val);
106// tRetune_setPitchFactor(&retune, val * 3.0f + 0.5f, 1);119// tRetune_setPitchFactor(&retune, val * 3.0f + 0.5f, 1);
107 120
108 val = getSliderValue("slider3");121 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