Preset sync workaround and menu tweak
This commit is contained in:
parent
919f828c2b
commit
8e6d1ac29a
4 changed files with 46 additions and 7 deletions
23
Source/PluginEditor.cpp
Normal file → Executable file
23
Source/PluginEditor.cpp
Normal file → Executable file
|
@ -45,11 +45,9 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
|
||||||
getTopLevelComponent()->addKeyListener (commandManager.getKeyMappings());
|
getTopLevelComponent()->addKeyListener (commandManager.getKeyMappings());
|
||||||
|
|
||||||
//Timer::callAfterDelay (100, [this] { this->grabKeyboardFocus(); }); // ensure that key presses are sent to the KeyPressTarget object
|
//Timer::callAfterDelay (100, [this] { this->grabKeyboardFocus(); }); // ensure that key presses are sent to the KeyPressTarget object
|
||||||
#if JUCE_WINDOWS
|
|
||||||
// No run timer to grab component on window
|
|
||||||
#else
|
|
||||||
startTimer(100); // This will fix the issue
|
startTimer(100); // This will fix the issue
|
||||||
#endif
|
|
||||||
|
|
||||||
DBG("W: " <<getWidth() << " H:" << getHeight());
|
DBG("W: " <<getWidth() << " H:" << getHeight());
|
||||||
|
|
||||||
|
@ -420,6 +418,7 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
PopupMenu bankMenu;
|
PopupMenu bankMenu;
|
||||||
PopupMenu skinMenu;
|
PopupMenu skinMenu;
|
||||||
PopupMenu fileMenu;
|
PopupMenu fileMenu;
|
||||||
|
PopupMenu viewMenu;
|
||||||
skins = processor.getSkinFiles();
|
skins = processor.getSkinFiles();
|
||||||
banks = processor.getBankFiles();
|
banks = processor.getBankFiles();
|
||||||
{
|
{
|
||||||
|
@ -517,7 +516,8 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
menu->addSubMenu ("Themes", skinMenu);
|
menu->addSubMenu ("Themes", skinMenu);
|
||||||
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
|
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
|
||||||
}
|
}
|
||||||
menu->addItem(progStart + 1000, "Preset Bar", true, false, Image());
|
viewMenu.addItem(progStart + 1000, "Preset Bar", true, processor.showPresetBar);
|
||||||
|
menu->addSubMenu ("View", viewMenu);
|
||||||
popupMenus.add (menu);
|
popupMenus.add (menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,6 +560,7 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
|
||||||
}
|
}
|
||||||
else if (result == progStart + 1000){
|
else if (result == progStart + 1000){
|
||||||
processor.setShowPresetBar(!processor.getShowPresetBar());
|
processor.setShowPresetBar(!processor.getShowPresetBar());
|
||||||
|
createMenu();
|
||||||
updatePresetBar();
|
updatePresetBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -753,7 +754,11 @@ void ObxdAudioProcessorEditor::nextProgram() {
|
||||||
if (cur == processor.getNumPrograms()) {
|
if (cur == processor.getNumPrograms()) {
|
||||||
cur = 0;
|
cur = 0;
|
||||||
}
|
}
|
||||||
processor.setCurrentProgram (cur);
|
processor.setCurrentProgram (cur, false);
|
||||||
|
|
||||||
|
needNotifytoHost = true;
|
||||||
|
countTimer = 0;
|
||||||
|
|
||||||
clean();
|
clean();
|
||||||
loadSkin (processor);
|
loadSkin (processor);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +767,11 @@ void ObxdAudioProcessorEditor::prevProgram() {
|
||||||
if (cur < 0) {
|
if (cur < 0) {
|
||||||
cur = processor.getNumPrograms() - 1;
|
cur = processor.getNumPrograms() - 1;
|
||||||
}
|
}
|
||||||
processor.setCurrentProgram (cur);
|
processor.setCurrentProgram (cur, false);
|
||||||
|
|
||||||
|
needNotifytoHost = true;
|
||||||
|
countTimer = 0;
|
||||||
|
|
||||||
clean();
|
clean();
|
||||||
loadSkin (processor);
|
loadSkin (processor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,17 @@ public:
|
||||||
void buttonClicked (Button *) override;
|
void buttonClicked (Button *) override;
|
||||||
//bool keyPressed(const KeyPress & press) override;
|
//bool keyPressed(const KeyPress & press) override;
|
||||||
void timerCallback() override {
|
void timerCallback() override {
|
||||||
|
#if JUCE_WINDOWS || JUCE_LINUX
|
||||||
|
// No run timer to grab component on window
|
||||||
|
#else
|
||||||
this->grabKeyboardFocus();
|
this->grabKeyboardFocus();
|
||||||
|
#endif
|
||||||
|
countTimer ++;
|
||||||
|
if (countTimer == 4 && needNotifytoHost){
|
||||||
|
countTimer = 0;
|
||||||
|
needNotifytoHost= false;
|
||||||
|
processor.updateHostDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ApplicationCommandTarget* getNextCommandTarget() override {
|
ApplicationCommandTarget* getNextCommandTarget() override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -260,6 +270,8 @@ private:
|
||||||
std::unique_ptr<FileChooser> fileChooser;
|
std::unique_ptr<FileChooser> fileChooser;
|
||||||
// Command manager
|
// Command manager
|
||||||
ApplicationCommandManager commandManager;
|
ApplicationCommandManager commandManager;
|
||||||
|
int countTimer =0;
|
||||||
|
bool needNotifytoHost = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINEDITOR_H_INCLUDED
|
#endif // PLUGINEDITOR_H_INCLUDED
|
||||||
|
|
17
Source/PluginProcessor.cpp
Normal file → Executable file
17
Source/PluginProcessor.cpp
Normal file → Executable file
|
@ -167,6 +167,23 @@ int ObxdAudioProcessor::getCurrentProgram()
|
||||||
return programs.currentProgram;
|
return programs.currentProgram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObxdAudioProcessor::setCurrentProgram (int index, bool updateHost){
|
||||||
|
programs.currentProgram = index;
|
||||||
|
programs.currentProgramPtr = programs.programs + programs.currentProgram;
|
||||||
|
isHostAutomatedChange = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < PARAM_COUNT; ++i)
|
||||||
|
setEngineParameterValue (i, programs.currentProgramPtr->values[i], true);
|
||||||
|
|
||||||
|
isHostAutomatedChange = true;
|
||||||
|
|
||||||
|
sendChangeMessage();
|
||||||
|
// Will delay
|
||||||
|
if (updateHost) {
|
||||||
|
updateHostDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ObxdAudioProcessor::setCurrentProgram (int index)
|
void ObxdAudioProcessor::setCurrentProgram (int index)
|
||||||
{
|
{
|
||||||
programs.currentProgram = index;
|
programs.currentProgram = index;
|
||||||
|
|
|
@ -153,6 +153,7 @@ public:
|
||||||
int getNumPrograms() override;
|
int getNumPrograms() override;
|
||||||
int getCurrentProgram() override;
|
int getCurrentProgram() override;
|
||||||
void setCurrentProgram (int index) override;
|
void setCurrentProgram (int index) override;
|
||||||
|
void setCurrentProgram (int index, bool updateHost);
|
||||||
const String getProgramName (int index) override;
|
const String getProgramName (int index) override;
|
||||||
void changeProgramName (int index, const String& newName) override;
|
void changeProgramName (int index, const String& newName) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue