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
Builds/
Modules/
## JUCE library code
JuceLibraryCode/

View File

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

View File

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

View File

@ -23,11 +23,9 @@
*/
#pragma once
#include "../Source/Engine/SynthEngine.h"
class ButtonList : public ComboBox{
private :
int count;
Image kni;
int w2,h2;
class ButtonList : public ComboBox
{
public:
ButtonList (Image k, int fh) : ComboBox("cb")
{
@ -37,24 +35,61 @@ public:
w2 = k.getWidth();
}
//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);
}
float getValue()
{
return ((getSelectedId() - 1) / (float) (count - 1));
}
void setValue (float val, NotificationType notify)
{
setSelectedId ((int) (val * (count - 1) + 1), notify);
}
void paintOverChildren(Graphics& g)
void paintOverChildren (Graphics& g) override
{
int ofs = getSelectedId() - 1;
g.drawImage(kni, 0, 0, getWidth(), getHeight(),
0, h2*ofs, w2, h2);
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.
Copyright © 2013-2014 Filatov Vadim
Copyright <EFBFBD> 2013-2014 Filatov Vadim
Contact author via email :
justdat_@_e1.ru
@ -23,6 +23,7 @@
*/
#pragma once
#include "../Source/Engine/SynthEngine.h"
class Knob : public Slider
{
public:
@ -41,15 +42,46 @@ public:
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));
g.drawImage(kni, 0, 0, getWidth(), getHeight(),
0, h2*ofs, w2, h2);
g.drawImage (kni, 0, 0, getWidth(), getHeight(), 0, h2 * ofs, w2, h2);
}
private:
Image kni;
int fh, numFr;
int w2, h2;
const AudioProcessorParameter* parameter {nullptr};
};

View File

@ -2,7 +2,7 @@
==============================================================================
This file is part of Obxd synthesizer.
Copyright © 2013-2014 Filatov Vadim
Copyright <EFBFBD> 2013-2014 Filatov Vadim
Contact author via email :
justdat_@_e1.ru
@ -23,10 +23,10 @@
*/
#pragma once
#include "../Source/Engine/SynthEngine.h"
class TooglableButton : public ImageButton
{
public:
bool toogled;
TooglableButton (Image k) : ImageButton()
{
//this->setImages
@ -38,7 +38,38 @@ public:
h2 = height / 2;
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;
//this->setColour(1,Colours::blue);
@ -50,23 +81,28 @@ public:
Button::clicked();
};
void paintButton(Graphics& g, bool isMouseOverButton, bool isButtonDown)
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
{
int offset = 0;
if (toogled)
{
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)
{
if (state > 0.5)
toogled = true;
else toogled = false;
repaint();
}
float getValue()
{
if (toogled)
@ -77,7 +113,11 @@ public:
//{
// g.drawImageTransformed(kni,AffineTransform::rotation(((getValue() - getMinimum())/(getMaximum() - getMinimum()))*float_Pi - float_Pi*2));
//}
bool toogled;
private:
Image kni;
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)
: AudioProcessorEditor (ownerFilter)
ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFilter)
: AudioProcessorEditor (&ownerFilter), processor (ownerFilter)
{
rebuildComponents();
rebuildComponents (processor);
}
ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor()
{
getFilter()->removeChangeListener(this);
deleteAllChildren();
processor.removeChangeListener (this);
// deleteAllChildren(); // WATCH OUT!
}
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();
lab->setBounds (x, y, 110, 20);
lab->setJustificationType (Justification::centred);
lab->setText(text,dontSendNotification);lab->setInterceptsMouseClicks(false,true);
lab->setText (text,dontSendNotification);
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);
bl->setBounds (x, y, width, 24);
//bl->setValue(filter->getParameter(parameter),dontSendNotification);
addAndMakeVisible (bl);
bl->addListener (this);
// bl->addListener (this);
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);
//Label* knobl = new Label();
@ -57,18 +58,22 @@ Knob* ObxdAudioProcessorEditor::addNormalKnob(int x , int y ,ObxdAudioProcessor*
addAndMakeVisible (knob);
//addAndMakeVisible(knobl);
knob->setBounds (x, y, 48, 48);
knob->setValue(filter->getParameter(parameter),dontSendNotification);
// knob->setValue (filter.getParameter (parameter), dontSendNotification);
//knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+40,60,10);
//knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this);
// knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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);
//Label* knobl = new Label();
@ -78,18 +83,22 @@ Knob* ObxdAudioProcessorEditor::addNormalKnobClassic(int x , int y ,ObxdAudioPro
addAndMakeVisible (knob);
//addAndMakeVisible(knobl);
knob->setBounds (x+2, y, 42, 42);
knob->setValue(filter->getParameter(parameter),dontSendNotification);
// knob->setValue(filter.getParameter(parameter),dontSendNotification);
//knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+40,60,10);
//knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this);
// knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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::knoblsd_png, BinaryData::knoblsd_pngSize), 48);
@ -100,52 +109,68 @@ Knob* ObxdAudioProcessorEditor::addTinyKnob(int x , int y ,ObxdAudioProcessor* f
addAndMakeVisible (knob);
//addAndMakeVisible(knobl);
knob->setBounds (x, y, 36, 36);
knob->setValue(filter->getParameter(parameter),dontSendNotification);
// knob->setValue(filter.getParameter(parameter),dontSendNotification);
//knobl->setJustificationType(Justification::centred);
//knobl->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+25,50,10);
//knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this);
// knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible (button);
button->setBounds (x, y, 19, 35);
button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0);
button->addListener(this);
// button->setValue(filter.getParameter(parameter),0);
// button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible (button);
button->setBounds (x, y, 20, 20);
button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0);
button->addListener(this);
// button->setValue(filter.getParameter(parameter),0);
// button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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);
bl->setBounds (x, y, width, 32);
//bl->setValue(filter->getParameter(parameter),dontSendNotification);
addAndMakeVisible (bl);
bl->addListener (this);
// bl->addListener (this);
buttonListAttachments.add (new ButtonList::ButtonListAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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);
//Label* knobl = new Label();
@ -155,39 +180,45 @@ Knob* ObxdAudioProcessorEditor::addTinyKnobClassic(int x , int y ,ObxdAudioProce
addAndMakeVisible (knob);
//addAndMakeVisible(knobl);
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->setInterceptsMouseClicks(false,true);
//knobl->setBounds(x-10,y+25,50,10);
//knobl->setText(name,dontSendNotification);
knob->setTextBoxIsEditable (false);
knob->setDoubleClickReturnValue (true, defval);
knob->addListener (this);
// knob->addListener (this);
knobAttachments.add (new Knob::KnobAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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")));
// button->setButtonStyle(DrawableButton::ButtonStyle::ImageAboveTextLabel);
addAndMakeVisible (button);
button->setBounds (x, y, 28, 35);
button->setButtonText (name);
button->setValue(filter->getParameter(parameter),0);
button->addListener(this);
// button->setValue(filter.getParameter(parameter),0);
// button->addListener(this);
toggleAttachments.add (new TooglableButton::ToggleAttachment (filter.getPluginState(),
filter.getEngineParameterId (parameter),
*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();
ownerFilter->removeChangeListener(this);
ownerFilter.removeChangeListener (this);
deleteAllChildren();
deleteAllChildren(); // WATCH OUT!
if (! useClassicSkin)
{
@ -287,16 +318,17 @@ void ObxdAudioProcessorEditor::rebuildComponents()
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));
for (int i=1; i <= 32; i++)
voiceSwitch ->addChoise(String(i));
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
for (int i = 1; i <= 32; ++i)
{
voiceSwitch->addChoice (String (i));
}
legatoSwitch = addNormalButtonList (25, 338, 65, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromMemory (BinaryData::legato_png, BinaryData::legato_pngSize));
legatoSwitch ->addChoise("Keep All");
legatoSwitch ->addChoise("Keep Filter Envelope");
legatoSwitch ->addChoise("Keep Amplitude Envelope");
legatoSwitch ->addChoise("Retrig");
legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification);
legatoSwitch->addChoice ("Keep All");
legatoSwitch->addChoice ("Keep Filter Envelope");
legatoSwitch->addChoice ("Keep Amplitude Envelope");
legatoSwitch->addChoice ("Retrig");
}
else
{
@ -394,239 +426,54 @@ void ObxdAudioProcessorEditor::rebuildComponents()
bendLfoRateKnob = addNormalKnobClassic (364, 345, ownerFilter, BENDLFORATE, "ModRate", 0.4);
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")));
legatoSwitch ->addChoise("Keep all");
legatoSwitch ->addChoise("Keep fenv");
legatoSwitch ->addChoise("Keep aenv");
legatoSwitch ->addChoise("Retrig");
legatoSwitch ->setValue(ownerFilter->getParameter(LEGATOMODE),dontSendNotification);
for (int i = 1; i <= 32; ++i)
{
voiceSwitch->addChoice (String (i));
}
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();
}
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)
//void ObxdAudioProcessorEditor::buttonClicked(Button * b)
//{
//}
handleBParam(lfoSinButton,LFOSINWAVE)
handleBParam(lfoSquareButton,LFOSQUAREWAVE)
handleBParam(lfoSHButton,LFOSHWAVE)
//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)
// {};
//}
handleBParam(lfoOsc1Button,LFOOSC1)
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::sliderValueChanged (Slider* c)
//{
//}
//==============================================================================
void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source)
{
ObxdAudioProcessor* filter = getFilter();
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)
repaint();
}
void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
@ -639,11 +486,11 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
PopupMenu progMenu;
Array<File> skins;
const Array<File>& banks = getFilter()->getBankFiles();
const Array<File>& banks = processor.getBankFiles();
int skinStart = 0;
{
DirectoryIterator it(getFilter()->getSkinFolder(), false, "*", File::findDirectories);
DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories);
while (it.next())
{
skins.addUsingDefaultSort(it.getFile());
@ -660,7 +507,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
int bankStart = 1000;
{
const String currentBank = getFilter()->getCurrentBankFile().getFileName();
const String currentBank = processor.getCurrentBankFile().getFileName();
for (int i = 0; i < banks.size(); ++i)
{
@ -690,9 +537,9 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
result -= skinStart;
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()))
{
@ -700,7 +547,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
result -= bankStart;
const File bankFile = banks.getUnchecked(result);
getFilter()->loadFromFXBFile(bankFile);
processor.loadFromFXBFile (bankFile);
}
else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
{

View File

@ -22,45 +22,44 @@
//==============================================================================
/**
*/
class ObxdAudioProcessorEditor :
public AudioProcessorEditor,
class ObxdAudioProcessorEditor : public AudioProcessorEditor,
// public AudioProcessorListener,
public ChangeListener,
public Slider::Listener,
public Button::Listener,
public ComboBox::Listener
public ChangeListener//,
// public Slider::Listener,
// public Button::Listener,
// public ComboBox::Listener
{
public:
ObxdAudioProcessorEditor(ObxdAudioProcessor* ownerFilter);
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
~ObxdAudioProcessorEditor();
void mouseUp(const MouseEvent& e);
void paint(Graphics& g);
void mouseUp (const MouseEvent& e) override;
void paint (Graphics& g) override;
//==============================================================================
void changeListenerCallback (ChangeBroadcaster* source);
void changeListenerCallback (ChangeBroadcaster* source) override;
private:
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* 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);
void placeLabel (int x, int y, String text);
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* addNormalTooglableButton (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);
void sliderValueChanged (Slider*);
void buttonClicked (Button *);
void comboBoxChanged(ComboBox*);
ButtonList* addNormalButtonList(int x, int y, int width, ObxdAudioProcessor& filter, int parameter, String name, Image img);
// void sliderValueChanged (Slider*) override;
// void buttonClicked (Button*) override;
// void comboBoxChanged (ComboBox*) override;
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);
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);
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);
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);
void rebuildComponents();
void rebuildComponents (ObxdAudioProcessor&);
//==============================================================================
ObxdAudioProcessor* getFilter() noexcept { return (ObxdAudioProcessor*)getAudioProcessor();}
ObxdAudioProcessor& processor;
//==============================================================================
Knob* cutoffKnob,*resonanceKnob,*osc1PitchKnob,*osc2PitchKnob,*osc2DetuneKnob,*volumeKnob,
@ -83,6 +82,11 @@ private:
ButtonList *voiceSwitch,*legatoSwitch;
File skinFolder;
//==============================================================================
OwnedArray<Knob::KnobAttachment> knobAttachments;
OwnedArray<TooglableButton::ToggleAttachment> toggleAttachments;
OwnedArray<ButtonList::ButtonListAttachment> buttonListAttachments;
};
#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 :
public AudioProcessor,
// public AudioProcessorListener,
class ObxdAudioProcessor : public AudioProcessor,
public AudioProcessorValueTreeState::Listener,
public ChangeBroadcaster
{
public:
@ -124,14 +123,14 @@ public:
~ObxdAudioProcessor();
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock);
void releaseResources();
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;
//==============================================================================
AudioProcessorEditor* createEditor();
bool hasEditor() const;
AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;
//==============================================================================
void processMidiPerSample (MidiBuffer::Iterator* iter, const int samplePos);
@ -140,37 +139,28 @@ public:
//==============================================================================
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);
void setParameter (int index, float newValue);
const String getParameterName (int index);
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;
bool acceptsMidi() const override;
bool producesMidi() const override;
double getTailLengthSeconds() const override;
const String getName() const override;
//==============================================================================
int getNumPrograms();
int getCurrentProgram();
void setCurrentProgram (int index);
const String getProgramName (int index);
void changeProgramName (int index, const String& newName);
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const String getProgramName (int index) override;
void changeProgramName (int index, const String& newName) override;
//==============================================================================
void getStateInformation (MemoryBlock& destData);
void setStateInformation (const void* data, int sizeInBytes);
void setCurrentProgramStateInformation(const void* data,int sizeInBytes);
void getCurrentProgramStateInformation(MemoryBlock& destData);
void getStateInformation (MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
void setCurrentProgramStateInformation (const void* data,int sizeInBytes) override;
void getCurrentProgramStateInformation (MemoryBlock& destData) override;
//==============================================================================
void scanAndUpdateBanks();
@ -190,6 +180,13 @@ public:
File getCurrentSkinFolder() const;
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:
//==============================================================================
bool isHostAutomatedChange;
@ -212,9 +209,13 @@ private:
String currentBank;
Array<File> bankFiles;
ScopedPointer<PropertiesFile> config;
std::unique_ptr<PropertiesFile> config;
InterProcessLock configLock;
//==============================================================================
AudioProcessorValueTreeState apvtState;
UndoManager undoManager;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ObxdAudioProcessor)
};