2017-01-23 10:15:08 +00:00
|
|
|
#pragma once
|
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
This file was auto-generated by the Introjucer!
|
|
|
|
|
|
|
|
It contains the basic startup code for a Juce application.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLUGINEDITOR_H_INCLUDED
|
|
|
|
#define PLUGINEDITOR_H_INCLUDED
|
|
|
|
|
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
#include "PluginProcessor.h"
|
|
|
|
#include "Gui/Knob.h"
|
|
|
|
#include "Gui/TooglableButton.h"
|
|
|
|
#include "Gui/ButtonList.h"
|
2021-03-30 16:27:29 +00:00
|
|
|
#include "Components/SetPresetNameWindow.h"
|
2021-04-27 07:46:19 +00:00
|
|
|
#include "Components/PresetBar.h"
|
2021-09-01 08:38:39 +00:00
|
|
|
#include "Components/ScaleComponent.h"
|
2020-12-13 18:06:22 +00:00
|
|
|
enum KeyPressCommandIDs
|
|
|
|
{
|
|
|
|
buttonNextProgram = 1,
|
|
|
|
buttonPrevProgram,
|
|
|
|
buttonPadNextProgram,
|
|
|
|
buttonPadPrevProgram,
|
|
|
|
|
|
|
|
};
|
2021-03-30 16:27:29 +00:00
|
|
|
|
|
|
|
enum MenuAction
|
|
|
|
{
|
|
|
|
Cancel = 0,
|
|
|
|
ToggleMidiKeyboard,
|
|
|
|
ImportPreset,
|
|
|
|
ImportBank,
|
|
|
|
ExportBank,
|
|
|
|
ExportPreset,
|
|
|
|
SavePreset,
|
|
|
|
NewPreset,
|
|
|
|
RenamePreset,
|
|
|
|
DeletePreset,
|
|
|
|
DeleteBank,
|
|
|
|
ShowBanks,
|
|
|
|
LoadBank // LoadBank must be the last enum value
|
|
|
|
};
|
2017-01-23 10:15:08 +00:00
|
|
|
//==============================================================================
|
|
|
|
/**
|
|
|
|
*/
|
2020-04-24 06:15:00 +00:00
|
|
|
class ObxdAudioProcessorEditor : public AudioProcessorEditor
|
|
|
|
// , public AudioProcessorListener
|
2021-09-01 08:38:39 +00:00
|
|
|
, public AsyncUpdater
|
2020-04-24 06:15:00 +00:00
|
|
|
, public ChangeListener
|
|
|
|
// , public Slider::Listener
|
|
|
|
, public Button::Listener
|
|
|
|
// , public ComboBox::Listener
|
2020-12-13 18:06:22 +00:00
|
|
|
, public ApplicationCommandTarget
|
|
|
|
, public Timer
|
2021-05-16 10:29:57 +00:00
|
|
|
, public FileDragAndDropTarget
|
2021-09-01 08:38:39 +00:00
|
|
|
, public ScalableComponent
|
2020-12-13 18:06:22 +00:00
|
|
|
|
2017-01-23 10:15:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-04-19 13:43:40 +00:00
|
|
|
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
|
2017-01-23 10:15:08 +00:00
|
|
|
~ObxdAudioProcessorEditor();
|
2021-05-16 10:29:57 +00:00
|
|
|
|
|
|
|
bool isInterestedInFileDrag(const StringArray& files) override;
|
|
|
|
void filesDropped(const StringArray& files, int x, int y) override;
|
2020-04-21 13:08:05 +00:00
|
|
|
|
2021-09-01 08:38:39 +00:00
|
|
|
void scaleFactorChanged() override;
|
|
|
|
|
2020-04-19 13:43:40 +00:00
|
|
|
void mouseUp (const MouseEvent& e) override;
|
|
|
|
void paint (Graphics& g) override;
|
2020-05-21 07:20:47 +00:00
|
|
|
|
2020-08-10 15:38:31 +00:00
|
|
|
void updateFromHost();
|
2021-09-01 08:38:39 +00:00
|
|
|
void handleAsyncUpdate() override;
|
2021-04-27 07:46:19 +00:00
|
|
|
String getCurrentProgramName(){
|
|
|
|
return processor.getProgramName(processor.getCurrentProgram());
|
|
|
|
}
|
2021-05-17 17:52:09 +00:00
|
|
|
void updatePresetBar(bool resize=true);
|
2017-01-23 10:15:08 +00:00
|
|
|
//==============================================================================
|
2020-04-19 13:43:40 +00:00
|
|
|
void changeListenerCallback (ChangeBroadcaster* source) override;
|
2020-04-24 06:15:00 +00:00
|
|
|
void buttonClicked (Button *) override;
|
2020-12-13 18:06:22 +00:00
|
|
|
//bool keyPressed(const KeyPress & press) override;
|
|
|
|
void timerCallback() override {
|
2021-05-12 16:47:15 +00:00
|
|
|
#if JUCE_WINDOWS || JUCE_LINUX
|
|
|
|
// No run timer to grab component on window
|
|
|
|
#else
|
2020-12-13 18:06:22 +00:00
|
|
|
this->grabKeyboardFocus();
|
2021-05-12 16:47:15 +00:00
|
|
|
#endif
|
|
|
|
countTimer ++;
|
|
|
|
if (countTimer == 4 && needNotifytoHost){
|
|
|
|
countTimer = 0;
|
|
|
|
needNotifytoHost= false;
|
|
|
|
processor.updateHostDisplay();
|
|
|
|
}
|
2021-05-20 17:34:21 +00:00
|
|
|
|
|
|
|
countTimerForLed++;
|
|
|
|
if (midiUnlearnButton && midiUnlearnButton->getToggleState() && countTimerForLed > 3) {
|
|
|
|
midiUnlearnButton->setToggleState(false, NotificationType::sendNotification);
|
|
|
|
countTimerForLed = 0;
|
|
|
|
}
|
2020-12-13 18:06:22 +00:00
|
|
|
}
|
|
|
|
ApplicationCommandTarget* getNextCommandTarget() override {
|
|
|
|
return nullptr;
|
|
|
|
};
|
|
|
|
void getAllCommands (Array<CommandID>& commands) override {
|
|
|
|
Array<CommandID> ids { KeyPressCommandIDs::buttonNextProgram, KeyPressCommandIDs::buttonPrevProgram,
|
|
|
|
KeyPressCommandIDs::buttonPadNextProgram, KeyPressCommandIDs::buttonPadPrevProgram
|
|
|
|
};
|
|
|
|
|
|
|
|
commands.addArray (ids);
|
|
|
|
};
|
|
|
|
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override {
|
|
|
|
switch (commandID)
|
|
|
|
{
|
|
|
|
case KeyPressCommandIDs::buttonNextProgram:
|
|
|
|
result.setInfo ("Move up", "Move the button + ", "Button", 0);
|
|
|
|
result.addDefaultKeypress ('+', 0);
|
|
|
|
result.setActive (true);
|
|
|
|
break;
|
|
|
|
case KeyPressCommandIDs::buttonPrevProgram:
|
|
|
|
result.setInfo ("Move right", "Move the button - ", "Button", 0);
|
|
|
|
result.addDefaultKeypress ('-', 0);
|
|
|
|
result.setActive (true);
|
|
|
|
break;
|
|
|
|
case KeyPressCommandIDs::buttonPadNextProgram:
|
|
|
|
result.setInfo ("Move down", "Move the button Pad + ", "Button", 0);
|
|
|
|
result.addDefaultKeypress (KeyPress::numberPadAdd, 0);
|
|
|
|
result.setActive (true);
|
|
|
|
break;
|
|
|
|
case KeyPressCommandIDs::buttonPadPrevProgram:
|
|
|
|
result.setInfo ("Move left", "Move the button Pad -", "Button", 0);
|
|
|
|
result.addDefaultKeypress (KeyPress::numberPadSubtract, 0);
|
|
|
|
result.setActive (true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
bool perform (const InvocationInfo& info) override {
|
2017-01-23 10:15:08 +00:00
|
|
|
|
2020-12-13 18:06:22 +00:00
|
|
|
switch (info.commandID)
|
|
|
|
{
|
|
|
|
case KeyPressCommandIDs::buttonNextProgram:
|
|
|
|
case KeyPressCommandIDs::buttonPadNextProgram:
|
|
|
|
nextProgram();
|
2020-12-15 11:10:32 +00:00
|
|
|
grabKeyboardFocus();
|
2020-12-13 18:06:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KeyPressCommandIDs::buttonPrevProgram:
|
|
|
|
case KeyPressCommandIDs::buttonPadPrevProgram:
|
|
|
|
prevProgram();
|
2020-12-15 11:10:32 +00:00
|
|
|
grabKeyboardFocus();
|
2020-12-13 18:06:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
};/*
|
|
|
|
bool keyPressed (const KeyPress& key,
|
|
|
|
Component* originatingComponent) override {
|
|
|
|
DBG("--- " << key.getKeyCode());
|
|
|
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
void nextProgram();
|
|
|
|
void prevProgram();
|
2021-03-30 16:27:29 +00:00
|
|
|
|
|
|
|
void MenuActionCallback(int action);
|
|
|
|
void deleteBank();
|
|
|
|
|
|
|
|
void resized() override;
|
2021-09-01 08:38:39 +00:00
|
|
|
|
|
|
|
bool isHighResolutionDisplay() const
|
|
|
|
{
|
|
|
|
return processor.physicalPixelScaleFactor > 1.0;
|
|
|
|
}
|
2017-01-23 10:15:08 +00:00
|
|
|
private:
|
2021-09-01 08:38:39 +00:00
|
|
|
Rectangle<int> transformBounds(int x, int y, int w, int h);
|
2020-04-21 08:53:36 +00:00
|
|
|
Knob* addKnob (int x, int y, int d, ObxdAudioProcessor& filter, int parameter, String name, float defval);
|
2020-04-19 13:43:40 +00:00
|
|
|
void placeLabel (int x, int y, String text);
|
2020-04-21 14:51:05 +00:00
|
|
|
TooglableButton* addButton (int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name);
|
2021-09-01 08:38:39 +00:00
|
|
|
ButtonList* addList(int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name, String nameImg);
|
|
|
|
ImageButton* addMenuButton (int x, int y, int d, String nameImg);
|
2020-05-10 09:15:47 +00:00
|
|
|
void createMenu ();
|
2021-05-19 18:09:59 +00:00
|
|
|
void createMidi(int, PopupMenu &);
|
2020-05-10 09:15:47 +00:00
|
|
|
void resultFromMenu (const Point<int>);
|
2020-04-21 13:08:05 +00:00
|
|
|
void clean();
|
|
|
|
|
2021-04-27 07:46:19 +00:00
|
|
|
|
2020-04-19 13:43:40 +00:00
|
|
|
void rebuildComponents (ObxdAudioProcessor&);
|
2020-04-21 13:08:05 +00:00
|
|
|
void loadSkin(ObxdAudioProcessor&);
|
2017-01-23 10:15:08 +00:00
|
|
|
//==============================================================================
|
2021-09-01 08:38:39 +00:00
|
|
|
public:
|
2020-04-19 13:43:40 +00:00
|
|
|
ObxdAudioProcessor& processor;
|
2021-09-01 08:38:39 +00:00
|
|
|
private:
|
|
|
|
// images
|
|
|
|
Image backgroundImage;
|
|
|
|
std::map<String, Component*> mappingComps;
|
2017-01-23 10:15:08 +00:00
|
|
|
//==============================================================================
|
2020-04-21 13:13:51 +00:00
|
|
|
Knob* cutoffKnob=nullptr,
|
|
|
|
*resonanceKnob=nullptr,
|
|
|
|
*osc1PitchKnob=nullptr,
|
|
|
|
*osc2PitchKnob=nullptr,
|
|
|
|
*osc2DetuneKnob=nullptr,
|
|
|
|
*volumeKnob=nullptr,
|
|
|
|
*portamentoKnob=nullptr,
|
|
|
|
*voiceDetuneKnob=nullptr,
|
|
|
|
*filterEnvelopeAmtKnob=nullptr,
|
|
|
|
*pulseWidthKnob=nullptr,
|
|
|
|
*xmodKnob=nullptr,
|
|
|
|
*multimodeKnob=nullptr,
|
|
|
|
*attackKnob=nullptr,
|
|
|
|
*decayKnob=nullptr,
|
|
|
|
*sustainKnob=nullptr,
|
|
|
|
*releaseKnob=nullptr,
|
|
|
|
*fattackKnob=nullptr,
|
|
|
|
*fdecayKnob=nullptr,
|
|
|
|
*fsustainKnob=nullptr,
|
|
|
|
*freleaseKnob=nullptr,
|
|
|
|
*osc1MixKnob=nullptr,
|
|
|
|
*osc2MixKnob=nullptr,
|
|
|
|
*noiseMixKnob=nullptr,
|
|
|
|
*filterDetuneKnob=nullptr,
|
|
|
|
*envelopeDetuneKnob=nullptr,
|
|
|
|
*portamentoDetuneKnob=nullptr,
|
|
|
|
*tuneKnob=nullptr,
|
|
|
|
*lfoFrequencyKnob=nullptr,
|
|
|
|
*lfoAmt1Knob=nullptr,
|
|
|
|
*lfoAmt2Knob=nullptr,
|
|
|
|
*pan1Knob=nullptr,
|
|
|
|
*pan2Knob=nullptr,
|
|
|
|
*pan3Knob=nullptr,
|
|
|
|
*pan4Knob=nullptr,
|
|
|
|
*pan5Knob=nullptr,
|
|
|
|
*pan6Knob=nullptr,
|
|
|
|
*pan7Knob=nullptr,
|
|
|
|
*pan8Knob=nullptr,
|
|
|
|
*brightnessKnob=nullptr,
|
|
|
|
*envPitchModKnob=nullptr,
|
|
|
|
*bendLfoRateKnob=nullptr,
|
|
|
|
*veloAmpEnvKnob=nullptr,
|
|
|
|
*veloFltEnvKnob=nullptr,
|
|
|
|
*transposeKnob=nullptr;
|
2020-04-21 13:08:05 +00:00
|
|
|
|
2020-04-21 13:13:51 +00:00
|
|
|
TooglableButton* hardSyncButton=nullptr,
|
|
|
|
*osc1SawButton=nullptr,
|
|
|
|
*osc2SawButton=nullptr,
|
|
|
|
*osc1PulButton=nullptr,
|
|
|
|
*osc2PulButton=nullptr,
|
|
|
|
*filterKeyFollowButton=nullptr,
|
|
|
|
*unisonButton=nullptr,
|
|
|
|
*pitchQuantButton=nullptr,
|
|
|
|
*filterHQButton=nullptr,
|
|
|
|
*filterBPBlendButton=nullptr,
|
|
|
|
*lfoSinButton=nullptr,
|
|
|
|
*lfoSquareButton=nullptr,
|
|
|
|
*lfoSHButton=nullptr,
|
|
|
|
*lfoOsc1Button=nullptr,
|
|
|
|
*lfoOsc2Button=nullptr,
|
|
|
|
*lfoFilterButton=nullptr,
|
|
|
|
*lfoPwm1Button=nullptr,
|
|
|
|
*lfoPwm2Button=nullptr,
|
|
|
|
*bendRangeButton=nullptr,
|
|
|
|
*bendOsc2OnlyButton=nullptr,
|
|
|
|
*fourPoleButton=nullptr,
|
|
|
|
*asPlayedAllocButton=nullptr,
|
|
|
|
*midiLearnButton=nullptr,
|
|
|
|
*midiUnlearnButton=nullptr;
|
2020-04-21 13:08:05 +00:00
|
|
|
|
2020-04-21 13:13:51 +00:00
|
|
|
ButtonList *voiceSwitch = nullptr,
|
|
|
|
*legatoSwitch = nullptr;
|
2017-01-23 10:15:08 +00:00
|
|
|
|
|
|
|
File skinFolder;
|
2020-04-19 13:43:40 +00:00
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
OwnedArray<Knob::KnobAttachment> knobAttachments;
|
2020-08-10 15:38:31 +00:00
|
|
|
OwnedArray<AudioProcessorValueTreeState::ButtonAttachment> toggleAttachments;
|
2020-04-19 13:43:40 +00:00
|
|
|
OwnedArray<ButtonList::ButtonListAttachment> buttonListAttachments;
|
2020-04-24 06:15:00 +00:00
|
|
|
|
|
|
|
OwnedArray<ImageButton> imageButtons;
|
2020-05-10 09:15:47 +00:00
|
|
|
|
|
|
|
OwnedArray<PopupMenu> popupMenus;
|
|
|
|
|
2020-12-06 13:57:23 +00:00
|
|
|
bool notLoadSkin = false;
|
2020-05-10 09:15:47 +00:00
|
|
|
int progStart;
|
|
|
|
int bankStart;
|
|
|
|
int skinStart;
|
2021-04-27 07:46:19 +00:00
|
|
|
|
2020-05-10 09:15:47 +00:00
|
|
|
Array<File> skins;
|
|
|
|
Array<File> banks;
|
2021-03-30 16:27:29 +00:00
|
|
|
std::unique_ptr<SetPresetNameWindow> setPresetNameWindow;
|
2021-04-27 07:46:19 +00:00
|
|
|
std::unique_ptr<PresetBar> presetBar;
|
2021-03-30 16:27:29 +00:00
|
|
|
std::unique_ptr<FileChooser> fileChooser;
|
2020-12-13 18:06:22 +00:00
|
|
|
// Command manager
|
|
|
|
ApplicationCommandManager commandManager;
|
2021-05-12 16:47:15 +00:00
|
|
|
int countTimer =0;
|
|
|
|
bool needNotifytoHost = false;
|
2021-05-20 17:34:21 +00:00
|
|
|
|
2021-05-19 18:09:59 +00:00
|
|
|
Array<String> midiFiles;
|
|
|
|
int menuMidiNum;
|
2021-09-01 08:38:39 +00:00
|
|
|
int menuScaleNum;
|
2021-05-20 17:34:21 +00:00
|
|
|
int countTimerForLed = 0;
|
|
|
|
|
2017-01-23 10:15:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLUGINEDITOR_H_INCLUDED
|