Add panic button

This commit is contained in:
Roland Rabien 2023-09-23 11:10:21 -07:00
commit b466218cbd
6 changed files with 15 additions and 11 deletions

@ -1 +1 @@
Subproject commit 67c6880dd9f204d7762970777d12614b458738b7 Subproject commit 3848b8e66f9783ac770e9dd459eb390d635eca77

View file

@ -3,7 +3,7 @@
//============================================================================== //==============================================================================
WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProcessor& p) WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProcessor& p)
: ProcessorEditor (p), vaProc (p) : ProcessorEditor (p), wtProc (p)
{ {
scope.setName ("scope"); scope.setName ("scope");
scope.setNumChannels (2); scope.setNumChannels (2);
@ -14,6 +14,8 @@ WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProc
addAndMakeVisible (editor); addAndMakeVisible (editor);
addAndMakeVisible (scope); addAndMakeVisible (scope);
usage.panic.onClick = [this] { wtProc.presetLoaded = true; };
addAndMakeVisible (usage); addAndMakeVisible (usage);
usage.setBounds (45, 12, 150, 16); usage.setBounds (45, 12, 150, 16);
@ -67,9 +69,9 @@ void WavetableAudioProcessorEditor::resized()
void WavetableAudioProcessorEditor::addMenuItems (juce::PopupMenu& m) void WavetableAudioProcessorEditor::addMenuItems (juce::PopupMenu& m)
{ {
m.addSeparator(); m.addSeparator();
m.addItem ("MPE", true, vaProc.globalParams.mpe->getUserValueBool(), [this] m.addItem ("MPE", true, wtProc.globalParams.mpe->getUserValueBool(), [this]
{ {
vaProc.globalParams.mpe->setUserValue (vaProc.globalParams.mpe->getUserValueBool() ? 0.0f : 1.0f); wtProc.globalParams.mpe->setUserValue (wtProc.globalParams.mpe->getUserValueBool() ? 0.0f : 1.0f);
}); });
auto setSize = [this] (float scale) auto setSize = [this] (float scale)

View file

@ -21,12 +21,12 @@ public:
void showAboutInfo() override; void showAboutInfo() override;
private: private:
WavetableAudioProcessor& vaProc; WavetableAudioProcessor& wtProc;
gin::TriggeredScope scope { vaProc.scopeFifo }; gin::TriggeredScope scope { wtProc.scopeFifo };
gin::SynthesiserUsage usage { vaProc }; gin::SynthesiserUsage usage { wtProc };
Editor editor { vaProc }; Editor editor { wtProc };
#if JUCE_DEBUG #if JUCE_DEBUG
std::unique_ptr<melatonin::Inspector> inspector; std::unique_ptr<melatonin::Inspector> inspector;

View file

@ -615,6 +615,7 @@ void WavetableAudioProcessor::stateUpdated()
userTable2.fromBase64Encoding (state.getProperty ("wt2Data").toString()); userTable2.fromBase64Encoding (state.getProperty ("wt2Data").toString());
reloadWavetables(); reloadWavetables();
presetLoaded = true;
} }
void WavetableAudioProcessor::updateState() void WavetableAudioProcessor::updateState()
@ -728,9 +729,9 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
return; return;
} }
if (blockMissed) if (blockMissed || presetLoaded)
{ {
blockMissed = false; blockMissed = presetLoaded = false;
turnOffAllVoices (false); turnOffAllVoices (false);
} }

View file

@ -270,6 +270,7 @@ public:
juce::AudioPlayHead* playhead = nullptr; juce::AudioPlayHead* playhead = nullptr;
bool blockMissed = false; bool blockMissed = false;
bool presetLoaded = false;
struct CurTable struct CurTable
{ {

View file

@ -413,7 +413,7 @@ bool WavetableVoice::isVoiceActive()
float WavetableVoice::getFilterCutoffNormalized() 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 (juce::jlimit (0.0f, 1.0f, gin::getMidiNoteFromHertz (freq)));
} }
gin::WTOscillator::Params WavetableVoice::getLiveWTParams (int osc) gin::WTOscillator::Params WavetableVoice::getLiveWTParams (int osc)