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 #if JUCE_MAC
// setUsingNativeTitleBar(true); setUsingNativeTitleBar(true);
/* todo menu bar */ menu.addItem (1, TRANS("Audio/MIDI Settings..."));
#endif 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,11 +23,9 @@
*/ */
#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")
{ {
@ -37,24 +35,61 @@ public:
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) void setValue (float val, NotificationType notify)
{ {
setSelectedId ((int) (val * (count - 1) + 1), notify); setSelectedId ((int) (val * (count - 1) + 1), notify);
} }
void paintOverChildren(Graphics& g)
void paintOverChildren (Graphics& g) override
{ {
int ofs = getSelectedId() - 1; int ofs = getSelectedId() - 1;
g.drawImage(kni, 0, 0, getWidth(), getHeight(), g.drawImage(kni, 0, 0, getWidth(), getHeight(), 0, h2 * ofs, w2, h2);
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:
@ -41,15 +42,46 @@ public:
kni = k; kni = k;
}; };
void paint(Graphics& g) // Source: https://git.iem.at/audioplugins/IEMPluginSuite/-/blob/master/resources/customComponents/ReverseSlider.h
public:
class KnobAttachment : public juce::AudioProcessorValueTreeState::SliderAttachment
{
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)); int ofs = (int) ((getValue() - getMinimum()) / (getMaximum() - getMinimum()) * (numFr - 1));
g.drawImage(kni, 0, 0, getWidth(), getHeight(), g.drawImage (kni, 0, 0, getWidth(), getHeight(), 0, h2 * ofs, w2, h2);
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,10 +23,10 @@
*/ */
#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
@ -38,7 +38,38 @@ public:
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);
@ -50,23 +81,28 @@ 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)
@ -77,7 +113,11 @@ public:
//{ //{
// 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,17 +14,16 @@ 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)
@ -32,22 +31,24 @@ 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);
lab->setInterceptsMouseClicks (false, true);
addAndMakeVisible (lab); 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();
@ -57,18 +58,22 @@ Knob* ObxdAudioProcessorEditor::addNormalKnob(int x , int y ,ObxdAudioProcessor*
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();
@ -78,18 +83,22 @@ Knob* ObxdAudioProcessorEditor::addNormalKnobClassic(int x , int y ,ObxdAudioPro
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);
@ -100,52 +109,68 @@ Knob* ObxdAudioProcessorEditor::addTinyKnob(int x , int y ,ObxdAudioProcessor* f
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();
@ -155,39 +180,45 @@ Knob* ObxdAudioProcessorEditor::addTinyKnobClassic(int x , int y ,ObxdAudioProce
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();
skinFolder = ownerFilter->getCurrentSkinFolder();
bool useClassicSkin = skinFolder.getChildFile ("legato.png").existsAsFile(); bool useClassicSkin = skinFolder.getChildFile ("legato.png").existsAsFile();
ownerFilter->removeChangeListener(this); ownerFilter.removeChangeListener (this);
deleteAllChildren(); deleteAllChildren(); // WATCH OUT!
if (! useClassicSkin) if (! useClassicSkin)
{ {
@ -287,16 +318,17 @@ void ObxdAudioProcessorEditor::rebuildComponents()
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)); for (int i = 1; i <= 32; ++i)
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); {
voiceSwitch->addChoice (String (i));
}
legatoSwitch = addNormalButtonList (25, 338, 65, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromMemory (BinaryData::legato_png, BinaryData::legato_pngSize)); legatoSwitch = addNormalButtonList (25, 338, 65, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromMemory (BinaryData::legato_png, BinaryData::legato_pngSize));
legatoSwitch ->addChoise("Keep All"); legatoSwitch->addChoice ("Keep All");
legatoSwitch ->addChoise("Keep Filter Envelope"); legatoSwitch->addChoice ("Keep Filter Envelope");
legatoSwitch ->addChoise("Keep Amplitude Envelope"); legatoSwitch->addChoice ("Keep Amplitude Envelope");
legatoSwitch ->addChoise("Retrig"); legatoSwitch->addChoice ("Retrig");
legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification);
} }
else else
{ {
@ -394,239 +426,54 @@ void ObxdAudioProcessorEditor::rebuildComponents()
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);
} }
ownerFilter->addChangeListener(this); 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");
}
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,7 +547,7 @@ 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()))
{ {

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,9 +113,8 @@ 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,14 +123,14 @@ 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);
@ -140,37 +139,28 @@ public:
//============================================================================== //==============================================================================
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)
}; };