diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 156e762..3c4f454 100755 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -877,6 +877,7 @@ void ObxdAudioProcessorEditor::buttonClicked (Button* b) auto toggleButton = dynamic_cast (b); if (toggleButton == midiUnlearnButton){ if (midiUnlearnButton->getToggleState()){ + countTimerForLed = 0; processor.getMidiMap().reset(); processor.getMidiMap().set_default(); processor.sendChangeMessage(); @@ -904,9 +905,10 @@ void ObxdAudioProcessorEditor::updateFromHost() { } // Set to unlearn to false - if ( midiUnlearnButton && midiUnlearnButton->getToggleState()) { - midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification); - } + //if ( midiUnlearnButton && midiUnlearnButton->getToggleState()) { + // Thread::sleep(500); + // midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification); + //} repaint(); } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 1454f55..e39564c 100755 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -89,6 +89,12 @@ public: needNotifytoHost= false; processor.updateHostDisplay(); } + + countTimerForLed++; + if (midiUnlearnButton && midiUnlearnButton->getToggleState() && countTimerForLed > 3) { + midiUnlearnButton->setToggleState(false, NotificationType::sendNotification); + countTimerForLed = 0; + } } ApplicationCommandTarget* getNextCommandTarget() override { return nullptr; @@ -276,8 +282,11 @@ private: ApplicationCommandManager commandManager; int countTimer =0; bool needNotifytoHost = false; + Array midiFiles; int menuMidiNum; + int countTimerForLed = 0; + }; #endif // PLUGINEDITOR_H_INCLUDED