2
0
Fork 0

2.0 update

Parameter code refactor.
Fixed macOS Standalone window code.
Updated jucer project.
This commit is contained in:
George Reales 2020-04-19 15:43:40 +02:00
parent 2577bad7dc
commit d1d6a8a200
10 changed files with 1195 additions and 1226 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
.DS_Store .DS_Store
Builds/ Builds/
Modules/
## JUCE library code ## JUCE library code
JuceLibraryCode/ JuceLibraryCode/

View file

@ -42,8 +42,7 @@ namespace juce
@tags{Audio} @tags{Audio}
*/ */
class StandalonePluginHolder : private AudioIODeviceCallback, class StandalonePluginHolder : private AudioIODeviceCallback,
private Timer, private Timer
private Value::Listener
{ {
public: public:
//============================================================================== //==============================================================================
@ -73,17 +72,15 @@ public:
#if JUCE_ANDROID || JUCE_IOS #if JUCE_ANDROID || JUCE_IOS
bool shouldAutoOpenMidiDevices = true bool shouldAutoOpenMidiDevices = true
#else #else
bool shouldAutoOpenMidiDevices = true bool shouldAutoOpenMidiDevices = false
#endif #endif
) )
: settings (settingsToUse, takeOwnershipOfSettings), : settings (settingsToUse, takeOwnershipOfSettings),
channelConfiguration (channels), channelConfiguration (channels),
shouldMuteInput (! isInterAppAudioConnected()),
autoOpenMidiDevices (shouldAutoOpenMidiDevices) autoOpenMidiDevices (shouldAutoOpenMidiDevices)
{ {
shouldMuteInput.addListener (this);
shouldMuteInput = ! isInterAppAudioConnected();
createPlugin(); createPlugin();
auto inChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numIns auto inChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numIns
@ -112,7 +109,7 @@ public:
startTimer (500); startTimer (500);
} }
virtual ~StandalonePluginHolder() override virtual ~StandalonePluginHolder()
{ {
stopTimer(); stopTimer();
@ -161,7 +158,6 @@ public:
//============================================================================== //==============================================================================
Value& getMuteInputValue() { return shouldMuteInput; } Value& getMuteInputValue() { return shouldMuteInput; }
bool getProcessorHasPotentialFeedbackLoop() const { return processorHasPotentialFeedbackLoop; } bool getProcessorHasPotentialFeedbackLoop() const { return processorHasPotentialFeedbackLoop; }
void valueChanged (Value& value) override { muteInput = (bool) value.getValue(); }
//============================================================================== //==============================================================================
File getLastFile() const File getLastFile() const
@ -255,24 +251,37 @@ public:
{ {
DialogWindow::LaunchOptions o; DialogWindow::LaunchOptions o;
int maxNumInputs = 0, maxNumOutputs = 0; int minNumInputs = std::numeric_limits<int>::max(), maxNumInputs = 0,
minNumOutputs = std::numeric_limits<int>::max(), maxNumOutputs = 0;
auto updateMinAndMax = [] (int newValue, int& minValue, int& maxValue)
{
minValue = jmin (minValue, newValue);
maxValue = jmax (maxValue, newValue);
};
if (channelConfiguration.size() > 0) if (channelConfiguration.size() > 0)
{ {
auto& defaultConfig = channelConfiguration.getReference (0); auto defaultConfig = channelConfiguration.getReference (0);
updateMinAndMax ((int) defaultConfig.numIns, minNumInputs, maxNumInputs);
maxNumInputs = jmax (0, (int) defaultConfig.numIns); updateMinAndMax ((int) defaultConfig.numOuts, minNumOutputs, maxNumOutputs);
maxNumOutputs = jmax (0, (int) defaultConfig.numOuts);
} }
if (auto* bus = processor->getBus (true, 0)) if (auto* bus = processor->getBus (true, 0))
maxNumInputs = jmax (0, bus->getDefaultLayout().size()); updateMinAndMax (bus->getDefaultLayout().size(), minNumInputs, maxNumInputs);
if (auto* bus = processor->getBus (false, 0)) if (auto* bus = processor->getBus (false, 0))
maxNumOutputs = jmax (0, bus->getDefaultLayout().size()); updateMinAndMax (bus->getDefaultLayout().size(), minNumOutputs, maxNumOutputs);
o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs)); minNumInputs = jmin (minNumInputs, maxNumInputs);
o.content->setSize (500, 550); minNumOutputs = jmin (minNumOutputs, maxNumOutputs);
o.content.setOwned (new SettingsComponent (*this, deviceManager,
minNumInputs,
maxNumInputs,
minNumOutputs,
maxNumOutputs));
o.content->setSize (500, 240);
o.dialogTitle = TRANS("Audio/MIDI Settings"); o.dialogTitle = TRANS("Audio/MIDI Settings");
o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId); o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId);
@ -287,7 +296,7 @@ public:
{ {
if (settings != nullptr) if (settings != nullptr)
{ {
auto xml = deviceManager.createStateXml(); std::unique_ptr<XmlElement> xml (deviceManager.createStateXml());
settings->setValue ("audioSetup", xml.get()); settings->setValue ("audioSetup", xml.get());
@ -305,7 +314,7 @@ public:
if (settings != nullptr) if (settings != nullptr)
{ {
savedState = settings->getXmlValue ("audioSetup"); savedState.reset (settings->getXmlValue ("audioSetup"));
#if ! (JUCE_IOS || JUCE_ANDROID) #if ! (JUCE_IOS || JUCE_ANDROID)
shouldMuteInput.setValue (settings->getBoolValue ("shouldMuteInput", true)); shouldMuteInput.setValue (settings->getBoolValue ("shouldMuteInput", true));
@ -397,13 +406,12 @@ public:
// avoid feedback loop by default // avoid feedback loop by default
bool processorHasPotentialFeedbackLoop = true; bool processorHasPotentialFeedbackLoop = true;
std::atomic<bool> muteInput { true };
Value shouldMuteInput; Value shouldMuteInput;
AudioBuffer<float> emptyBuffer; AudioBuffer<float> emptyBuffer;
bool autoOpenMidiDevices; bool autoOpenMidiDevices;
std::unique_ptr<AudioDeviceManager::AudioDeviceSetup> options; std::unique_ptr<AudioDeviceManager::AudioDeviceSetup> options;
Array<MidiDeviceInfo> lastMidiDevices; StringArray lastMidiDevices;
private: private:
//============================================================================== //==============================================================================
@ -412,12 +420,14 @@ private:
public: public:
SettingsComponent (StandalonePluginHolder& pluginHolder, SettingsComponent (StandalonePluginHolder& pluginHolder,
AudioDeviceManager& deviceManagerToUse, AudioDeviceManager& deviceManagerToUse,
int minAudioInputChannels,
int maxAudioInputChannels, int maxAudioInputChannels,
int minAudioOutputChannels,
int maxAudioOutputChannels) int maxAudioOutputChannels)
: owner (pluginHolder), : owner (pluginHolder),
deviceSelector (deviceManagerToUse, deviceSelector (deviceManagerToUse,
0, maxAudioInputChannels, minAudioInputChannels, maxAudioInputChannels,
0, maxAudioOutputChannels, minAudioOutputChannels, maxAudioOutputChannels,
true, true,
(pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()), (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()),
true, false), true, false),
@ -482,7 +492,9 @@ private:
int numOutputChannels, int numOutputChannels,
int numSamples) override int numSamples) override
{ {
if (muteInput) const bool inputMuted = shouldMuteInput.getValue();
if (inputMuted)
{ {
emptyBuffer.clear(); emptyBuffer.clear();
inputChannelData = emptyBuffer.getArrayOfReadPointers(); inputChannelData = emptyBuffer.getArrayOfReadPointers();
@ -514,7 +526,7 @@ private:
const AudioDeviceManager::AudioDeviceSetup* preferredSetupOptions) const AudioDeviceManager::AudioDeviceSetup* preferredSetupOptions)
{ {
deviceManager.addAudioCallback (this); deviceManager.addAudioCallback (this);
deviceManager.addMidiInputDeviceCallback ({}, &player); deviceManager.addMidiInputCallback ({}, &player);
reloadAudioDeviceState (enableAudioInput, preferredDefaultDeviceName, preferredSetupOptions); reloadAudioDeviceState (enableAudioInput, preferredDefaultDeviceName, preferredSetupOptions);
} }
@ -523,25 +535,23 @@ private:
{ {
saveAudioDeviceState(); saveAudioDeviceState();
deviceManager.removeMidiInputDeviceCallback ({}, &player); deviceManager.removeMidiInputCallback ({}, &player);
deviceManager.removeAudioCallback (this); deviceManager.removeAudioCallback (this);
} }
void timerCallback() override void timerCallback() override
{ {
auto newMidiDevices = MidiInput::getAvailableDevices(); auto newMidiDevices = MidiInput::getDevices();
if (newMidiDevices != lastMidiDevices) if (newMidiDevices != lastMidiDevices)
{ {
for (auto& oldDevice : lastMidiDevices) for (auto& oldDevice : lastMidiDevices)
if (! newMidiDevices.contains (oldDevice)) if (! newMidiDevices.contains (oldDevice))
deviceManager.setMidiInputDeviceEnabled (oldDevice.identifier, false); deviceManager.setMidiInputEnabled (oldDevice, false);
for (auto& newDevice : newMidiDevices) for (auto& newDevice : newMidiDevices)
if (! lastMidiDevices.contains (newDevice)) if (! lastMidiDevices.contains (newDevice))
deviceManager.setMidiInputDeviceEnabled (newDevice.identifier, true); deviceManager.setMidiInputEnabled (newDevice, true);
lastMidiDevices = newMidiDevices;
} }
} }
@ -559,7 +569,8 @@ private:
@tags{Audio} @tags{Audio}
*/ */
class StandaloneFilterWindow : public DocumentWindow, class StandaloneFilterWindow : public DocumentWindow,
public Button::Listener public Button::Listener,
public MenuBarModel
{ {
public: public:
//============================================================================== //==============================================================================
@ -584,20 +595,26 @@ public:
bool autoOpenMidiDevices = true bool autoOpenMidiDevices = true
#endif #endif
) )
: DocumentWindow ("", Colours::black, DocumentWindow::minimiseButton | DocumentWindow::closeButton), : DocumentWindow (title, Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f), DocumentWindow::minimiseButton | DocumentWindow::closeButton)
optionsButton ("Options") , menuBar(this)
#if ! JUCE_MAC
, optionsButton ("Settings")
#endif
{ {
#if JUCE_IOS || JUCE_ANDROID #if JUCE_IOS || JUCE_ANDROID
setTitleBarHeight (0); setTitleBarHeight (0);
#else #else
setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false); setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false);
#if JUCE_MAC
// setUsingNativeTitleBar(true); #if JUCE_MAC
/* todo menu bar */ setUsingNativeTitleBar(true);
#endif menu.addItem (1, TRANS("Audio/MIDI Settings..."));
MenuBarModel::setMacMainMenu (this, &menu);
#else
Component::addAndMakeVisible (optionsButton); Component::addAndMakeVisible (optionsButton);
optionsButton.addListener (this); optionsButton.addListener (this);
optionsButton.setTriggeredOnMouseDown (true); optionsButton.setTriggeredOnMouseDown (true);
#endif
#endif #endif
pluginHolder.reset (new StandalonePluginHolder (settingsToUse, takeOwnershipOfSettings, pluginHolder.reset (new StandalonePluginHolder (settingsToUse, takeOwnershipOfSettings,
@ -608,7 +625,6 @@ public:
setFullScreen (true); setFullScreen (true);
setContentOwned (new MainContentComponent (*this), false); setContentOwned (new MainContentComponent (*this), false);
#else #else
setContentOwned (new MainContentComponent (*this), true); setContentOwned (new MainContentComponent (*this), true);
if (auto* props = pluginHolder->settings.get()) if (auto* props = pluginHolder->settings.get())
@ -628,8 +644,11 @@ public:
#endif #endif
} }
~StandaloneFilterWindow() override ~StandaloneFilterWindow()
{ {
#if JUCE_MAC
setMacMainMenu(nullptr);
#endif
#if (! JUCE_IOS) && (! JUCE_ANDROID) #if (! JUCE_IOS) && (! JUCE_ANDROID)
if (auto* props = pluginHolder->settings.get()) if (auto* props = pluginHolder->settings.get())
{ {
@ -637,6 +656,7 @@ public:
props->setValue ("windowY", getY()); props->setValue ("windowY", getY());
} }
#endif #endif
pluginHolder->stopPlaying(); pluginHolder->stopPlaying();
clearContentComponent(); clearContentComponent();
pluginHolder = nullptr; pluginHolder = nullptr;
@ -669,10 +689,34 @@ public:
JUCEApplicationBase::quit(); JUCEApplicationBase::quit();
} }
StringArray getMenuBarNames() override
{
// StringArray menuBarNames;
// menuBarNames.add("Options");
// return menuBarNames;
const char *menuNames[] = { 0 };
return StringArray (menuNames);
}
PopupMenu getMenuForIndex (int topLevelMenuIndex, const String& menuName) override
{
PopupMenu m;
// m.addItem (1, TRANS("Audio Settings..."));
// m.addSeparator();
return m;
}
void menuItemSelected (int menuItemID, int topLevelMenuIndex) override
{
handleMenuResult(menuItemID);
}
void menuBarActivated (bool isActive) override {};
void buttonClicked (Button*) override void buttonClicked (Button*) override
{ {
pluginHolder->showAudioSettingsDialog();
/*
PopupMenu m; PopupMenu m;
m.addItem (1, TRANS("Audio/MIDI Settings...")); m.addItem (1, TRANS("Audio/MIDI Settings..."));
m.addSeparator(); m.addSeparator();
@ -683,7 +727,6 @@ public:
m.showMenuAsync (PopupMenu::Options(), m.showMenuAsync (PopupMenu::Options(),
ModalCallbackFunction::forComponent (menuCallback, this)); ModalCallbackFunction::forComponent (menuCallback, this));
*/
} }
void handleMenuResult (int result) void handleMenuResult (int result)
@ -707,12 +750,16 @@ public:
void resized() override void resized() override
{ {
DocumentWindow::resized(); DocumentWindow::resized();
#if ! JUCE_MAC
optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8);
#endif
} }
virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); } virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); }
std::unique_ptr<StandalonePluginHolder> pluginHolder; std::unique_ptr<StandalonePluginHolder> pluginHolder;
MenuBarComponent menuBar;
PopupMenu menu;
private: private:
//============================================================================== //==============================================================================
@ -724,8 +771,7 @@ private:
public: public:
MainContentComponent (StandaloneFilterWindow& filterWindow) MainContentComponent (StandaloneFilterWindow& filterWindow)
: owner (filterWindow), notification (this), : owner (filterWindow), notification (this),
editor (owner.getAudioProcessor()->hasEditor() ? owner.getAudioProcessor()->createEditorIfNeeded() editor (owner.getAudioProcessor()->createEditorIfNeeded())
: new GenericAudioProcessorEditor (*owner.getAudioProcessor()))
{ {
Value& inputMutedValue = owner.pluginHolder->getMuteInputValue(); Value& inputMutedValue = owner.pluginHolder->getMuteInputValue();
@ -748,7 +794,7 @@ private:
inputMutedChanged (shouldShowNotification); inputMutedChanged (shouldShowNotification);
} }
~MainContentComponent() override ~MainContentComponent()
{ {
if (editor != nullptr) if (editor != nullptr)
{ {
@ -765,9 +811,7 @@ private:
if (shouldShowNotification) if (shouldShowNotification)
notification.setBounds (r.removeFromTop (NotificationArea::height)); notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr) editor->setBounds (r);
editor->setBounds (editor->getLocalArea (this, r)
.withPosition (r.getTopLeft().transformedBy (editor->getTransform().inverted())));
} }
private: private:
@ -827,13 +871,9 @@ private:
#if JUCE_IOS || JUCE_ANDROID #if JUCE_IOS || JUCE_ANDROID
resized(); resized();
#else #else
if (editor != nullptr) setSize (editor->getWidth(),
{ editor->getHeight()
auto rect = getSizeToContainEditor(); + (shouldShowNotification ? NotificationArea::height : 0));
setSize (rect.getWidth(),
rect.getHeight() + (shouldShowNotification ? NotificationArea::height : 0));
}
#endif #endif
} }
@ -848,23 +888,11 @@ private:
} }
//============================================================================== //==============================================================================
void componentMovedOrResized (Component&, bool, bool) override void componentMovedOrResized (Component&, bool, bool wasResized) override
{ {
if (editor != nullptr) if (wasResized && editor != nullptr)
{ setSize (editor->getWidth(),
auto rect = getSizeToContainEditor(); editor->getHeight() + (shouldShowNotification ? NotificationArea::height : 0));
setSize (rect.getWidth(),
rect.getHeight() + (shouldShowNotification ? NotificationArea::height : 0));
}
}
Rectangle<int> getSizeToContainEditor() const
{
if (editor != nullptr)
return getLocalArea (editor.get(), editor->getLocalBounds());
return {};
} }
//============================================================================== //==============================================================================
@ -877,7 +905,9 @@ private:
}; };
//============================================================================== //==============================================================================
#if ! JUCE_MAC
TextButton optionsButton; TextButton optionsButton;
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow)
}; };

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<JUCERPROJECT id="mxW328" name="Obxd" projectType="audioplug" version="1.5.0" <JUCERPROJECT id="mxW328" name="OB-Xd" projectType="audioplug" version="2.0.0"
bundleIdentifier="com.Datsounds.Obxd" includeBinaryInAppConfig="1" bundleIdentifier="com.discoDSP.Obxd" includeBinaryInAppConfig="1"
buildVST="1" buildVST3="1" buildAU="1" buildRTAS="0" buildAAX="0" buildVST="1" buildVST3="1" buildAU="1" buildRTAS="0" buildAAX="0"
pluginName="OB-Xd" pluginDesc="Emulation of famous OB-X, OB-Xa and OB-8 synths" pluginName="OB-Xd" pluginDesc="Emulation of famous OB-X, OB-Xa and OB-8 synths"
pluginManufacturer="Datsounds" pluginManufacturerCode="Dats" pluginManufacturer="discoDSP" pluginManufacturerCode="DDSP" pluginCode="Obxd"
pluginCode="Obxd" pluginChannelConfigs="{0, 2}" pluginIsSynth="1" pluginChannelConfigs="{0, 2}" pluginIsSynth="1" pluginWantsMidiIn="1"
pluginWantsMidiIn="1" pluginProducesMidiOut="0" pluginSilenceInIsSilenceOut="0" pluginProducesMidiOut="0" pluginSilenceInIsSilenceOut="0" pluginEditorRequiresKeys="0"
pluginEditorRequiresKeys="0" pluginAUExportPrefix="" pluginRTASCategory="2048" pluginAUExportPrefix="" pluginRTASCategory="2048" aaxIdentifier=""
aaxIdentifier="" pluginAAXCategory="" jucerVersion="5.4.4" companyName="2Dat" pluginAAXCategory="" jucerVersion="5.4.4" companyName="discoDSP"
companyWebsite="https://www.discodsp.com/obxd/" companyEmail="" companyWebsite="https://www.discodsp.com/" companyEmail="" buildAUv3="0"
buildAUv3="0" pluginIsMidiEffectPlugin="0" pluginFormats="buildAU,buildStandalone,buildVST,buildVST3" pluginIsMidiEffectPlugin="0" pluginFormats="buildAU,buildStandalone,buildVST,buildVST3"
pluginCharacteristicsValue="pluginIsSynth,pluginWantsMidiIn" pluginCharacteristicsValue="pluginIsSynth,pluginWantsMidiIn"
buildStandalone="1" enableIAA="0"> buildStandalone="1" enableIAA="0">
<MAINGROUP id="NZ3n4V" name="Obxd"> <MAINGROUP id="NZ3n4V" name="OB-Xd">
<GROUP id="{90740217-84AB-FD0D-FBC4-CA9EA2C68D5E}" name="Source"> <GROUP id="{90740217-84AB-FD0D-FBC4-CA9EA2C68D5E}" name="Source">
<GROUP id="{5F0B15D1-4D92-B2FF-5904-9CF4C3CE645F}" name="Images"> <GROUP id="{5F0B15D1-4D92-B2FF-5904-9CF4C3CE645F}" name="Images">
<FILE id="nnY63W" name="appicon.png" compile="0" resource="1" file="Source/Images/appicon.png"/> <FILE id="nnY63W" name="appicon.png" compile="0" resource="1" file="Source/Images/appicon.png"/>
@ -67,47 +67,47 @@
<EXPORTFORMATS> <EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" bigIcon="nnY63W" smallIcon="nnY63W"> <XCODE_MAC targetFolder="Builds/MacOSX" bigIcon="nnY63W" smallIcon="nnY63W">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="Obxd" stripLocalSymbols="0" <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="OB-Xd"
osxCompatibility="10.6 SDK" linkTimeOptimisation="0"/> stripLocalSymbols="0" osxCompatibility="10.6 SDK" linkTimeOptimisation="0"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="Obxd" <CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="OB-Xd"
stripLocalSymbols="1" osxCompatibility="10.6 SDK" linkTimeOptimisation="0" stripLocalSymbols="1" osxCompatibility="10.6 SDK" linkTimeOptimisation="0"
osxArchitecture="64BitIntel"/> osxArchitecture="64BitIntel"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="~/JUCE/modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>
<MODULEPATH id="juce_gui_extra" path="~/JUCE/modules"/> <MODULEPATH id="juce_gui_extra" path="Modules"/>
<MODULEPATH id="juce_gui_basics" path="~/JUCE/modules"/> <MODULEPATH id="juce_gui_basics" path="Modules"/>
<MODULEPATH id="juce_graphics" path="~/JUCE/modules"/> <MODULEPATH id="juce_graphics" path="Modules"/>
<MODULEPATH id="juce_events" path="~/JUCE/modules"/> <MODULEPATH id="juce_events" path="Modules"/>
<MODULEPATH id="juce_data_structures" path="~/JUCE/modules"/> <MODULEPATH id="juce_data_structures" path="Modules"/>
<MODULEPATH id="juce_core" path="~/JUCE/modules"/> <MODULEPATH id="juce_core" path="Modules"/>
<MODULEPATH id="juce_audio_processors" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_processors" path="Modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_plugin_client" path="Modules"/>
<MODULEPATH id="juce_audio_formats" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_formats" path="Modules"/>
<MODULEPATH id="juce_audio_devices" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_devices" path="Modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics" path="Modules"/>
<MODULEPATH id="juce_audio_utils" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_utils" path="Modules"/>
</MODULEPATHS> </MODULEPATHS>
</XCODE_MAC> </XCODE_MAC>
<LINUX_MAKE targetFolder="Builds/LinuxMakefile" extraLinkerFlags="-no-pie"> <LINUX_MAKE targetFolder="Builds/LinuxMakefile" extraLinkerFlags="-no-pie">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION name="Release64" libraryPath="/usr/X11R6/lib/" isDebug="0" optimisation="3" <CONFIGURATION name="Release64" libraryPath="/usr/X11R6/lib/" isDebug="0" optimisation="3"
targetName="Obxd64" linuxArchitecture="-m64"/> targetName="OB-Xd" linuxArchitecture="-m64"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="~/JUCE/modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>
<MODULEPATH id="juce_gui_extra" path="~/JUCE/modules"/> <MODULEPATH id="juce_gui_extra" path="Modules"/>
<MODULEPATH id="juce_gui_basics" path="~/JUCE/modules"/> <MODULEPATH id="juce_gui_basics" path="Modules"/>
<MODULEPATH id="juce_graphics" path="~/JUCE/modules"/> <MODULEPATH id="juce_graphics" path="Modules"/>
<MODULEPATH id="juce_events" path="~/JUCE/modules"/> <MODULEPATH id="juce_events" path="Modules"/>
<MODULEPATH id="juce_data_structures" path="~/JUCE/modules"/> <MODULEPATH id="juce_data_structures" path="Modules"/>
<MODULEPATH id="juce_core" path="~/JUCE/modules"/> <MODULEPATH id="juce_core" path="Modules"/>
<MODULEPATH id="juce_audio_utils" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_utils" path="Modules"/>
<MODULEPATH id="juce_audio_processors" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_processors" path="Modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_plugin_client" path="Modules"/>
<MODULEPATH id="juce_audio_formats" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_formats" path="Modules"/>
<MODULEPATH id="juce_audio_devices" path="~/JUCE/modules"/> <MODULEPATH id="juce_audio_devices" path="Modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics" path="Modules"/>
</MODULEPATHS> </MODULEPATHS>
</LINUX_MAKE> </LINUX_MAKE>
<VS2013 targetFolder="Builds/VisualStudio2013"> <VS2013 targetFolder="Builds/VisualStudio2013">
@ -137,64 +137,66 @@
</VS2013> </VS2013>
<VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W"> <VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" useRuntimeLibDLL="0"/> <CONFIGURATION isDebug="1" name="Debug" useRuntimeLibDLL="0" targetName="OB-Xd"/>
<CONFIGURATION isDebug="0" name="Release32" useRuntimeLibDLL="0" winArchitecture="Win32"/> <CONFIGURATION isDebug="0" name="Release32" useRuntimeLibDLL="0" winArchitecture="Win32"
<CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64"/> targetName="OB-Xd"/>
<CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64"
targetName="OB-Xd"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="C:\JUCE\modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>
<MODULEPATH id="juce_gui_extra" path="C:\JUCE\modules"/> <MODULEPATH id="juce_gui_extra" path="Modules"/>
<MODULEPATH id="juce_gui_basics" path="C:\JUCE\modules"/> <MODULEPATH id="juce_gui_basics" path="Modules"/>
<MODULEPATH id="juce_graphics" path="C:\JUCE\modules"/> <MODULEPATH id="juce_graphics" path="Modules"/>
<MODULEPATH id="juce_events" path="C:\JUCE\modules"/> <MODULEPATH id="juce_events" path="Modules"/>
<MODULEPATH id="juce_data_structures" path="C:\JUCE\modules"/> <MODULEPATH id="juce_data_structures" path="Modules"/>
<MODULEPATH id="juce_core" path="C:\JUCE\modules"/> <MODULEPATH id="juce_core" path="Modules"/>
<MODULEPATH id="juce_audio_utils" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_utils" path="Modules"/>
<MODULEPATH id="juce_audio_processors" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_processors" path="Modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_plugin_client" path="Modules"/>
<MODULEPATH id="juce_audio_formats" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_formats" path="Modules"/>
<MODULEPATH id="juce_audio_devices" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_devices" path="Modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics" path="Modules"/>
</MODULEPATHS> </MODULEPATHS>
</VS2019> </VS2019>
<VS2017 targetFolder="Builds/VisualStudio2017"> <VS2017 targetFolder="Builds/VisualStudio2017">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/> <CONFIGURATION isDebug="1" name="Debug" targetName="OB-Xd"/>
<CONFIGURATION isDebug="0" name="Release32" winArchitecture="Win32"/> <CONFIGURATION isDebug="0" name="Release32" winArchitecture="Win32" targetName="OB-Xd"/>
<CONFIGURATION isDebug="0" name="Release64" winArchitecture="x64"/> <CONFIGURATION isDebug="0" name="Release64" winArchitecture="x64" targetName="OB-Xd"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="C:\JUCE\modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>
<MODULEPATH id="juce_gui_extra" path="C:\JUCE\modules"/> <MODULEPATH id="juce_gui_extra" path="Modules"/>
<MODULEPATH id="juce_gui_basics" path="C:\JUCE\modules"/> <MODULEPATH id="juce_gui_basics" path="Modules"/>
<MODULEPATH id="juce_graphics" path="C:\JUCE\modules"/> <MODULEPATH id="juce_graphics" path="Modules"/>
<MODULEPATH id="juce_events" path="C:\JUCE\modules"/> <MODULEPATH id="juce_events" path="Modules"/>
<MODULEPATH id="juce_data_structures" path="C:\JUCE\modules"/> <MODULEPATH id="juce_data_structures" path="Modules"/>
<MODULEPATH id="juce_core" path="C:\JUCE\modules"/> <MODULEPATH id="juce_core" path="Modules"/>
<MODULEPATH id="juce_audio_utils" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_utils" path="Modules"/>
<MODULEPATH id="juce_audio_processors" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_processors" path="Modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_plugin_client" path="Modules"/>
<MODULEPATH id="juce_audio_formats" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_formats" path="Modules"/>
<MODULEPATH id="juce_audio_devices" path="C:\JUCE\modules"/> <MODULEPATH id="juce_audio_devices" path="Modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics" path="Modules"/>
</MODULEPATHS> </MODULEPATHS>
</VS2017> </VS2017>
</EXPORTFORMATS> </EXPORTFORMATS>
<MODULES> <MODULES>
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="0" <MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="0"
useGlobalPath="1"/> useGlobalPath="0"/>
<MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
<MODULES id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/> <MODULES id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
</MODULES> </MODULES>
<JUCEOPTIONS JUCE_QUICKTIME="disabled" JUCE_WEB_BROWSER="0"/> <JUCEOPTIONS JUCE_QUICKTIME="disabled" JUCE_WEB_BROWSER="0"/>
<LIVE_SETTINGS> <LIVE_SETTINGS>

View file

@ -23,38 +23,73 @@
*/ */
#pragma once #pragma once
#include "../Source/Engine/SynthEngine.h" #include "../Source/Engine/SynthEngine.h"
class ButtonList : public ComboBox{
private : class ButtonList : public ComboBox
int count; {
Image kni;
int w2,h2;
public: public:
ButtonList(Image k,int fh) :ComboBox("cb") ButtonList (Image k, int fh) : ComboBox("cb")
{ {
kni = k; kni = k;
count = 0; count = 0;
h2 =fh; h2 = fh;
w2 = k.getWidth(); w2 = k.getWidth();
} }
//int addItem //int addItem
void addChoise(String name)
// Source: https://git.iem.at/audioplugins/IEMPluginSuite/-/blob/master/resources/customComponents/ReverseSlider.h
public:
class ButtonListAttachment : public juce::AudioProcessorValueTreeState::ComboBoxAttachment
{
public:
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
ButtonList& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl)
{
buttonListToControl.setParameter (stateToControl.getParameter (parameterID));
}
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
ComboBox& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl)
{
}
virtual ~ButtonListAttachment() = default;
};
void setParameter (const AudioProcessorParameter* p)
{
if (parameter == p)
return;
parameter = p;
repaint();
}
void addChoice (String name)
{ {
addItem(name,++count); addItem (name, ++count);
} }
float getValue() float getValue()
{ {
return ((getSelectedId()-1)/ (float)(count-1)); return ((getSelectedId() - 1) / (float) (count - 1));
}
void setValue(float val,NotificationType notify)
{
setSelectedId((int)(val*(count -1) + 1),notify);
}
void paintOverChildren(Graphics& g)
{
int ofs = getSelectedId()-1;
g.drawImage(kni, 0, 0, getWidth(), getHeight(),
0, h2*ofs, w2, h2);
} }
void setValue (float val, NotificationType notify)
{
setSelectedId ((int) (val * (count - 1) + 1), notify);
}
void paintOverChildren (Graphics& g) override
{
int ofs = getSelectedId() - 1;
g.drawImage(kni, 0, 0, getWidth(), getHeight(), 0, h2 * ofs, w2, h2);
}
private:
int count;
Image kni;
int w2, h2;
const AudioProcessorParameter* parameter {nullptr};
}; };

View file

@ -2,7 +2,7 @@
============================================================================== ==============================================================================
This file is part of Obxd synthesizer. This file is part of Obxd synthesizer.
Copyright © 2013-2014 Filatov Vadim Copyright <EFBFBD> 2013-2014 Filatov Vadim
Contact author via email : Contact author via email :
justdat_@_e1.ru justdat_@_e1.ru
@ -23,6 +23,7 @@
*/ */
#pragma once #pragma once
#include "../Source/Engine/SynthEngine.h" #include "../Source/Engine/SynthEngine.h"
class Knob : public Slider class Knob : public Slider
{ {
public: public:
@ -33,23 +34,54 @@ public:
// setSliderStyle(RotaryVerticalDrag); // setSliderStyle(RotaryVerticalDrag);
// setRange(0.0f, 1.0f, 0.001f); // setRange(0.0f, 1.0f, 0.001f);
//} //}
Knob(Image k,int fh) : Slider("Knob") Knob (Image k, int fh) : Slider("Knob")
{ {
h2 =fh; h2 = fh;
w2 = k.getWidth(); w2 = k.getWidth();
numFr = k.getHeight() / h2; numFr = k.getHeight() / h2;
kni = k; kni = k;
}; };
void paint(Graphics& g) // Source: https://git.iem.at/audioplugins/IEMPluginSuite/-/blob/master/resources/customComponents/ReverseSlider.h
{ public:
int ofs = (int)((getValue() - getMinimum()) / (getMaximum() - getMinimum()) * (numFr - 1)); class KnobAttachment : public juce::AudioProcessorValueTreeState::SliderAttachment
g.drawImage(kni, 0, 0, getWidth(), getHeight(), {
0, h2*ofs, w2, h2); public:
KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
Knob& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl)
{
sliderToControl.setParameter (stateToControl.getParameter (parameterID));
}
KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
Slider& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl)
{
}
virtual ~KnobAttachment() = default;
};
void setParameter (const AudioProcessorParameter* p)
{
if (parameter == p)
return;
parameter = p;
updateText();
repaint();
}
void paint (Graphics& g) override
{
int ofs = (int) ((getValue() - getMinimum()) / (getMaximum() - getMinimum()) * (numFr - 1));
g.drawImage (kni, 0, 0, getWidth(), getHeight(), 0, h2 * ofs, w2, h2);
} }
private: private:
Image kni; Image kni;
int fh,numFr; int fh, numFr;
int w2,h2; int w2, h2;
const AudioProcessorParameter* parameter {nullptr};
}; };

View file

@ -2,7 +2,7 @@
============================================================================== ==============================================================================
This file is part of Obxd synthesizer. This file is part of Obxd synthesizer.
Copyright © 2013-2014 Filatov Vadim Copyright <EFBFBD> 2013-2014 Filatov Vadim
Contact author via email : Contact author via email :
justdat_@_e1.ru justdat_@_e1.ru
@ -23,24 +23,55 @@
*/ */
#pragma once #pragma once
#include "../Source/Engine/SynthEngine.h" #include "../Source/Engine/SynthEngine.h"
class TooglableButton : public ImageButton
class TooglableButton : public ImageButton
{ {
public: public:
bool toogled; TooglableButton (Image k) : ImageButton()
TooglableButton(Image k) :ImageButton()
{ {
//this->setImages //this->setImages
kni = k; kni = k;
toogled = false; toogled = false;
width = kni.getWidth(); width = kni.getWidth();
height = kni.getHeight(); height = kni.getHeight();
w2=width; w2 = width;
h2 = height / 2; h2 = height / 2;
this->setClickingTogglesState(true); this->setClickingTogglesState (true);
} }
void clicked()
// Source: https://git.iem.at/audioplugins/IEMPluginSuite/-/blob/master/resources/customComponents/ReverseSlider.h
public:
class ToggleAttachment : public juce::AudioProcessorValueTreeState::ButtonAttachment
{
public:
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
TooglableButton& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl)
{
buttonToControl.setParameter (stateToControl.getParameter (parameterID));
}
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
const juce::String& parameterID,
Button& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl)
{
}
virtual ~ToggleAttachment() = default;
};
void setParameter (const AudioProcessorParameter* p)
{
if (parameter == p)
return;
parameter = p;
repaint();
}
void clicked() override
{ {
toogled = !toogled; toogled = ! toogled;
//this->setColour(1,Colours::blue); //this->setColour(1,Colours::blue);
//if(toogled) //if(toogled)
// this->setColour(TextButton::ColourIds::buttonColourId,Colours::lightgreen); // this->setColour(TextButton::ColourIds::buttonColourId,Colours::lightgreen);
@ -50,34 +81,43 @@ public:
Button::clicked(); Button::clicked();
}; };
void paintButton(Graphics& g, bool isMouseOverButton, bool isButtonDown)
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
{ {
int offset = 0; int offset = 0;
if (toogled) if (toogled)
{ {
offset = 1; offset = 1;
} }
g.drawImage(kni, 0, 0, getWidth(), getHeight(),
0, offset *h2, w2,h2); g.drawImage(kni, 0, 0, getWidth(), getHeight(), 0, offset * h2, w2, h2);
} }
void setValue(float state,int notify)
void setValue (float state, int notify)
{ {
if(state > 0.5) if (state > 0.5)
toogled = true; toogled = true;
else toogled = false; else toogled = false;
repaint(); repaint();
} }
float getValue() float getValue()
{ {
if(toogled) if (toogled)
return 1; return 1;
else return 0; else return 0;
} }
//void paint(Graphics& g) //void paint(Graphics& g)
//{ //{
// g.drawImageTransformed(kni,AffineTransform::rotation(((getValue() - getMinimum())/(getMaximum() - getMinimum()))*float_Pi - float_Pi*2)); // g.drawImageTransformed(kni,AffineTransform::rotation(((getValue() - getMinimum())/(getMaximum() - getMinimum()))*float_Pi - float_Pi*2));
//} //}
bool toogled;
private: private:
Image kni; Image kni;
int width,height,w2,h2; int width, height, w2, h2;
const AudioProcessorParameter* parameter {nullptr};
}; };

View file

@ -14,619 +14,466 @@ It contains the basic startup code for a Juce application.
//============================================================================== //==============================================================================
ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor* ownerFilter) ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFilter)
: AudioProcessorEditor (ownerFilter) : AudioProcessorEditor (&ownerFilter), processor (ownerFilter)
{ {
rebuildComponents(); rebuildComponents (processor);
} }
ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor() ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor()
{ {
getFilter()->removeChangeListener(this); processor.removeChangeListener (this);
// deleteAllChildren(); // WATCH OUT!
deleteAllChildren();
} }
void ObxdAudioProcessorEditor::placeLabel(int x , int y , String text) void ObxdAudioProcessorEditor::placeLabel (int x, int y, String text)
{ {
Label* lab = new Label(); Label* lab = new Label();
lab->setBounds(x,y,110,20); lab->setBounds (x, y, 110, 20);
lab->setJustificationType(Justification::centred); lab->setJustificationType (Justification::centred);
lab->setText(text,dontSendNotification);lab->setInterceptsMouseClicks(false,true); lab->setText (text,dontSendNotification);
addAndMakeVisible(lab); lab->setInterceptsMouseClicks (false, true);
addAndMakeVisible (lab);
} }
ButtonList* ObxdAudioProcessorEditor::addNormalButtonList(int x, int y,int width, ObxdAudioProcessor* filter, int parameter,String name,Image img) ButtonList* ObxdAudioProcessorEditor::addNormalButtonList (int x, int y, int width, ObxdAudioProcessor& filter, int parameter, String /*name*/, Image img)
{ {
ButtonList *bl = new ButtonList(img,24); ButtonList *bl = new ButtonList (img, 24);
bl->setBounds(x, y, width, 24); bl->setBounds (x, y, width, 24);
//bl->setValue(filter->getParameter(parameter),dontSendNotification); //bl->setValue(filter->getParameter(parameter),dontSendNotification);
addAndMakeVisible(bl); addAndMakeVisible (bl);
bl->addListener (this); // bl->addListener (this);
return bl; return bl;
} }
Knob* ObxdAudioProcessorEditor::addNormalKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) Knob* ObxdAudioProcessorEditor::addNormalKnob (int x, int y, ObxdAudioProcessor& filter, int parameter, String /*name*/, float defval)
{ {
Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knoblsd_png,BinaryData::knoblsd_pngSize),48); Knob* knob = new Knob (ImageCache::getFromMemory (BinaryData::knoblsd_png, BinaryData::knoblsd_pngSize), 48);
//Label* knobl = new Label(); //Label* knobl = new Label();
knob->setSliderStyle(Slider::RotaryVerticalDrag); knob->setSliderStyle (Slider::RotaryVerticalDrag);
knob->setTextBoxStyle(knob->NoTextBox,true,0,0); knob->setTextBoxStyle (knob->NoTextBox, true, 0, 0);
knob->setRange(0,1); knob->setRange (0, 1);
addAndMakeVisible(knob); addAndMakeVisible (knob);
//addAndMakeVisible(knobl); //addAndMakeVisible(knobl);
knob->setBounds(x, y, 48,48); knob->setBounds (x, y, 48, 48);
knob->setValue(filter->getParameter(parameter),dontSendNotification); // knob->setValue (filter.getParameter (parameter), dontSendNotification);
//knobl->setJustificationType(Justification::centred); //knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true); //knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+40,60,10); //knobl->setBounds(x-10,y+40,60,10);
//knobl->setText(name,dontSendNotification); //knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable(false); knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue(true,defval); knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this); // knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*knob));
return knob; return knob;
} }
Knob* ObxdAudioProcessorEditor::addNormalKnobClassic(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) Knob* ObxdAudioProcessorEditor::addNormalKnobClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String /*name*/, float defval)
{ {
Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knoblsd_png,BinaryData::knoblsd_pngSize),48); Knob* knob = new Knob (ImageCache::getFromMemory (BinaryData::knoblsd_png, BinaryData::knoblsd_pngSize), 48);
//Label* knobl = new Label(); //Label* knobl = new Label();
knob->setSliderStyle(Slider::RotaryVerticalDrag); knob->setSliderStyle (Slider::RotaryVerticalDrag);
knob->setTextBoxStyle(knob->NoTextBox,true,0,0); knob->setTextBoxStyle (knob->NoTextBox, true, 0, 0);
knob->setRange(0,1); knob->setRange (0, 1);
addAndMakeVisible(knob); addAndMakeVisible (knob);
//addAndMakeVisible(knobl); //addAndMakeVisible(knobl);
knob->setBounds(x+2, y, 42,42); knob->setBounds (x+2, y, 42, 42);
knob->setValue(filter->getParameter(parameter),dontSendNotification); // knob->setValue(filter.getParameter(parameter),dontSendNotification);
//knobl->setJustificationType(Justification::centred); //knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true); //knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+40,60,10); //knobl->setBounds(x-10,y+40,60,10);
//knobl->setText(name,dontSendNotification); //knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable(false); knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue(true,defval); knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this); // knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*knob));
return knob; return knob;
} }
Knob* ObxdAudioProcessorEditor::addTinyKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) Knob* ObxdAudioProcessorEditor::addTinyKnob (int x, int y, ObxdAudioProcessor& filter, int parameter, String /*name*/, float defval)
{ {
//Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knobssd_png,BinaryData::knobssd_pngSize),42); //Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knobssd_png,BinaryData::knobssd_pngSize),42);
Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knoblsd_png,BinaryData::knoblsd_pngSize),48); Knob* knob = new Knob (ImageCache::getFromMemory (BinaryData::knoblsd_png, BinaryData::knoblsd_pngSize), 48);
//Label* knobl = new Label(); //Label* knobl = new Label();
knob->setSliderStyle(Slider::RotaryVerticalDrag); knob->setSliderStyle (Slider::RotaryVerticalDrag);
knob->setTextBoxStyle(knob->NoTextBox,true,0,0); knob->setTextBoxStyle (knob->NoTextBox, true, 0, 0);
knob->setRange(0,1); knob->setRange (0, 1);
addAndMakeVisible(knob); addAndMakeVisible (knob);
//addAndMakeVisible(knobl); //addAndMakeVisible(knobl);
knob->setBounds(x, y, 36,36); knob->setBounds (x, y, 36, 36);
knob->setValue(filter->getParameter(parameter),dontSendNotification); // knob->setValue(filter.getParameter(parameter),dontSendNotification);
//knobl->setJustificationType(Justification::centred); //knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true); //knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+25,50,10); //knobl->setBounds(x-10,y+25,50,10);
//knobl->setText(name,dontSendNotification); //knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable(false); knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue(true,defval); knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this); // knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*knob));
return knob; return knob;
} }
TooglableButton* ObxdAudioProcessorEditor::addNormalTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name) TooglableButton* ObxdAudioProcessorEditor::addNormalTooglableButton (int x, int y, ObxdAudioProcessor& filter, int parameter, String name)
{ {
TooglableButton* button = new TooglableButton(ImageCache::getFromMemory(BinaryData::button_png,BinaryData::button_pngSize)); TooglableButton* button = new TooglableButton (ImageCache::getFromMemory (BinaryData::button_png, BinaryData::button_pngSize));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel); // button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible(button); addAndMakeVisible (button);
button->setBounds(x,y,19,35); button->setBounds (x, y, 19, 35);
button->setButtonText(name); button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0); // button->setValue(filter.getParameter(parameter),0);
button->addListener(this); // button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*button));
return button; return button;
} }
TooglableButton* ObxdAudioProcessorEditor::addTinyTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name) TooglableButton* ObxdAudioProcessorEditor::addTinyTooglableButton (int x, int y, ObxdAudioProcessor& filter, int parameter, String name)
{ {
TooglableButton* button = new TooglableButton(ImageCache::getFromMemory(BinaryData::button_png,BinaryData::button_pngSize)); TooglableButton* button = new TooglableButton (ImageCache::getFromMemory (BinaryData::button_png, BinaryData::button_pngSize));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel); // button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible(button); addAndMakeVisible (button);
button->setBounds(x,y,20,20); button->setBounds (x, y, 20, 20);
button->setButtonText(name); button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0); // button->setValue(filter.getParameter(parameter),0);
button->addListener(this); // button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*button));
return button; return button;
} }
ButtonList* ObxdAudioProcessorEditor::addNormalButtonListClassic(int x, int y,int width, ObxdAudioProcessor* filter, int parameter,String name,Image img) ButtonList* ObxdAudioProcessorEditor::addNormalButtonListClassic (int x, int y, int width, ObxdAudioProcessor& filter, int parameter, String /*name*/, Image img)
{ {
ButtonList *bl = new ButtonList(img,32); ButtonList *bl = new ButtonList (img, 32);
bl->setBounds(x, y, width, 32); bl->setBounds (x, y, width, 32);
//bl->setValue(filter->getParameter(parameter),dontSendNotification); //bl->setValue(filter->getParameter(parameter),dontSendNotification);
addAndMakeVisible(bl); addAndMakeVisible (bl);
bl->addListener (this); // bl->addListener (this);
buttonListAttachments.add (new ButtonList::ButtonListAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*bl));
return bl; return bl;
} }
Knob* ObxdAudioProcessorEditor::addTinyKnobClassic(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval) Knob* ObxdAudioProcessorEditor::addTinyKnobClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String /*name*/, float defval)
{ {
Knob* knob = new Knob(ImageCache::getFromMemory(BinaryData::knoblsd_png,BinaryData::knoblsd_pngSize),48); Knob* knob = new Knob (ImageCache::getFromMemory (BinaryData::knoblsd_png, BinaryData::knoblsd_pngSize), 48);
//Label* knobl = new Label(); //Label* knobl = new Label();
knob->setSliderStyle(Slider::RotaryVerticalDrag); knob->setSliderStyle (Slider::RotaryVerticalDrag);
knob->setTextBoxStyle(knob->NoTextBox,true,0,0); knob->setTextBoxStyle (knob->NoTextBox, true, 0, 0);
knob->setRange(0,1); knob->setRange (0, 1);
addAndMakeVisible(knob); addAndMakeVisible (knob);
//addAndMakeVisible(knobl); //addAndMakeVisible(knobl);
knob->setBounds(x+3, y+3, 36,36); knob->setBounds (x+3, y+3, 36, 36);
knob->setValue(filter->getParameter(parameter),dontSendNotification); // knob->setValue(filter.getParameter(parameter),dontSendNotification);
//knobl->setJustificationType(Justification::centred); //knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true); //knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+25,50,10); //knobl->setBounds(x-10,y+25,50,10);
//knobl->setText(name,dontSendNotification); //knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable(false); knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue(true,defval); knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this); // knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*knob));
return knob; return knob;
} }
TooglableButton* ObxdAudioProcessorEditor::addNormalTooglableButtonClassic(int x , int y , ObxdAudioProcessor* filter,int parameter,String name) TooglableButton* ObxdAudioProcessorEditor::addNormalTooglableButtonClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String name)
{ {
TooglableButton* button = new TooglableButton(ImageCache::getFromFile(skinFolder.getChildFile("button.png"))); TooglableButton* button = new TooglableButton (ImageCache::getFromFile (skinFolder.getChildFile ("button.png")));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel); // button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible(button); addAndMakeVisible (button);
button->setBounds(x,y,28,35); button->setBounds (x, y, 28, 35);
button->setButtonText(name); button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0); // button->setValue(filter.getParameter(parameter),0);
button->addListener(this); // button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*button));
return button; return button;
} }
void ObxdAudioProcessorEditor::rebuildComponents() void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilter)
{ {
ObxdAudioProcessor* ownerFilter = getFilter(); skinFolder = ownerFilter.getCurrentSkinFolder();
bool useClassicSkin = skinFolder.getChildFile ("legato.png").existsAsFile();
skinFolder = ownerFilter->getCurrentSkinFolder(); ownerFilter.removeChangeListener (this);
bool useClassicSkin = skinFolder.getChildFile("legato.png").existsAsFile();
ownerFilter->removeChangeListener(this); deleteAllChildren(); // WATCH OUT!
deleteAllChildren();
if (! useClassicSkin) if (! useClassicSkin)
{ {
// This is where our plugin's editor size is set. // This is where our plugin's editor size is set.
setSize (1440, 450); setSize (1440, 450);
cutoffKnob = addNormalKnob(893,77,ownerFilter,CUTOFF,"Cutoff",0.4); cutoffKnob = addNormalKnob (893, 77, ownerFilter, CUTOFF, "Cutoff", 0.4);
resonanceKnob = addNormalKnob(990,77,ownerFilter,RESONANCE,"Resonance",0); resonanceKnob = addNormalKnob (990, 77, ownerFilter, RESONANCE, "Resonance", 0);
filterEnvelopeAmtKnob = addNormalKnob(1088,77,ownerFilter,ENVELOPE_AMT,"Envelope",0); filterEnvelopeAmtKnob = addNormalKnob (1088, 77, ownerFilter, ENVELOPE_AMT, "Envelope", 0);
multimodeKnob = addNormalKnob(990,167,ownerFilter,MULTIMODE,"Multimode",0.5); multimodeKnob = addNormalKnob (990, 167, ownerFilter, MULTIMODE, "Multimode", 0.5);
volumeKnob = addNormalKnob(56,77,ownerFilter,VOLUME,"Volume",0.4); volumeKnob = addNormalKnob (56, 77, ownerFilter, VOLUME, "Volume", 0.4);
portamentoKnob = addNormalKnob(188,77,ownerFilter,PORTAMENTO,"Portamento",0); portamentoKnob = addNormalKnob (188, 77, ownerFilter, PORTAMENTO, "Portamento", 0);
osc1PitchKnob = addNormalKnob(593,77,ownerFilter,OSC1P,"Osc1Pitch",0); osc1PitchKnob = addNormalKnob (593, 77, ownerFilter, OSC1P, "Osc1Pitch", 0);
pulseWidthKnob = addNormalKnob(691,77,ownerFilter,PW,"PW",0); pulseWidthKnob = addNormalKnob (691, 77, ownerFilter, PW, "PW", 0);
osc2PitchKnob = addNormalKnob(788,77,ownerFilter,OSC2P,"Osc2Pitch",0); osc2PitchKnob = addNormalKnob (788, 77, ownerFilter, OSC2P, "Osc2Pitch", 0);
osc1MixKnob = addNormalKnob(597,237,ownerFilter,OSC1MIX,"Osc1",1); osc1MixKnob = addNormalKnob (597, 237, ownerFilter, OSC1MIX, "Osc1", 1);
osc2MixKnob = addNormalKnob(788,237,ownerFilter,OSC2MIX,"Osc2",1); osc2MixKnob = addNormalKnob (788, 237, ownerFilter, OSC2MIX, "Osc2", 1);
noiseMixKnob = addNormalKnob(691,237,ownerFilter,NOISEMIX,"Noise",0); noiseMixKnob = addNormalKnob (691, 237, ownerFilter, NOISEMIX, "Noise", 0);
xmodKnob = addNormalKnob(656,324,ownerFilter,XMOD,"Xmod",0); xmodKnob = addNormalKnob (656, 324, ownerFilter, XMOD, "Xmod", 0);
osc2DetuneKnob = addNormalKnob(800,324,ownerFilter,OSC2_DET,"Detune",0); osc2DetuneKnob = addNormalKnob (800, 324, ownerFilter, OSC2_DET, "Detune", 0);
envPitchModKnob = addNormalKnob(728,324,ownerFilter,ENVPITCH,"PEnv",0); envPitchModKnob = addNormalKnob (728, 324, ownerFilter, ENVPITCH, "PEnv", 0);
brightnessKnob = addNormalKnob(586,324,ownerFilter,BRIGHTNESS,"Bri",1); brightnessKnob = addNormalKnob (586, 324, ownerFilter, BRIGHTNESS, "Bri", 1);
attackKnob = addNormalKnob(1182,165,ownerFilter,LATK,"Atk",0); attackKnob = addNormalKnob (1182, 165, ownerFilter, LATK, "Atk", 0);
decayKnob = addNormalKnob(1246,165,ownerFilter,LDEC,"Dec",0); decayKnob = addNormalKnob (1246, 165, ownerFilter, LDEC, "Dec", 0);
sustainKnob = addNormalKnob(1309,165,ownerFilter,LSUS,"Sus",1); sustainKnob = addNormalKnob (1309, 165, ownerFilter, LSUS, "Sus", 1);
releaseKnob = addNormalKnob(1373,165,ownerFilter,LREL,"Rel",0); releaseKnob = addNormalKnob (1373, 165, ownerFilter, LREL, "Rel", 0);
fattackKnob = addNormalKnob(1182,75,ownerFilter,FATK,"Atk",0); fattackKnob = addNormalKnob (1182, 75, ownerFilter, FATK, "Atk", 0);
fdecayKnob = addNormalKnob(1246,75,ownerFilter,FDEC,"Dec",0); fdecayKnob = addNormalKnob (1246, 75, ownerFilter, FDEC, "Dec", 0);
fsustainKnob = addNormalKnob(1309,75,ownerFilter,FSUS,"Sus",1); fsustainKnob = addNormalKnob (1309, 75, ownerFilter, FSUS, "Sus", 1);
freleaseKnob = addNormalKnob(1373,75,ownerFilter,FREL,"Rel",0); freleaseKnob = addNormalKnob (1373, 75, ownerFilter, FREL, "Rel", 0);
lfoFrequencyKnob = addNormalKnob(293,77,ownerFilter,LFOFREQ,"Freq",0); lfoFrequencyKnob = addNormalKnob (293, 77, ownerFilter, LFOFREQ, "Freq", 0);
lfoAmt1Knob = addNormalKnob(390,77,ownerFilter,LFO1AMT,"Pitch",0); lfoAmt1Knob = addNormalKnob (390, 77, ownerFilter, LFO1AMT, "Pitch", 0);
lfoAmt2Knob = addNormalKnob(488,77,ownerFilter,LFO2AMT,"PWM",0); lfoAmt2Knob = addNormalKnob (488, 77, ownerFilter, LFO2AMT, "PWM", 0);
lfoSinButton = addNormalTooglableButton(309,162,ownerFilter,LFOSINWAVE,"Sin"); lfoSinButton = addNormalTooglableButton (309, 162, ownerFilter, LFOSINWAVE, "Sin");
lfoSquareButton = addNormalTooglableButton(309,252,ownerFilter,LFOSQUAREWAVE,"SQ"); lfoSquareButton = addNormalTooglableButton (309, 252, ownerFilter, LFOSQUAREWAVE, "SQ");
lfoSHButton = addNormalTooglableButton(309,335,ownerFilter,LFOSHWAVE,"S&H"); lfoSHButton = addNormalTooglableButton (309, 335, ownerFilter, LFOSHWAVE, "S&H");
lfoOsc1Button = addNormalTooglableButton(406,162,ownerFilter,LFOOSC1,"Osc1"); lfoOsc1Button = addNormalTooglableButton (406, 162, ownerFilter, LFOOSC1, "Osc1");
lfoOsc2Button = addNormalTooglableButton(406,252,ownerFilter,LFOOSC2,"Osc2"); lfoOsc2Button = addNormalTooglableButton (406, 252, ownerFilter, LFOOSC2, "Osc2");
lfoFilterButton = addNormalTooglableButton(406,335,ownerFilter,LFOFILTER,"Filt"); lfoFilterButton = addNormalTooglableButton (406, 335, ownerFilter, LFOFILTER, "Filt");
lfoPwm1Button = addNormalTooglableButton(504,162,ownerFilter,LFOPW1,"Osc1"); lfoPwm1Button = addNormalTooglableButton (504, 162, ownerFilter, LFOPW1, "Osc1");
lfoPwm2Button = addNormalTooglableButton(504,252,ownerFilter,LFOPW2,"Osc2"); lfoPwm2Button = addNormalTooglableButton (504, 252, ownerFilter, LFOPW2, "Osc2");
hardSyncButton = addNormalTooglableButton(730,162,ownerFilter,OSC2HS,"Sync"); hardSyncButton = addNormalTooglableButton (730, 162, ownerFilter, OSC2HS, "Sync");
osc1SawButton = addNormalTooglableButton(587,162,ownerFilter,OSC1Saw,"S"); osc1SawButton = addNormalTooglableButton (587, 162, ownerFilter, OSC1Saw, "S");
osc2SawButton = addNormalTooglableButton(782,162,ownerFilter,OSC2Saw,"S"); osc2SawButton = addNormalTooglableButton (782, 162, ownerFilter, OSC2Saw, "S");
osc1PulButton = addNormalTooglableButton(632,162,ownerFilter,OSC1Pul,"P"); osc1PulButton = addNormalTooglableButton (632, 162, ownerFilter, OSC1Pul, "P");
osc2PulButton = addNormalTooglableButton(827,162,ownerFilter,OSC2Pul,"P"); osc2PulButton = addNormalTooglableButton (827, 162, ownerFilter, OSC2Pul, "P");
pitchQuantButton = addNormalTooglableButton(684,162,ownerFilter,OSCQuantize,"Step"); pitchQuantButton = addNormalTooglableButton (684, 162, ownerFilter, OSCQuantize, "Step");
filterBPBlendButton = addNormalTooglableButton(1082,162,ownerFilter,BANDPASS,"Bp"); filterBPBlendButton = addNormalTooglableButton (1082, 162, ownerFilter, BANDPASS, "Bp");
fourPoleButton = addNormalTooglableButton(1127,162,ownerFilter,FOURPOLE,"24"); fourPoleButton = addNormalTooglableButton (1127, 162, ownerFilter, FOURPOLE, "24");
filterHQButton = addNormalTooglableButton(932,162,ownerFilter,FILTER_WARM,"HQ"); filterHQButton = addNormalTooglableButton (932, 162, ownerFilter, FILTER_WARM, "HQ");
filterKeyFollowButton = addNormalTooglableButton(887,162,ownerFilter,FLT_KF,"Key"); filterKeyFollowButton = addNormalTooglableButton (887, 162, ownerFilter, FLT_KF, "Key");
unisonButton = addNormalTooglableButton(205,162,ownerFilter,UNISON,"Uni"); unisonButton = addNormalTooglableButton (205, 162, ownerFilter, UNISON, "Uni");
tuneKnob = addNormalKnob(30,252,ownerFilter,TUNE,"Tune",0.5); tuneKnob = addNormalKnob (30, 252, ownerFilter, TUNE, "Tune", 0.5);
transposeKnob = addNormalKnob(90,252,ownerFilter,OCTAVE,"Transpose",0.5); transposeKnob = addNormalKnob (90, 252, ownerFilter, OCTAVE, "Transpose", 0.5);
voiceDetuneKnob =addNormalKnob(188,252,ownerFilter,UDET,"VoiceDet",0); voiceDetuneKnob =addNormalKnob (188, 252, ownerFilter, UDET, "VoiceDet", 0);
bendLfoRateKnob = addTinyKnob(928,300,ownerFilter,BENDLFORATE,"ModRate",0.4); bendLfoRateKnob = addTinyKnob (928, 300, ownerFilter, BENDLFORATE, "ModRate", 0.4);
veloFltEnvKnob = addTinyKnob(1013,300,ownerFilter,VFLTENV,"VFE",0); veloFltEnvKnob = addTinyKnob (1013, 300, ownerFilter, VFLTENV, "VFE", 0);
veloAmpEnvKnob = addTinyKnob(1111,300,ownerFilter,VAMPENV,"VAE",0); veloAmpEnvKnob = addTinyKnob (1111, 300, ownerFilter, VAMPENV, "VAE", 0);
midiLearnButton = addNormalTooglableButton(74,162,ownerFilter,MIDILEARN,"LEA"); midiLearnButton = addNormalTooglableButton (74, 162, ownerFilter, MIDILEARN, "LEA");
midiUnlearnButton = addNormalTooglableButton(122,162,ownerFilter,UNLEARN,"UNL"); midiUnlearnButton = addNormalTooglableButton (122, 162, ownerFilter, UNLEARN, "UNL");
pan1Knob = addTinyKnob(914,368,ownerFilter,PAN1,"1",0.5); pan1Knob = addTinyKnob (914, 368, ownerFilter, PAN1, "1", 0.5);
pan2Knob = addTinyKnob(977,368,ownerFilter,PAN2,"2",0.5); pan2Knob = addTinyKnob (977, 368, ownerFilter, PAN2, "2", 0.5);
pan3Knob = addTinyKnob(1040,368,ownerFilter,PAN3,"3",0.5); pan3Knob = addTinyKnob (1040, 368, ownerFilter, PAN3, "3", 0.5);
pan4Knob = addTinyKnob(1103,368,ownerFilter,PAN4,"4",0.5); pan4Knob = addTinyKnob (1103, 368, ownerFilter, PAN4, "4", 0.5);
pan5Knob = addTinyKnob(1165,368,ownerFilter,PAN5,"5",0.5); pan5Knob = addTinyKnob (1165, 368, ownerFilter, PAN5, "5", 0.5);
pan6Knob = addTinyKnob(1228,368,ownerFilter,PAN6,"6",0.5); pan6Knob = addTinyKnob (1228, 368, ownerFilter, PAN6, "6", 0.5);
pan7Knob = addTinyKnob(1290,368,ownerFilter,PAN7,"7",0.5); pan7Knob = addTinyKnob (1290, 368, ownerFilter, PAN7, "7", 0.5);
pan8Knob = addTinyKnob(1353,368,ownerFilter,PAN8,"8",0.5); pan8Knob = addTinyKnob (1353, 368, ownerFilter, PAN8, "8", 0.5);
bendOsc2OnlyButton = addNormalTooglableButton(228,335,ownerFilter,BENDOSC2,"Osc2"); bendOsc2OnlyButton = addNormalTooglableButton (228, 335, ownerFilter, BENDOSC2, "Osc2");
bendRangeButton = addNormalTooglableButton(183,335,ownerFilter,BENDRANGE,"12"); bendRangeButton = addNormalTooglableButton (183, 335, ownerFilter, BENDRANGE, "12");
asPlayedAllocButton = addNormalTooglableButton(25,162,ownerFilter,ASPLAYEDALLOCATION,"APA"); asPlayedAllocButton = addNormalTooglableButton (25, 162, ownerFilter, ASPLAYEDALLOCATION, "APA");
filterDetuneKnob = addTinyKnob(1228,300,ownerFilter,FILTERDER,"Flt",0.2); filterDetuneKnob = addTinyKnob (1228, 300, ownerFilter, FILTERDER, "Flt", 0.2);
portamentoDetuneKnob = addTinyKnob(1291,300,ownerFilter,PORTADER,"Port",0.2); portamentoDetuneKnob = addTinyKnob (1291, 300, ownerFilter, PORTADER, "Port", 0.2);
envelopeDetuneKnob = addTinyKnob(1353,300,ownerFilter,ENVDER,"Env",0.2); envelopeDetuneKnob = addTinyKnob (1353, 300, ownerFilter, ENVDER, "Env", 0.2);
voiceSwitch = addNormalButtonList(124,338,17,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(BinaryData::voices_png,BinaryData::voices_pngSize)); voiceSwitch = addNormalButtonList (124, 338, 17, ownerFilter, VOICE_COUNT, "VoiceCount", ImageCache::getFromMemory (BinaryData::voices_png, BinaryData::voices_pngSize));
for (int i=1; i <= 32; i++)
voiceSwitch ->addChoise(String(i));
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonList(25,338,65,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(BinaryData::legato_png,BinaryData::legato_pngSize)); for (int i = 1; i <= 32; ++i)
legatoSwitch ->addChoise("Keep All"); {
legatoSwitch ->addChoise("Keep Filter Envelope"); voiceSwitch->addChoice (String (i));
legatoSwitch ->addChoise("Keep Amplitude Envelope"); }
legatoSwitch ->addChoise("Retrig");
legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification); legatoSwitch = addNormalButtonList (25, 338, 65, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromMemory (BinaryData::legato_png, BinaryData::legato_pngSize));
legatoSwitch->addChoice ("Keep All");
legatoSwitch->addChoice ("Keep Filter Envelope");
legatoSwitch->addChoice ("Keep Amplitude Envelope");
legatoSwitch->addChoice ("Retrig");
} }
else else
{ {
// This is where our plugin's editor size is set. // This is where our plugin's editor size is set.
setSize (1087, 442); setSize (1087, 442);
cutoffKnob = addNormalKnobClassic(577,40,ownerFilter,CUTOFF,"Cutoff",0.4); cutoffKnob = addNormalKnobClassic (577, 40, ownerFilter, CUTOFF, "Cutoff", 0.4);
resonanceKnob = addNormalKnobClassic(638,40,ownerFilter,RESONANCE,"Resonance",0); resonanceKnob = addNormalKnobClassic (638, 40, ownerFilter, RESONANCE, "Resonance", 0);
filterEnvelopeAmtKnob = addNormalKnobClassic(699,40,ownerFilter,ENVELOPE_AMT,"Envelope",0); filterEnvelopeAmtKnob = addNormalKnobClassic (699, 40, ownerFilter, ENVELOPE_AMT, "Envelope", 0);
multimodeKnob = addTinyKnobClassic(643,106,ownerFilter,MULTIMODE,"Multimode",0.5); multimodeKnob = addTinyKnobClassic (643, 106, ownerFilter, MULTIMODE, "Multimode", 0.5);
volumeKnob = addNormalKnobClassic(53,120,ownerFilter,VOLUME,"Volume",0.4); volumeKnob = addNormalKnobClassic (53, 120, ownerFilter, VOLUME, "Volume", 0.4);
portamentoKnob = addNormalKnobClassic(175,241,ownerFilter,PORTAMENTO,"Portamento",0); portamentoKnob = addNormalKnobClassic (175, 241, ownerFilter, PORTAMENTO, "Portamento", 0);
osc1PitchKnob = addNormalKnobClassic(271,40,ownerFilter,OSC1P,"Osc1Pitch",0); osc1PitchKnob = addNormalKnobClassic (271, 40, ownerFilter, OSC1P, "Osc1Pitch", 0);
pulseWidthKnob = addNormalKnobClassic(334,40,ownerFilter,PW,"PW",0); pulseWidthKnob = addNormalKnobClassic (334, 40, ownerFilter, PW, "PW", 0);
osc2PitchKnob = addNormalKnobClassic(397,40,ownerFilter,OSC2P,"Osc2Pitch",0); osc2PitchKnob = addNormalKnobClassic (397, 40, ownerFilter, OSC2P, "Osc2Pitch", 0);
osc1MixKnob = addNormalKnobClassic(490,40,ownerFilter,OSC1MIX,"Osc1",1); osc1MixKnob = addNormalKnobClassic (490, 40, ownerFilter, OSC1MIX, "Osc1", 1);
osc2MixKnob = addNormalKnobClassic(490,132,ownerFilter,OSC2MIX,"Osc2",1); osc2MixKnob = addNormalKnobClassic (490, 132, ownerFilter, OSC2MIX, "Osc2", 1);
noiseMixKnob = addNormalKnobClassic(490,224,ownerFilter,NOISEMIX,"Noise",0); noiseMixKnob = addNormalKnobClassic (490, 224, ownerFilter, NOISEMIX, "Noise", 0);
xmodKnob = addNormalKnobClassic(334,168,ownerFilter,XMOD,"Xmod",0); xmodKnob = addNormalKnobClassic (334, 168, ownerFilter, XMOD, "Xmod", 0);
osc2DetuneKnob = addNormalKnobClassic(334,104,ownerFilter,OSC2_DET,"Detune",0); osc2DetuneKnob = addNormalKnobClassic (334, 104, ownerFilter, OSC2_DET, "Detune", 0);
envPitchModKnob = addNormalKnobClassic(376,232,ownerFilter,ENVPITCH,"PEnv",0); envPitchModKnob = addNormalKnobClassic (376, 232, ownerFilter, ENVPITCH, "PEnv", 0);
brightnessKnob = addNormalKnobClassic(291,232,ownerFilter,BRIGHTNESS,"Bri",1); brightnessKnob = addNormalKnobClassic (291, 232, ownerFilter, BRIGHTNESS, "Bri", 1);
attackKnob = addNormalKnobClassic(791,132,ownerFilter,LATK,"Atk",0); attackKnob = addNormalKnobClassic (791, 132, ownerFilter, LATK, "Atk", 0);
decayKnob = addNormalKnobClassic(853,132,ownerFilter,LDEC,"Dec",0); decayKnob = addNormalKnobClassic (853, 132, ownerFilter, LDEC, "Dec", 0);
sustainKnob = addNormalKnobClassic(916,132,ownerFilter,LSUS,"Sus",1); sustainKnob = addNormalKnobClassic (916, 132, ownerFilter, LSUS, "Sus", 1);
releaseKnob = addNormalKnobClassic(980,132,ownerFilter,LREL,"Rel",0); releaseKnob = addNormalKnobClassic (980, 132, ownerFilter, LREL, "Rel", 0);
fattackKnob = addNormalKnobClassic(791,40,ownerFilter,FATK,"Atk",0); fattackKnob = addNormalKnobClassic (791, 40, ownerFilter, FATK, "Atk", 0);
fdecayKnob = addNormalKnobClassic(853,40,ownerFilter,FDEC,"Dec",0); fdecayKnob = addNormalKnobClassic (853, 40, ownerFilter, FDEC, "Dec", 0);
fsustainKnob = addNormalKnobClassic(916,40,ownerFilter,FSUS,"Sus",1); fsustainKnob = addNormalKnobClassic (916, 40, ownerFilter, FSUS, "Sus", 1);
freleaseKnob = addNormalKnobClassic(980,40,ownerFilter,FREL,"Rel",0); freleaseKnob = addNormalKnobClassic (980, 40, ownerFilter, FREL, "Rel", 0);
lfoFrequencyKnob = addNormalKnobClassic(576,207,ownerFilter,LFOFREQ,"Freq",0); lfoFrequencyKnob = addNormalKnobClassic (576, 207, ownerFilter, LFOFREQ, "Freq", 0);
lfoAmt1Knob = addNormalKnobClassic(640,207,ownerFilter,LFO1AMT,"Pitch",0); lfoAmt1Knob = addNormalKnobClassic (640, 207, ownerFilter, LFO1AMT, "Pitch", 0);
lfoAmt2Knob = addNormalKnobClassic(704,207,ownerFilter,LFO2AMT,"PWM",0); lfoAmt2Knob = addNormalKnobClassic (704, 207, ownerFilter, LFO2AMT, "PWM", 0);
lfoSinButton = addNormalTooglableButtonClassic(587,269,ownerFilter,LFOSINWAVE,"Sin"); lfoSinButton = addNormalTooglableButtonClassic (587, 269, ownerFilter, LFOSINWAVE, "Sin");
lfoSquareButton = addNormalTooglableButtonClassic(587,323,ownerFilter,LFOSQUAREWAVE,"SQ"); lfoSquareButton = addNormalTooglableButtonClassic (587, 323, ownerFilter, LFOSQUAREWAVE, "SQ");
lfoSHButton = addNormalTooglableButtonClassic(587,378,ownerFilter,LFOSHWAVE,"S&H"); lfoSHButton = addNormalTooglableButtonClassic (587, 378, ownerFilter, LFOSHWAVE, "S&H");
lfoOsc1Button = addNormalTooglableButtonClassic(651,269,ownerFilter,LFOOSC1,"Osc1"); lfoOsc1Button = addNormalTooglableButtonClassic (651, 269, ownerFilter, LFOOSC1, "Osc1");
lfoOsc2Button = addNormalTooglableButtonClassic(651,323,ownerFilter,LFOOSC2,"Osc2"); lfoOsc2Button = addNormalTooglableButtonClassic (651, 323, ownerFilter, LFOOSC2, "Osc2");
lfoFilterButton = addNormalTooglableButtonClassic(651,378,ownerFilter,LFOFILTER,"Filt"); lfoFilterButton = addNormalTooglableButtonClassic (651, 378, ownerFilter, LFOFILTER, "Filt");
lfoPwm1Button = addNormalTooglableButtonClassic(714,269,ownerFilter,LFOPW1,"Osc1"); lfoPwm1Button = addNormalTooglableButtonClassic (714, 269, ownerFilter, LFOPW1, "Osc1");
lfoPwm2Button = addNormalTooglableButtonClassic(714,323,ownerFilter,LFOPW2,"Osc2"); lfoPwm2Button = addNormalTooglableButtonClassic (714, 323, ownerFilter, LFOPW2, "Osc2");
hardSyncButton = addNormalTooglableButtonClassic(282,178,ownerFilter,OSC2HS,"Sync"); hardSyncButton = addNormalTooglableButtonClassic (282, 178, ownerFilter, OSC2HS, "Sync");
osc1SawButton = addNormalTooglableButtonClassic(265,114,ownerFilter,OSC1Saw,"S"); osc1SawButton = addNormalTooglableButtonClassic (265, 114, ownerFilter, OSC1Saw, "S");
osc2SawButton = addNormalTooglableButtonClassic(394,114,ownerFilter,OSC2Saw,"S"); osc2SawButton = addNormalTooglableButtonClassic (394, 114, ownerFilter, OSC2Saw, "S");
osc1PulButton = addNormalTooglableButtonClassic(296,114,ownerFilter,OSC1Pul,"P"); osc1PulButton = addNormalTooglableButtonClassic (296, 114, ownerFilter, OSC1Pul, "P");
osc2PulButton = addNormalTooglableButtonClassic(425,114,ownerFilter,OSC2Pul,"P"); osc2PulButton = addNormalTooglableButtonClassic (425, 114, ownerFilter, OSC2Pul, "P");
pitchQuantButton = addNormalTooglableButtonClassic(407,178,ownerFilter,OSCQuantize,"Step"); pitchQuantButton = addNormalTooglableButtonClassic (407, 178, ownerFilter, OSCQuantize, "Step");
filterBPBlendButton = addNormalTooglableButtonClassic(697,110,ownerFilter,BANDPASS,"Bp"); filterBPBlendButton = addNormalTooglableButtonClassic (697, 110, ownerFilter, BANDPASS, "Bp");
fourPoleButton = addNormalTooglableButtonClassic(728,110,ownerFilter,FOURPOLE,"24"); fourPoleButton = addNormalTooglableButtonClassic (728, 110, ownerFilter, FOURPOLE, "24");
filterHQButton = addNormalTooglableButtonClassic(604,110,ownerFilter,FILTER_WARM,"HQ"); filterHQButton = addNormalTooglableButtonClassic (604, 110, ownerFilter, FILTER_WARM, "HQ");
filterKeyFollowButton = addNormalTooglableButtonClassic(573,110,ownerFilter,FLT_KF,"Key"); filterKeyFollowButton = addNormalTooglableButtonClassic (573, 110, ownerFilter, FLT_KF, "Key");
unisonButton = addNormalTooglableButtonClassic(125,251,ownerFilter,UNISON,"Uni"); unisonButton = addNormalTooglableButtonClassic (125, 251, ownerFilter, UNISON, "Uni");
tuneKnob = addNormalKnobClassic(114,120,ownerFilter,TUNE,"Tune",0.5); tuneKnob = addNormalKnobClassic (114, 120, ownerFilter, TUNE, "Tune", 0.5);
voiceDetuneKnob =addNormalKnobClassic(53,241,ownerFilter,UDET,"VoiceDet",0); voiceDetuneKnob =addNormalKnobClassic (53, 241, ownerFilter, UDET, "VoiceDet", 0);
veloAmpEnvKnob = addNormalKnobClassic(486,345,ownerFilter,VAMPENV,"VAE",0); veloAmpEnvKnob = addNormalKnobClassic (486, 345, ownerFilter, VAMPENV, "VAE", 0);
veloFltEnvKnob = addNormalKnobClassic(428,345,ownerFilter,VFLTENV,"VFE",0); veloFltEnvKnob = addNormalKnobClassic (428, 345, ownerFilter, VFLTENV, "VFE", 0);
midiLearnButton = addNormalTooglableButtonClassic(126,372,ownerFilter,MIDILEARN,"LEA"); midiLearnButton = addNormalTooglableButtonClassic (126, 372, ownerFilter, MIDILEARN, "LEA");
midiUnlearnButton = addNormalTooglableButtonClassic(185,372,ownerFilter,UNLEARN,"UNL"); midiUnlearnButton = addNormalTooglableButtonClassic (185, 372, ownerFilter, UNLEARN, "UNL");
transposeKnob = addNormalKnobClassic(176,120,ownerFilter,OCTAVE,"Transpose",0.5); transposeKnob = addNormalKnobClassic (176, 120, ownerFilter, OCTAVE, "Transpose", 0.5);
pan1Knob = addTinyKnobClassic(796,318,ownerFilter,PAN1,"1",0.5); pan1Knob = addTinyKnobClassic (796, 318, ownerFilter, PAN1, "1", 0.5);
pan2Knob = addTinyKnobClassic(858,318,ownerFilter,PAN2,"2",0.5); pan2Knob = addTinyKnobClassic (858, 318, ownerFilter, PAN2, "2", 0.5);
pan3Knob = addTinyKnobClassic(921,318,ownerFilter,PAN3,"3",0.5); pan3Knob = addTinyKnobClassic (921, 318, ownerFilter, PAN3, "3", 0.5);
pan4Knob = addTinyKnobClassic(984,318,ownerFilter,PAN4,"4",0.5); pan4Knob = addTinyKnobClassic (984, 318, ownerFilter, PAN4, "4", 0.5);
pan5Knob = addTinyKnobClassic(796,371,ownerFilter,PAN5,"5",0.5); pan5Knob = addTinyKnobClassic (796, 371, ownerFilter, PAN5, "5", 0.5);
pan6Knob = addTinyKnobClassic(858,371,ownerFilter,PAN6,"6",0.5); pan6Knob = addTinyKnobClassic (858, 371, ownerFilter, PAN6, "6", 0.5);
pan7Knob = addTinyKnobClassic(921,371,ownerFilter,PAN7,"7",0.5); pan7Knob = addTinyKnobClassic (921, 371, ownerFilter, PAN7, "7", 0.5);
pan8Knob = addTinyKnobClassic(984,371,ownerFilter,PAN8,"8",0.5); pan8Knob = addTinyKnobClassic (984, 371, ownerFilter, PAN8, "8", 0.5);
bendOsc2OnlyButton = addNormalTooglableButtonClassic(321,354,ownerFilter,BENDOSC2,"Osc2"); bendOsc2OnlyButton = addNormalTooglableButtonClassic (321, 354, ownerFilter, BENDOSC2, "Osc2");
bendRangeButton = addNormalTooglableButtonClassic(267,354,ownerFilter,BENDRANGE,"12"); bendRangeButton = addNormalTooglableButtonClassic (267, 354, ownerFilter, BENDRANGE, "12");
asPlayedAllocButton = addNormalTooglableButtonClassic(65,372,ownerFilter,ASPLAYEDALLOCATION,"APA"); asPlayedAllocButton = addNormalTooglableButtonClassic (65, 372, ownerFilter, ASPLAYEDALLOCATION, "APA");
filterDetuneKnob = addTinyKnobClassic(817,240,ownerFilter,FILTERDER,"Flt",0.2); filterDetuneKnob = addTinyKnobClassic (817, 240, ownerFilter, FILTERDER, "Flt", 0.2);
envelopeDetuneKnob = addTinyKnobClassic(963,240,ownerFilter,ENVDER,"Env",0.2); envelopeDetuneKnob = addTinyKnobClassic (963, 240, ownerFilter, ENVDER, "Env", 0.2);
portamentoDetuneKnob = addTinyKnobClassic(890,240,ownerFilter,PORTADER,"Port",0.2); portamentoDetuneKnob = addTinyKnobClassic (890, 240, ownerFilter, PORTADER, "Port", 0.2);
bendLfoRateKnob = addNormalKnobClassic(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4); bendLfoRateKnob = addNormalKnobClassic (364, 345, ownerFilter, BENDLFORATE, "ModRate", 0.4);
voiceSwitch = addNormalButtonListClassic(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromFile(skinFolder.getChildFile("voices.png"))); voiceSwitch = addNormalButtonListClassic (172, 321, 38, ownerFilter, VOICE_COUNT, "VoiceCount", ImageCache::getFromFile (skinFolder.getChildFile ("voices.png")));
for (int i=1; i <= 32; i++)
voiceSwitch->addChoise(String(i));
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonListClassic(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromFile(skinFolder.getChildFile("legato.png"))); for (int i = 1; i <= 32; ++i)
legatoSwitch ->addChoise("Keep all"); {
legatoSwitch ->addChoise("Keep fenv"); voiceSwitch->addChoice (String (i));
legatoSwitch ->addChoise("Keep aenv"); }
legatoSwitch ->addChoise("Retrig");
legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification); legatoSwitch = addNormalButtonListClassic (65, 321, 95, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromFile (skinFolder.getChildFile ("legato.png")));
legatoSwitch->addChoice ("Keep all");
legatoSwitch->addChoice ("Keep fenv");
legatoSwitch->addChoice ("Keep aenv");
legatoSwitch->addChoice ("Retrig");
} }
ownerFilter->addChangeListener(this); buttonListAttachments.add (new ButtonList::ButtonListAttachment (ownerFilter.getPluginState(),
ownerFilter.getEngineParameterId (VOICE_COUNT),
*voiceSwitch));
buttonListAttachments.add (new ButtonList::ButtonListAttachment (ownerFilter.getPluginState(),
ownerFilter.getEngineParameterId (LEGATOMODE),
*legatoSwitch));
ownerFilter.addChangeListener (this);
repaint(); repaint();
} }
void ObxdAudioProcessorEditor::buttonClicked(Button * b) //void ObxdAudioProcessorEditor::buttonClicked(Button * b)
{ //{
TooglableButton* tb = (TooglableButton*)(b); //}
ObxdAudioProcessor* flt = getFilter();
#define bp(T) {flt->setParameterNotifyingHost(T,tb->getValue());}
#define handleBParam(K,T) if (tb == K) {bp(T)} else
handleBParam(hardSyncButton,OSC2HS)
handleBParam(osc1SawButton,OSC1Saw)
handleBParam(osc2SawButton,OSC2Saw)
handleBParam(osc1PulButton,OSC1Pul)
handleBParam(osc2PulButton,OSC2Pul)
handleBParam(filterKeyFollowButton,FLT_KF)
handleBParam(pitchQuantButton,OSCQuantize)
handleBParam(unisonButton,UNISON)
handleBParam(filterHQButton,FILTER_WARM)
handleBParam(filterBPBlendButton,BANDPASS)
handleBParam(lfoSinButton,LFOSINWAVE) //void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb)
handleBParam(lfoSquareButton,LFOSQUAREWAVE) //{
handleBParam(lfoSHButton,LFOSHWAVE) // ButtonList* bl = (ButtonList*)(cb);
// ObxdAudioProcessor* flt = getFilter();
// #define cp(T) {flt->setParameterNotifyingHost(T,bl->getValue());}
//#define handleCParam(K,T) if (bl == K) {cp(T)} else
// handleCParam(voiceSwitch,VOICE_COUNT)
// handleCParam(legatoSwitch,LEGATOMODE)
// {};
//}
handleBParam(lfoOsc1Button,LFOOSC1) //void ObxdAudioProcessorEditor::sliderValueChanged (Slider* c)
handleBParam(lfoOsc2Button,LFOOSC2) //{
handleBParam(lfoFilterButton,LFOFILTER) //}
handleBParam(lfoPwm1Button,LFOPW1)
handleBParam(lfoPwm2Button,LFOPW2)
handleBParam(bendOsc2OnlyButton,BENDOSC2)
handleBParam(bendRangeButton,BENDRANGE)
handleBParam(fourPoleButton,FOURPOLE)
handleBParam(asPlayedAllocButton,ASPLAYEDALLOCATION)
handleBParam(midiLearnButton,MIDILEARN)
handleBParam(midiUnlearnButton,UNLEARN)
{};
}
void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb)
{
ButtonList* bl = (ButtonList*)(cb);
ObxdAudioProcessor* flt = getFilter();
#define cp(T) {flt->setParameterNotifyingHost(T,bl->getValue());}
#define handleCParam(K,T) if (bl == K) {cp(T)} else
handleCParam(voiceSwitch,VOICE_COUNT)
handleCParam(legatoSwitch,LEGATOMODE)
{};
}
void ObxdAudioProcessorEditor::sliderValueChanged (Slider* c)
{
ObxdAudioProcessor* flt = getFilter();
// flt->beginParameterChangeGesture();
#define sp(T) {flt->setParameterNotifyingHost(T,c->getValue());}
#define handleSParam(K,T) if (c == K) {sp(T)} else
handleSParam(cutoffKnob,CUTOFF)
handleSParam(resonanceKnob,RESONANCE)
handleSParam(volumeKnob,VOLUME)
handleSParam(osc1PitchKnob,OSC1P)
handleSParam(osc2PitchKnob,OSC2P)
handleSParam(osc2DetuneKnob,OSC2_DET)
handleSParam(portamentoKnob,PORTAMENTO)
handleSParam(filterEnvelopeAmtKnob,ENVELOPE_AMT)
handleSParam(pulseWidthKnob,PW)
handleSParam(xmodKnob,XMOD)
handleSParam(multimodeKnob,MULTIMODE)
handleSParam(attackKnob,LATK)
handleSParam(decayKnob,LDEC)
handleSParam(sustainKnob,LSUS)
handleSParam(releaseKnob,LREL)
handleSParam(fattackKnob,FATK)
handleSParam(fdecayKnob,FDEC)
handleSParam(fsustainKnob,FSUS)
handleSParam(freleaseKnob,FREL)
handleSParam(osc1MixKnob,OSC1MIX)
handleSParam(osc2MixKnob,OSC2MIX)
handleSParam(noiseMixKnob,NOISEMIX)
handleSParam(voiceDetuneKnob,UDET)
handleSParam(filterDetuneKnob,FILTERDER)
handleSParam(envelopeDetuneKnob,ENVDER)
handleSParam(portamentoDetuneKnob,PORTADER)
handleSParam(lfoFrequencyKnob,LFOFREQ)
handleSParam(lfoAmt1Knob,LFO1AMT)
handleSParam(lfoAmt2Knob,LFO2AMT)
handleSParam(pan1Knob,PAN1)
handleSParam(pan2Knob,PAN2)
handleSParam(pan3Knob,PAN3)
handleSParam(pan4Knob,PAN4)
handleSParam(pan5Knob,PAN5)
handleSParam(pan6Knob,PAN6)
handleSParam(pan7Knob,PAN7)
handleSParam(pan8Knob,PAN8)
handleSParam(tuneKnob,TUNE)
handleSParam(brightnessKnob,BRIGHTNESS)
handleSParam(envPitchModKnob,ENVPITCH)
handleSParam(bendLfoRateKnob,BENDLFORATE)
handleSParam(veloAmpEnvKnob,VAMPENV)
handleSParam(veloFltEnvKnob,VFLTENV)
handleSParam(transposeKnob,OCTAVE)
//magic crystal
{};
//else if(c == cutoffKnob)
//{sp(CUTOFF);}
//else if(c == resonanceKnob)
//{sp(RESONANCE);}
//else if(c == portamentoKnob)
//{sp(PORTAMENTO);}
//else if(c == volumeKnob)
//{sp(VOLUME);}
//else if(c == osc1PitchKnob)
//{sp(OSC1P);}
//else if (c == osc2PitchKnob)
//{sp(OSC2P);}
}
//============================================================================== //==============================================================================
void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source) void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source)
{ {
ObxdAudioProcessor* filter = getFilter(); repaint();
float pr[PARAM_COUNT];
filter->getCallbackLock().enter();
for(int i = 0 ; i < PARAM_COUNT;++i)
pr[i] = filter->getPrograms().currentProgramPtr->values[i];
filter->getCallbackLock().exit();
#define rn(T,P) (T->setValue(pr[P],dontSendNotification));
rn(cutoffKnob,CUTOFF)
rn(resonanceKnob,RESONANCE)
rn(volumeKnob,VOLUME)
rn(osc1PitchKnob,OSC1P)
rn(osc2PitchKnob,OSC2P)
rn(osc2DetuneKnob,OSC2_DET)
rn(portamentoKnob,PORTAMENTO)
rn(filterEnvelopeAmtKnob,ENVELOPE_AMT)
rn(pulseWidthKnob,PW)
rn(xmodKnob,XMOD)
rn(multimodeKnob,MULTIMODE)
rn(brightnessKnob,BRIGHTNESS)
rn(envPitchModKnob,ENVPITCH)
rn(attackKnob,LATK)
rn(decayKnob,LDEC)
rn(sustainKnob,LSUS)
rn(releaseKnob,LREL)
rn(fattackKnob,FATK)
rn(fdecayKnob,FDEC)
rn(fsustainKnob,FSUS)
rn(freleaseKnob,FREL)
rn(osc1MixKnob,OSC1MIX)
rn(osc2MixKnob,OSC2MIX)
rn(noiseMixKnob,NOISEMIX)
rn(voiceDetuneKnob,UDET)
rn(lfoFrequencyKnob,LFOFREQ)
rn(lfoAmt1Knob,LFO1AMT)
rn(lfoAmt2Knob,LFO2AMT)
rn(tuneKnob,TUNE)
rn(bendLfoRateKnob,BENDLFORATE)
rn(veloAmpEnvKnob,VAMPENV)
rn(veloFltEnvKnob,VFLTENV)
//buttons
rn(hardSyncButton,OSC2HS)
rn(osc1SawButton,OSC1Saw)
rn(osc2SawButton,OSC2Saw)
rn(osc1PulButton,OSC1Pul)
rn(osc2PulButton,OSC2Pul)
rn(filterKeyFollowButton,FLT_KF)
rn(pitchQuantButton,OSCQuantize)
rn(unisonButton,UNISON)
rn(filterDetuneKnob,FILTERDER)
rn(envelopeDetuneKnob,ENVDER)
rn(portamentoDetuneKnob,PORTADER)
rn(filterHQButton,FILTER_WARM)
rn(filterBPBlendButton,BANDPASS)
rn(lfoSinButton,LFOSINWAVE)
rn(lfoSquareButton,LFOSQUAREWAVE)
rn(lfoSHButton,LFOSHWAVE)
rn(bendOsc2OnlyButton,BENDOSC2)
rn(bendRangeButton,BENDRANGE)
rn(lfoOsc1Button,LFOOSC1)
rn(lfoOsc2Button,LFOOSC2)
rn(lfoFilterButton,LFOFILTER)
rn(lfoPwm1Button,LFOPW1)
rn(lfoPwm2Button,LFOPW2)
rn(fourPoleButton,FOURPOLE)
rn(transposeKnob,OCTAVE)
rn(pan1Knob,PAN1)
rn(pan2Knob,PAN2)
rn(pan3Knob,PAN3)
rn(pan4Knob,PAN4)
rn(pan5Knob,PAN5)
rn(pan6Knob,PAN6)
rn(pan7Knob,PAN7)
rn(pan8Knob,PAN8)
rn(voiceSwitch,VOICE_COUNT)
rn(legatoSwitch,LEGATOMODE)
rn(asPlayedAllocButton,ASPLAYEDALLOCATION)
rn(midiLearnButton,MIDILEARN)
rn(midiUnlearnButton,UNLEARN)
} }
void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e) void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
@ -639,11 +486,11 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
PopupMenu progMenu; PopupMenu progMenu;
Array<File> skins; Array<File> skins;
const Array<File>& banks = getFilter()->getBankFiles(); const Array<File>& banks = processor.getBankFiles();
int skinStart = 0; int skinStart = 0;
{ {
DirectoryIterator it(getFilter()->getSkinFolder(), false, "*", File::findDirectories); DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories);
while (it.next()) while (it.next())
{ {
skins.addUsingDefaultSort(it.getFile()); skins.addUsingDefaultSort(it.getFile());
@ -660,7 +507,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
int bankStart = 1000; int bankStart = 1000;
{ {
const String currentBank = getFilter()->getCurrentBankFile().getFileName(); const String currentBank = processor.getCurrentBankFile().getFileName();
for (int i = 0; i < banks.size(); ++i) for (int i = 0; i < banks.size(); ++i)
{ {
@ -690,9 +537,9 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
result -= skinStart; result -= skinStart;
const File newSkinFolder = skins.getUnchecked(result); const File newSkinFolder = skins.getUnchecked(result);
getFilter()->setCurrentSkinFolder(newSkinFolder.getFileName()); processor.setCurrentSkinFolder(newSkinFolder.getFileName());
rebuildComponents(); rebuildComponents (processor);
} }
else if (result >= (bankStart + 1) && result <= (bankStart + banks.size())) else if (result >= (bankStart + 1) && result <= (bankStart + banks.size()))
{ {
@ -700,13 +547,13 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
result -= bankStart; result -= bankStart;
const File bankFile = banks.getUnchecked(result); const File bankFile = banks.getUnchecked(result);
getFilter()->loadFromFXBFile(bankFile); processor.loadFromFXBFile (bankFile);
} }
else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms())) else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
{ {
result -= 1; result -= 1;
result -= progStart; result -= progStart;
processor.setCurrentProgram(result); processor.setCurrentProgram (result);
} }
} }
} }

View file

@ -22,45 +22,44 @@
//============================================================================== //==============================================================================
/** /**
*/ */
class ObxdAudioProcessorEditor : class ObxdAudioProcessorEditor : public AudioProcessorEditor,
public AudioProcessorEditor, // public AudioProcessorListener,
// public AudioProcessorListener, public ChangeListener//,
public ChangeListener, // public Slider::Listener,
public Slider::Listener, // public Button::Listener,
public Button::Listener, // public ComboBox::Listener
public ComboBox::Listener
{ {
public: public:
ObxdAudioProcessorEditor(ObxdAudioProcessor* ownerFilter); ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
~ObxdAudioProcessorEditor(); ~ObxdAudioProcessorEditor();
void mouseUp(const MouseEvent& e); void mouseUp (const MouseEvent& e) override;
void paint(Graphics& g); void paint (Graphics& g) override;
//============================================================================== //==============================================================================
void changeListenerCallback (ChangeBroadcaster* source); void changeListenerCallback (ChangeBroadcaster* source) override;
private: private:
Knob* addNormalKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); Knob* addNormalKnob (int x, int y, ObxdAudioProcessor& filter, int parameter, String name, float defval);
Knob* addTinyKnob(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); Knob* addTinyKnob (int x, int y, ObxdAudioProcessor& filter, int parameter, String name, float defval);
void placeLabel(int x , int y,String text); void placeLabel (int x, int y, String text);
TooglableButton* addNormalTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name); TooglableButton* addNormalTooglableButton (int x, int y, ObxdAudioProcessor& filter, int parameter, String name);
TooglableButton* addTinyTooglableButton(int x , int y , ObxdAudioProcessor* filter,int parameter,String name); TooglableButton* addTinyTooglableButton (int x, int y, ObxdAudioProcessor& filter, int parameter, String name);
ButtonList* addNormalButtonList(int x , int y ,int width, ObxdAudioProcessor* filter,int parameter,String name,Image img); ButtonList* addNormalButtonList(int x, int y, int width, ObxdAudioProcessor& filter, int parameter, String name, Image img);
void sliderValueChanged (Slider*); // void sliderValueChanged (Slider*) override;
void buttonClicked (Button *); // void buttonClicked (Button*) override;
void comboBoxChanged(ComboBox*); // void comboBoxChanged (ComboBox*) override;
Knob* addNormalKnobClassic(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); Knob* addNormalKnobClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String name, float defval);
Knob* addTinyKnobClassic(int x , int y ,ObxdAudioProcessor* filter, int parameter,String name,float defval); Knob* addTinyKnobClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String name, float defval);
TooglableButton* addNormalTooglableButtonClassic(int x , int y , ObxdAudioProcessor* filter,int parameter,String name); TooglableButton* addNormalTooglableButtonClassic (int x, int y, ObxdAudioProcessor& filter, int parameter, String name);
ButtonList* addNormalButtonListClassic(int x , int y ,int width, ObxdAudioProcessor* filter,int parameter,String name,Image img); ButtonList* addNormalButtonListClassic (int x, int y, int width, ObxdAudioProcessor& filter, int parameter, String name, Image img);
void rebuildComponents(); void rebuildComponents (ObxdAudioProcessor&);
//============================================================================== //==============================================================================
ObxdAudioProcessor* getFilter() noexcept { return (ObxdAudioProcessor*)getAudioProcessor();} ObxdAudioProcessor& processor;
//============================================================================== //==============================================================================
Knob* cutoffKnob,*resonanceKnob,*osc1PitchKnob,*osc2PitchKnob,*osc2DetuneKnob,*volumeKnob, Knob* cutoffKnob,*resonanceKnob,*osc1PitchKnob,*osc2PitchKnob,*osc2DetuneKnob,*volumeKnob,
@ -83,6 +82,11 @@ private:
ButtonList *voiceSwitch,*legatoSwitch; ButtonList *voiceSwitch,*legatoSwitch;
File skinFolder; File skinFolder;
//==============================================================================
OwnedArray<Knob::KnobAttachment> knobAttachments;
OwnedArray<TooglableButton::ToggleAttachment> toggleAttachments;
OwnedArray<ButtonList::ButtonListAttachment> buttonListAttachments;
}; };
#endif // PLUGINEDITOR_H_INCLUDED #endif // PLUGINEDITOR_H_INCLUDED

File diff suppressed because it is too large Load diff

View file

@ -113,10 +113,9 @@ static inline float fxbSwapFloat (const float x) noexcept
//============================================================================== //==============================================================================
/** /**
*/ */
class ObxdAudioProcessor : class ObxdAudioProcessor : public AudioProcessor,
public AudioProcessor, public AudioProcessorValueTreeState::Listener,
// public AudioProcessorListener, public ChangeBroadcaster
public ChangeBroadcaster
{ {
public: public:
//============================================================================== //==============================================================================
@ -124,53 +123,44 @@ public:
~ObxdAudioProcessor(); ~ObxdAudioProcessor();
//============================================================================== //==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock); void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources(); void releaseResources() override;
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;
//============================================================================== //==============================================================================
AudioProcessorEditor* createEditor(); AudioProcessorEditor* createEditor() override;
bool hasEditor() const; bool hasEditor() const override;
//============================================================================== //==============================================================================
void processMidiPerSample(MidiBuffer::Iterator* iter,const int samplePos); void processMidiPerSample (MidiBuffer::Iterator* iter, const int samplePos);
bool getNextEvent(MidiBuffer::Iterator* iter,const int samplePos); bool getNextEvent (MidiBuffer::Iterator* iter, const int samplePos);
//============================================================================== //==============================================================================
void initAllParams(); void initAllParams();
int getNumParameters(); const String getInputChannelName (int channelIndex) const override; // WATCH OUT!
const String getOutputChannelName (int channelIndex) const override; // WATCH OUT!
bool isInputChannelStereoPair (int index) const override; // WATCH OUT!
bool isOutputChannelStereoPair (int index) const override; // WATCH OUT!
float getParameter (int index); bool acceptsMidi() const override;
void setParameter (int index, float newValue); bool producesMidi() const override;
double getTailLengthSeconds() const override;
const String getParameterName (int index); const String getName() const override;
const String getParameterText (int index);
const String getInputChannelName (int channelIndex) const;
const String getOutputChannelName (int channelIndex) const;
bool isInputChannelStereoPair (int index) const;
bool isOutputChannelStereoPair (int index) const;
bool acceptsMidi() const;
bool producesMidi() const;
bool silenceInProducesSilenceOut() const;
double getTailLengthSeconds() const;
const String getName() const;
//============================================================================== //==============================================================================
int getNumPrograms(); int getNumPrograms() override;
int getCurrentProgram(); int getCurrentProgram() override;
void setCurrentProgram (int index); void setCurrentProgram (int index) override;
const String getProgramName (int index); const String getProgramName (int index) override;
void changeProgramName (int index, const String& newName); void changeProgramName (int index, const String& newName) override;
//============================================================================== //==============================================================================
void getStateInformation (MemoryBlock& destData); void getStateInformation (MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes); void setStateInformation (const void* data, int sizeInBytes) override;
void setCurrentProgramStateInformation(const void* data,int sizeInBytes); void setCurrentProgramStateInformation (const void* data,int sizeInBytes) override;
void getCurrentProgramStateInformation(MemoryBlock& destData); void getCurrentProgramStateInformation (MemoryBlock& destData) override;
//============================================================================== //==============================================================================
void scanAndUpdateBanks(); void scanAndUpdateBanks();
@ -190,6 +180,13 @@ public:
File getCurrentSkinFolder() const; File getCurrentSkinFolder() const;
void setCurrentSkinFolder(const String& folderName); void setCurrentSkinFolder(const String& folderName);
//==============================================================================
static String getEngineParameterId (size_t);
int getParameterIndexFromId (String);
void setEngineParameterValue (int, float);
void parameterChanged (const String&, float) override;
AudioProcessorValueTreeState& getPluginState();
private: private:
//============================================================================== //==============================================================================
bool isHostAutomatedChange; bool isHostAutomatedChange;
@ -212,9 +209,13 @@ private:
String currentBank; String currentBank;
Array<File> bankFiles; Array<File> bankFiles;
ScopedPointer<PropertiesFile> config; std::unique_ptr<PropertiesFile> config;
InterProcessLock configLock; InterProcessLock configLock;
//==============================================================================
AudioProcessorValueTreeState apvtState;
UndoManager undoManager;
//============================================================================== //==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ObxdAudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ObxdAudioProcessor)
}; };