mirror of
https://codeberg.org/armin/wavetable.git
synced 2026-09-01 05:50:46 +02:00
UI work
This commit is contained in:
parent
f1829adfcf
commit
8a591b3ab0
7 changed files with 72 additions and 13 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 65c6c21cb723421bd4c4a933f7b9323a3a854f0d
|
Subproject commit 15facfa3eaa9648244202df0e29067d30b36f33c
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
"children":
|
"children":
|
||||||
[
|
[
|
||||||
{ "id": "osc[1..2]", "x": "0,prevR()+1", "y": 0, "w": "parW()/2", "h": 163 }
|
{ "id": "osc[1..2]", "x": "0,prevR()+1", "y": 0, "w": "parW()/2", "h": 163 },
|
||||||
|
{ "id": "flt", "x": "0", "y": "prevB()+1", "w": 175, "h": 163 },
|
||||||
|
{ "id": "fltAdsr", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 },
|
||||||
|
{ "id": "lfo[1..3]", "x": "0,prevR()+1", "y": "prevB()+1,prevY()", "w": 175, "h": 163 },
|
||||||
|
{ "id": "scope", "x": "0", "y": "prevB()+1", "w": 175, "h": 163 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -17,16 +17,29 @@ public:
|
||||||
|
|
||||||
addEnable (osc.enable);
|
addEnable (osc.enable);
|
||||||
|
|
||||||
|
addControl (new gin::Knob (osc.pos), 0, 0);
|
||||||
addControl (new gin::Knob (osc.tune, true), 1, 0);
|
addControl (new gin::Knob (osc.tune, true), 1, 0);
|
||||||
addControl (new gin::Select (osc.voices), 2, 0);
|
addControl (new gin::Knob (osc.finetune, true), 2, 0);
|
||||||
addControl (detune = new gin::Knob (osc.detune), 3, 0);
|
addControl (new gin::Knob (osc.level, true), 3, 0);
|
||||||
|
addControl (new gin::Knob (osc.pan, true), 4, 0);
|
||||||
|
|
||||||
addControl (new gin::Knob (osc.pos), 0, 1);
|
addControl (new gin::Select (osc.voices), 0, 1);
|
||||||
addControl (new gin::Knob (osc.finetune, true), 1, 1);
|
addControl (detune = new gin::Knob (osc.detune), 1, 1);
|
||||||
addControl (spread = new gin::Knob (osc.spread), 2, 1);
|
addControl (spread = new gin::Knob (osc.spread), 2, 1);
|
||||||
addControl (trans = new gin::Knob (osc.voicesTrns, true), 3, 1);
|
addControl (trans = new gin::Knob (osc.voicesTrns, true), 3, 1);
|
||||||
|
|
||||||
watchParam (osc.voices);
|
watchParam (osc.voices);
|
||||||
|
|
||||||
|
wt = new gin::WavetableComponent();
|
||||||
|
wt->setName ("wt");
|
||||||
|
wt->setWavetables (idx == 0 ? &proc.osc1Tables : &proc.osc2Tables);
|
||||||
|
addControl (wt, 5, 0, 3, 2);
|
||||||
|
|
||||||
|
timer.startTimerHz (60);
|
||||||
|
timer.onTimer = [this]
|
||||||
|
{
|
||||||
|
wt->setParams (proc.getLiveWTParams (idx));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void paramChanged() override
|
void paramChanged() override
|
||||||
|
|
@ -43,6 +56,9 @@ public:
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
gin::ParamComponent::Ptr trans, detune, spread;
|
gin::ParamComponent::Ptr trans, detune, spread;
|
||||||
|
gin::WavetableComponent* wt;
|
||||||
|
|
||||||
|
gin::CoalescedTimer timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,18 @@ void WavetableAudioProcessor::ReverbParams::setup (WavetableAudioProcessor& p)
|
||||||
mix = p.addExtParam ("rvbMix", "Mix", "", "", {0.0f, 1.0f, 0.0f, 1.0f}, 0.0f, 0.0f);
|
mix = p.addExtParam ("rvbMix", "Mix", "", "", {0.0f, 1.0f, 0.0f, 1.0f}, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void loadWaveTable (juce::OwnedArray<gin::BandLimitedLookupTable>& table, const juce::MemoryBlock& wav)
|
||||||
|
{
|
||||||
|
auto is = new juce::MemoryInputStream (wav, false);
|
||||||
|
if (auto reader = std::unique_ptr<juce::AudioFormatReader> (juce::WavAudioFormat().createReaderFor (is, true)))
|
||||||
|
{
|
||||||
|
juce::AudioSampleBuffer buf (1, int (reader->lengthInSamples));
|
||||||
|
reader->read (&buf, 0, int (reader->lengthInSamples), 0, true, false);
|
||||||
|
|
||||||
|
loadWavetables (table, buf, reader->sampleRate, gin::getWavetableSize (wav));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
WavetableAudioProcessor::WavetableAudioProcessor()
|
WavetableAudioProcessor::WavetableAudioProcessor()
|
||||||
{
|
{
|
||||||
|
|
@ -342,6 +354,9 @@ WavetableAudioProcessor::WavetableAudioProcessor()
|
||||||
enableLegacyMode();
|
enableLegacyMode();
|
||||||
setVoiceStealingEnabled (true);
|
setVoiceStealingEnabled (true);
|
||||||
|
|
||||||
|
loadWaveTable (osc1Tables, juce::MemoryBlock (BinaryData::Analog_PWM_Square_01_wav, BinaryData::Analog_PWM_Square_01_wavSize));
|
||||||
|
loadWaveTable (osc2Tables, juce::MemoryBlock (BinaryData::Analog_PWM_Saw_01_wav, BinaryData::Analog_PWM_Saw_01_wavSize));
|
||||||
|
|
||||||
for (int i = 0; i < juce::numElementsInArray (oscParams); i++)
|
for (int i = 0; i < juce::numElementsInArray (oscParams); i++)
|
||||||
oscParams[i].setup (*this, i);
|
oscParams[i].setup (*this, i);
|
||||||
|
|
||||||
|
|
@ -539,6 +554,18 @@ juce::Array<float> WavetableAudioProcessor::getLiveFilterCutoff()
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gin::WTOscillator::Params WavetableAudioProcessor::getLiveWTParams (int osc)
|
||||||
|
{
|
||||||
|
for (auto v : voices)
|
||||||
|
if (v->isActive())
|
||||||
|
if (auto vav = dynamic_cast<WavetableVoice*>(v))
|
||||||
|
return vav->getLiveWTParams (osc);
|
||||||
|
|
||||||
|
gin::WTOscillator::Params p;
|
||||||
|
p.pw = oscParams[osc].pos->getValue();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)
|
void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)
|
||||||
{
|
{
|
||||||
// Apply gate
|
// Apply gate
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ public:
|
||||||
void handleController (int ch, int num, int val) override;
|
void handleController (int ch, int num, int val) override;
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
juce::Array<float> getLiveFilterCutoff();
|
juce::Array<float> getLiveFilterCutoff();
|
||||||
|
gin::WTOscillator::Params getLiveWTParams (int osc);
|
||||||
|
|
||||||
void applyEffects (juce::AudioSampleBuffer& buffer);
|
void applyEffects (juce::AudioSampleBuffer& buffer);
|
||||||
|
|
||||||
|
|
@ -234,6 +235,9 @@ public:
|
||||||
gin::GainProcessor outputGain;
|
gin::GainProcessor outputGain;
|
||||||
gin::AudioFifo fifo { 2, 44100 };
|
gin::AudioFifo fifo { 2, 44100 };
|
||||||
|
|
||||||
|
juce::OwnedArray<gin::BandLimitedLookupTable> osc1Tables;
|
||||||
|
juce::OwnedArray<gin::BandLimitedLookupTable> osc2Tables;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
gin::ModMatrix modMatrix;
|
gin::ModMatrix modMatrix;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ void WavetableVoice::updateParams (int blockSize)
|
||||||
currentMidiNotes[i] += float (note.totalPitchbendInSemitones);
|
currentMidiNotes[i] += float (note.totalPitchbendInSemitones);
|
||||||
currentMidiNotes[i] += getValue (proc.oscParams[i].tune) + getValue (proc.oscParams[i].finetune) / 100.0f;
|
currentMidiNotes[i] += getValue (proc.oscParams[i].tune) + getValue (proc.oscParams[i].finetune) / 100.0f;
|
||||||
|
|
||||||
oscParams[i].wave = gin::Wave::silence;
|
oscParams[i].wave = gin::Wave::wavetable;
|
||||||
oscParams[i].voices = int (proc.oscParams[i].voices->getProcValue());
|
oscParams[i].voices = int (proc.oscParams[i].voices->getProcValue());
|
||||||
oscParams[i].vcTrns = int (proc.oscParams[i].voicesTrns->getProcValue());
|
oscParams[i].vcTrns = int (proc.oscParams[i].voicesTrns->getProcValue());
|
||||||
oscParams[i].pw = getValue (proc.oscParams[i].pos) / 100.0f;
|
oscParams[i].pw = getValue (proc.oscParams[i].pos) / 100.0f;
|
||||||
|
|
@ -361,3 +361,10 @@ float WavetableVoice::getFilterCutoffNormalized()
|
||||||
float freq = filter.getFrequency();
|
float freq = filter.getFrequency();
|
||||||
return proc.filterParams.frequency->getUserRange().convertTo0to1 (gin::getMidiNoteFromHertz (freq));
|
return proc.filterParams.frequency->getUserRange().convertTo0to1 (gin::getMidiNoteFromHertz (freq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gin::WTOscillator::Params WavetableVoice::getLiveWTParams (int osc)
|
||||||
|
{
|
||||||
|
gin::WTOscillator::Params p;
|
||||||
|
p.pw = getValue (proc.oscParams[osc].pos) / 100.0f;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ public:
|
||||||
bool isVoiceActive() override;
|
bool isVoiceActive() override;
|
||||||
|
|
||||||
float getFilterCutoffNormalized();
|
float getFilterCutoffNormalized();
|
||||||
|
gin::WTOscillator::Params getLiveWTParams (int osc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateParams (int blockSize);
|
void updateParams (int blockSize);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue