Fix crash in wavetables changing while playing. Fixed crash enabling noise.

This commit is contained in:
Roland Rabien 2023-09-04 08:27:23 -07:00
commit 59a761fc69
4 changed files with 7 additions and 6 deletions

View file

@ -161,7 +161,7 @@ public:
addEnable (sub.enable);
addControl (new gin::Knob (sub.tune, true), 0, 0);
addControl (new gin::Knob (sub.level, true), 1, 0);
addControl (new gin::Knob (sub.level), 1, 0);
addControl (new gin::Knob (sub.pan, true), 0, 1);
addControl (new gin::Select (sub.wave), 1, 1);
}
@ -183,7 +183,7 @@ public:
addEnable (noise.enable);
addControl (new gin::Select (noise.type), 0, 0);
addControl (new gin::Knob (noise.level, true), 0, 0);
addControl (new gin::Knob (noise.level), 0, 0);
addControl (new gin::Knob (noise.pan, true), 0, 1);
}

View file

@ -12,8 +12,8 @@ WavetableVoice::WavetableVoice (WavetableAudioProcessor& p)
void WavetableVoice::noteStarted()
{
oscillators[0].setWavetable (proc.osc1Tables);
oscillators[1].setWavetable (proc.osc2Tables);
oscillators[0].setWavetable (&proc.osc1Tables);
oscillators[1].setWavetable (&proc.osc2Tables);
fastKill = false;
startVoice();
@ -243,7 +243,7 @@ void WavetableVoice::updateParams (int blockSize)
if (proc.noiseParams.enable->isOn())
{
noiseParams.wave = int (getValue (proc.noiseParams.type)) == 0 ? gin::Wave::whiteNoise : gin::Wave::pinkNoise;
noiseParams.wave = proc.noiseParams.type->getUserValueInt() == 0 ? gin::Wave::whiteNoise : gin::Wave::pinkNoise;
noiseParams.leftGain = getValue (proc.noiseParams.level) * (1.0f - getValue (proc.noiseParams.pan));
noiseParams.rightGain = getValue (proc.noiseParams.level) * (1.0f + getValue (proc.noiseParams.pan));