2
0
Fork 0

Merge pull request #56 from reales/development

v2.4
This commit is contained in:
reales 2021-05-30 11:05:16 +02:00 committed by GitHub
commit 458cd5a3d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 896 additions and 94 deletions

View file

@ -2,17 +2,16 @@
============================================================================== ==============================================================================
This file is part of the JUCE library. This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd. Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source JUCE is an open source library subject to commercial or open-source
licensing. licensing.
By using JUCE, you agree to the terms of both the JUCE 5 End-User License By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
27th April 2017).
End User License Agreement: www.juce.com/juce-5-licence End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-5-privacy-policy Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses). www.gnu.org/licenses).
@ -24,8 +23,10 @@
============================================================================== ==============================================================================
*/ */
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client #pragma once
extern juce::AudioProcessor* JUCE_API JUCE_CALLTYPE createPluginFilterOfType (juce::AudioProcessor::WrapperType type);
#ifndef DOXYGEN
#include "../utility/juce_CreatePluginFilter.h"
#endif #endif
namespace juce namespace juce
@ -123,15 +124,7 @@ public:
//============================================================================== //==============================================================================
virtual void createPlugin() virtual void createPlugin()
{ {
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client processor.reset (createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
processor.reset (::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
#else
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Standalone);
processor.reset (createPluginFilter());
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Undefined);
#endif
jassert (processor != nullptr); // Your createPluginFilter() function must return a valid object!
processor->disableNonMainBuses(); processor->disableNonMainBuses();
processor->setRateAndBufferSizeDetails (44100, 512); processor->setRateAndBufferSizeDetails (44100, 512);
@ -272,12 +265,15 @@ public:
maxNumOutputs = jmax (0, bus->getDefaultLayout().size()); maxNumOutputs = jmax (0, bus->getDefaultLayout().size());
o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs)); o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs));
//#if JUCE_MAC
LookAndFeel_V4 *lfv4 = dynamic_cast<LookAndFeel_V4*>(&o.content->getLookAndFeel());
if (lfv4) {
lfv4->setColour(ResizableWindow::backgroundColourId, Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f));
}
o.content->setSize (500, 400); o.content->setSize (500, 400);
//#endif
//#if ! JUCE_MAC
// o.content->setSize (500, 450);
//#endif
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);
o.escapeKeyTriggersCloseButton = true; o.escapeKeyTriggersCloseButton = true;
@ -376,7 +372,6 @@ public:
return false; return false;
} }
#if JUCE_MODULE_AVAILABLE_juce_gui_basics
Image getIAAHostIcon (int size) Image getIAAHostIcon (int size)
{ {
#if JUCE_IOS && JucePlugin_Enable_IAA #if JUCE_IOS && JucePlugin_Enable_IAA
@ -388,7 +383,6 @@ public:
return {}; return {};
} }
#endif
static StandalonePluginHolder* getInstance(); static StandalonePluginHolder* getInstance();
@ -420,10 +414,10 @@ private:
int maxAudioOutputChannels) int maxAudioOutputChannels)
: owner (pluginHolder), : owner (pluginHolder),
deviceSelector (deviceManagerToUse, deviceSelector (deviceManagerToUse,
0, maxAudioInputChannels, 0, 0, // maxAudioInputChannels, // force zero to fully disable input selection
0, maxAudioOutputChannels, 0, maxAudioOutputChannels,
true, true,
false, // disables MIDI Out // (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()), (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()),
true, false), true, false),
shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"), shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"),
shouldMuteButton ("Mute audio input") shouldMuteButton ("Mute audio input")
@ -442,6 +436,17 @@ private:
shouldMuteLabel.attachToComponent (&shouldMuteButton, true); shouldMuteLabel.attachToComponent (&shouldMuteButton, true);
} }
for (int i =0; i < deviceSelector.getNumChildComponents(); i ++){
LookAndFeel_V4 *lfv4 = dynamic_cast<LookAndFeel_V4*>(&deviceSelector.getChildComponent(i) ->getLookAndFeel());
if (lfv4) {
lfv4->setColour(ComboBox::ColourIds::backgroundColourId, Colour::fromHSV (0.0f, 0.0f, 0.2f, 1.0f));
lfv4->setColour(ListBox::ColourIds::backgroundColourId, Colour::fromHSV (0.0f, 0.0f, 0.2f, 1.0f));
lfv4->setColour(TextButton::ColourIds::buttonColourId, Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f));
}
}
} }
void paint (Graphics& g) override void paint (Graphics& g) override
@ -586,20 +591,33 @@ public:
#if JUCE_ANDROID || JUCE_IOS #if JUCE_ANDROID || JUCE_IOS
bool autoOpenMidiDevices = true bool autoOpenMidiDevices = true
#else #else
bool autoOpenMidiDevices = true bool autoOpenMidiDevices = false
#endif #endif
) )
: DocumentWindow ("", Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f), DocumentWindow::minimiseButton | DocumentWindow::closeButton) #if JUCE_MAC
, menuBar(this) : DocumentWindow ("", backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
#endif
#if ! JUCE_MAC
: DocumentWindow (title, Colour::fromHSV (0.0f, 0.0f, 0.1f, 0.5f), DocumentWindow::minimiseButton | DocumentWindow::closeButton),
#endif
menuBar(this)
#if ! JUCE_MAC #if ! JUCE_MAC
, optionsButton ("Settings") , optionsButton ("Settings")
#endif #endif
{ {
#if JUCE_IOS || JUCE_ANDROID #if JUCE_IOS || JUCE_ANDROID
setTitleBarHeight (0); setTitleBarHeight (0);
#else #else
LookAndFeel_V4 *lfv4 = dynamic_cast<LookAndFeel_V4*>(&getLookAndFeel());
if (lfv4) {
lfv4->getCurrentColourScheme().setUIColour (LookAndFeel_V4::ColourScheme::widgetBackground, Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f));
}
setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false); setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false);
#if JUCE_MAC #if JUCE_MAC
setUsingNativeTitleBar(true); setUsingNativeTitleBar(true);
menu.addItem (1, TRANS("Audio/MIDI Settings...")); menu.addItem (1, TRANS("Audio/MIDI Settings..."));
@ -709,20 +727,7 @@ public:
void menuBarActivated (bool isActive) override {}; void menuBarActivated (bool isActive) override {};
void buttonClicked (Button*) override
{
pluginHolder->showAudioSettingsDialog();
// PopupMenu m;
// m.addItem (1, TRANS("Audio/MIDI Settings..."));
// m.addSeparator();
// m.addItem (2, TRANS("Save current state..."));
// m.addItem (3, TRANS("Load a saved state..."));
// m.addSeparator();
// m.addItem (4, TRANS("Reset to default state"));
// m.showMenuAsync (PopupMenu::Options(),ModalCallbackFunction::forComponent (menuCallback, this));
}
void handleMenuResult (int result) void handleMenuResult (int result)
{ {
@ -745,9 +750,9 @@ public:
void resized() override void resized() override
{ {
DocumentWindow::resized(); DocumentWindow::resized();
#if ! JUCE_MAC #if ! JUCE_MAC
optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8);
#endif #endif
} }
virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); } virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); }
@ -757,6 +762,22 @@ public:
PopupMenu menu; PopupMenu menu;
private: private:
void buttonClicked (Button*) override
{
pluginHolder->showAudioSettingsDialog();
//PopupMenu m;
//m.addItem (1, TRANS("Audio/MIDI Settings..."));
//m.addSeparator();
//m.addItem (2, TRANS("Save current state..."));
//m.addItem (3, TRANS("Load a saved state..."));
//m.addSeparator();
//m.addItem (4, TRANS("Reset to default state"));
//m.showMenuAsync (PopupMenu::Options(),
// ModalCallbackFunction::forComponent (menuCallback, this));
}
//============================================================================== //==============================================================================
class MainContentComponent : public Component, class MainContentComponent : public Component,
private Value::Listener, private Value::Listener,
@ -808,8 +829,9 @@ private:
notification.setBounds (r.removeFromTop (NotificationArea::height)); notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr) if (editor != nullptr)
editor->setBounds (editor->getLocalArea (this, r) editor->setBounds (editor->getLocalArea (this, r.toFloat())
.withPosition (r.getTopLeft().transformedBy (editor->getTransform().inverted()))); .withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted()))
.toNearestInt());
} }
private: private:
@ -824,7 +846,7 @@ private:
#if JUCE_IOS || JUCE_ANDROID #if JUCE_IOS || JUCE_ANDROID
settingsButton ("Unmute Input") settingsButton ("Unmute Input")
#else #else
settingsButton ("Settings...") settingsButton ("Settings")
#endif #endif
{ {
setOpaque (true); setOpaque (true);
@ -919,9 +941,9 @@ private:
}; };
//============================================================================== //==============================================================================
#if ! JUCE_MAC #if ! JUCE_MAC
TextButton optionsButton; TextButton optionsButton;
#endif #endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow)
}; };

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<JUCERPROJECT id="mxW328" name="OB-Xd" projectType="audioplug" version="2.3.0" <JUCERPROJECT id="mxW328" name="OB-Xd" projectType="audioplug" version="2.4.0"
bundleIdentifier="com.discoDSP.Obxd" includeBinaryInAppConfig="1" bundleIdentifier="com.discoDSP.Obxd" includeBinaryInAppConfig="1"
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="discoDSP" pluginManufacturerCode="DDSP" pluginCode="Obxd" pluginManufacturer="discoDSP" pluginManufacturerCode="DDSP" pluginCode="Obxd"
@ -17,6 +17,8 @@
<MAINGROUP id="NZ3n4V" name="OB-Xd"> <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="{BD020CFA-798B-F1A1-A6C7-7559BD467248}" name="Components"> <GROUP id="{BD020CFA-798B-F1A1-A6C7-7559BD467248}" name="Components">
<FILE id="XnxhrR" name="PresetBar.h" compile="0" resource="0" file="Source/Components/PresetBar.h"/>
<FILE id="GHGyel" name="PresetBar.cpp" compile="1" resource="0" file="Source/Components/PresetBar.cpp"/>
<FILE id="qhLBZY" name="SetPresetNameWindow.cpp" compile="1" resource="0" <FILE id="qhLBZY" name="SetPresetNameWindow.cpp" compile="1" resource="0"
file="Source/Components/SetPresetNameWindow.cpp"/> file="Source/Components/SetPresetNameWindow.cpp"/>
<FILE id="ysasLl" name="SetPresetNameWindow.h" compile="0" resource="0" <FILE id="ysasLl" name="SetPresetNameWindow.h" compile="0" resource="0"
@ -26,6 +28,8 @@
<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"/>
<FILE id="kwaOoZ" name="main.png" compile="0" resource="1" file="Source/Images/main.png"/> <FILE id="kwaOoZ" name="main.png" compile="0" resource="1" file="Source/Images/main.png"/>
<FILE id="l84SVW" name="menu.png" compile="0" resource="1" file="Source/Images/menu.png"/> <FILE id="l84SVW" name="menu.png" compile="0" resource="1" file="Source/Images/menu.png"/>
<FILE id="NKGY6X" name="presetnavigation.svg" compile="0" resource="1"
file="Source/Images/presetnavigation.svg"/>
</GROUP> </GROUP>
<GROUP id="{6995BDF2-263F-3CA7-8CA4-4E21F325477A}" name="Gui"> <GROUP id="{6995BDF2-263F-3CA7-8CA4-4E21F325477A}" name="Gui">
<FILE id="zJoidp" name="ButtonList.h" compile="0" resource="0" file="Source/Gui/ButtonList.h"/> <FILE id="zJoidp" name="ButtonList.h" compile="0" resource="0" file="Source/Gui/ButtonList.h"/>
@ -76,7 +80,7 @@
stripLocalSymbols="0" linkTimeOptimisation="0"/> stripLocalSymbols="0" linkTimeOptimisation="0"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="OB-Xd" <CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="OB-Xd"
stripLocalSymbols="1" linkTimeOptimisation="1" osxCompatibility="10.9 SDK" stripLocalSymbols="1" linkTimeOptimisation="1" osxCompatibility="10.9 SDK"
enablePluginBinaryCopyStep="0" usePrecompiledHeaderFile="1"/> enablePluginBinaryCopyStep="1"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="Modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>
@ -124,7 +128,8 @@
<CONFIGURATION isDebug="1" name="Debug" targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common" <CONFIGURATION isDebug="1" name="Debug" targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"
useRuntimeLibDLL="0" enablePluginBinaryCopyStep="1"/> useRuntimeLibDLL="0" enablePluginBinaryCopyStep="1"/>
<CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64" <CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64"
targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"/> targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"
enablePluginBinaryCopyStep="1"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="Modules"/> <MODULEPATH id="juce_opengl" path="Modules"/>

View file

@ -0,0 +1,251 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 6.0.8
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
#include "../PluginEditor.h"
//[/Headers]
#include "PresetBar.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
PresetBar::PresetBar (ObxdAudioProcessorEditor &gui)
: editor(gui)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
presetNameLb.reset (new juce::Label ("new label",
TRANS("---\n")));
addAndMakeVisible (presetNameLb.get());
presetNameLb->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
presetNameLb->setJustificationType (juce::Justification::centred);
presetNameLb->setEditable (false, false, false);
presetNameLb->setColour (juce::TextEditor::textColourId, juce::Colours::black);
presetNameLb->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000));
presetNameLb->setBounds (24, 8, 368, 24);
previousBtn.reset (new juce::ImageButton ("new button"));
addAndMakeVisible (previousBtn.get());
previousBtn->setButtonText (juce::String());
previousBtn->addListener (this);
previousBtn->setImages (false, true, true,
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000));
previousBtn->setBounds (407, 8, 20, 24);
nextBtn.reset (new juce::ImageButton ("new button"));
addAndMakeVisible (nextBtn.get());
nextBtn->setButtonText (juce::String());
nextBtn->addListener (this);
nextBtn->setImages (false, true, true,
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000));
nextBtn->setBounds (435, 8, 20, 24);
drawable1 = juce::Drawable::createFromImageData (presetnavigation_svg, presetnavigation_svgSize);
//[UserPreSize]
//[/UserPreSize]
setSize (471, 40);
//[Constructor] You can add your own custom stuff here..
startTimer(500);
//[/Constructor]
}
PresetBar::~PresetBar()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
presetNameLb = nullptr;
previousBtn = nullptr;
nextBtn = nullptr;
drawable1 = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void PresetBar::paint (juce::Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (juce::Colours::black);
{
int x = 0, y = 0, width = 471, height = 40;
//[UserPaintCustomArguments] Customize the painting arguments here..
//[/UserPaintCustomArguments]
g.setColour (juce::Colours::black);
jassert (drawable1 != nullptr);
if (drawable1 != nullptr)
drawable1->drawWithin (g, juce::Rectangle<int> (x, y, width, height).toFloat(),
juce::RectanglePlacement::centred, 1.000f);
}
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void PresetBar::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void PresetBar::buttonClicked (juce::Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == previousBtn.get())
{
//[UserButtonCode_previousBtn] -- add your button handler code here..
editor.prevProgram();
//[/UserButtonCode_previousBtn]
}
else if (buttonThatWasClicked == nextBtn.get())
{
//[UserButtonCode_nextBtn] -- add your button handler code here..
editor.nextProgram();
//[/UserButtonCode_nextBtn]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void PresetBar::timerCallback() {
update();
}
void PresetBar::update(){
presetNameLb->setText(editor.getCurrentProgramName(), NotificationType::dontSendNotification);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Projucer information section --
This is where the Projucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="PresetBar" componentName=""
parentClasses="public juce::Component, public Timer" constructorParams="ObxdAudioProcessorEditor &amp;gui"
variableInitialisers="editor(gui)" snapPixels="8" snapActive="1"
snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="471"
initialHeight="40">
<BACKGROUND backgroundColour="ff000000">
<IMAGE pos="0 0 471 40" resource="presetnavigation_svg" opacity="1.0"
mode="1"/>
</BACKGROUND>
<LABEL name="new label" id="3debca48aa2294c8" memberName="presetNameLb"
virtualName="" explicitFocusOrder="0" pos="24 8 368 24" edTextCol="ff000000"
edBkgCol="0" labelText="---&#10;" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<IMAGEBUTTON name="new button" id="ecc6403235eead2" memberName="previousBtn"
virtualName="" explicitFocusOrder="0" pos="407 8 20 24" buttonText=""
connectedEdges="0" needsCallback="1" radioGroupId="0" keepProportions="1"
resourceNormal="" opacityNormal="1.0" colourNormal="0" resourceOver=""
opacityOver="1.0" colourOver="0" resourceDown="" opacityDown="1.0"
colourDown="0"/>
<IMAGEBUTTON name="new button" id="fab648fbebd2d318" memberName="nextBtn"
virtualName="" explicitFocusOrder="0" pos="435 8 20 24" buttonText=""
connectedEdges="0" needsCallback="1" radioGroupId="0" keepProportions="1"
resourceNormal="" opacityNormal="1.0" colourNormal="0" resourceOver=""
opacityOver="1.0" colourOver="0" resourceDown="" opacityDown="1.0"
colourDown="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//==============================================================================
// Binary resources - be careful not to edit any of these sections!
// JUCER_RESOURCE: presetnavigation_svg, 2078, "../../../../GitHub/OB-Xd/Source/Images/presetnavigation.svg"
static const unsigned char resource_PresetBar_presetnavigation_svg[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101,110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,32,
115,116,97,110,100,97,108,111,110,101,61,34,110,111,34,63,62,10,60,33,68,79,67,84,89,80,69,32,115,118,103,32,80,85,66,76,73,67,32,34,45,47,47,87,51,67,47,47,68,84,68,32,83,86,71,32,49,46,49,47,47,69,78,
34,32,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,71,114,97,112,104,105,99,115,47,83,86,71,47,49,46,49,47,68,84,68,47,115,118,103,49,49,46,100,116,100,34,62,10,60,115,118,103,32,
119,105,100,116,104,61,34,49,48,48,37,34,32,104,101,105,103,104,116,61,34,49,48,48,37,34,32,118,105,101,119,66,111,120,61,34,48,32,48,32,52,55,49,32,51,57,34,32,118,101,114,115,105,111,110,61,34,49,46,
49,34,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,50,48,48,48,47,115,118,103,34,32,120,109,108,110,115,58,120,108,105,110,107,61,34,104,116,116,112,58,
47,47,119,119,119,46,119,51,46,111,114,103,47,49,57,57,57,47,120,108,105,110,107,34,32,120,109,108,58,115,112,97,99,101,61,34,112,114,101,115,101,114,118,101,34,32,120,109,108,110,115,58,115,101,114,105,
102,61,34,104,116,116,112,58,47,47,119,119,119,46,115,101,114,105,102,46,99,111,109,47,34,32,115,116,121,108,101,61,34,102,105,108,108,45,114,117,108,101,58,101,118,101,110,111,100,100,59,99,108,105,112,
45,114,117,108,101,58,101,118,101,110,111,100,100,59,115,116,114,111,107,101,45,108,105,110,101,99,97,112,58,114,111,117,110,100,59,115,116,114,111,107,101,45,108,105,110,101,106,111,105,110,58,114,111,
117,110,100,59,115,116,114,111,107,101,45,109,105,116,101,114,108,105,109,105,116,58,49,46,53,59,34,62,10,32,32,32,32,60,114,101,99,116,32,120,61,34,48,34,32,121,61,34,48,34,32,119,105,100,116,104,61,
34,52,55,49,34,32,104,101,105,103,104,116,61,34,51,57,34,47,62,10,32,32,32,32,60,112,97,116,104,32,100,61,34,77,51,57,56,44,57,46,50,48,53,67,51,57,56,44,55,46,52,51,54,32,51,57,54,46,53,54,52,44,54,32,
51,57,52,46,55,57,53,44,54,76,50,52,46,50,48,53,44,54,67,50,50,46,52,51,54,44,54,32,50,49,44,55,46,52,51,54,32,50,49,44,57,46,50,48,53,76,50,49,44,50,57,46,55,57,53,67,50,49,44,51,49,46,53,54,52,32,50,
50,46,52,51,54,44,51,51,32,50,52,46,50,48,53,44,51,51,76,51,57,52,46,55,57,53,44,51,51,67,51,57,54,46,53,54,52,44,51,51,32,51,57,56,44,51,49,46,53,54,52,32,51,57,56,44,50,57,46,55,57,53,76,51,57,56,44,
57,46,50,48,53,90,34,32,115,116,121,108,101,61,34,115,116,114,111,107,101,58,114,103,98,40,49,50,49,44,49,50,49,44,49,50,49,41,59,115,116,114,111,107,101,45,119,105,100,116,104,58,49,112,120,59,34,47,
62,10,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,49,44,48,44,48,44,49,44,52,46,50,50,50,54,54,44,49,49,46,48,50,52,53,41,34,62,10,32,32,32,32,32,32,32,32,
60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,50,52,44,48,44,48,44,50,52,44,52,48,54,46,54,50,49,44,49,55,46,50,54,52,53,41,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,
60,112,97,116,104,32,100,61,34,77,48,46,52,50,53,44,45,48,46,49,53,54,67,48,46,52,51,53,44,45,48,46,49,52,55,32,48,46,52,51,57,44,45,48,46,49,51,53,32,48,46,52,51,57,44,45,48,46,49,50,50,67,48,46,52,51,
57,44,45,48,46,49,48,57,32,48,46,52,51,53,44,45,48,46,48,57,55,32,48,46,52,50,53,44,45,48,46,48,56,56,67,48,46,52,49,53,44,45,48,46,48,55,56,32,48,46,52,48,52,44,45,48,46,48,55,51,32,48,46,51,57,49,44,
45,48,46,48,55,51,67,48,46,51,55,55,44,45,48,46,48,55,51,32,48,46,51,54,54,44,45,48,46,48,55,56,32,48,46,51,53,54,44,45,48,46,48,56,55,76,48,46,49,49,50,44,45,48,46,51,51,50,67,48,46,49,48,50,44,45,48,
46,51,52,49,32,48,46,48,57,56,44,45,48,46,51,53,51,32,48,46,48,57,56,44,45,48,46,51,54,54,67,48,46,48,57,56,44,45,48,46,51,56,32,48,46,49,48,51,44,45,48,46,51,57,49,32,48,46,49,49,50,44,45,48,46,52,48,
49,76,48,46,51,53,54,44,45,48,46,54,52,53,67,48,46,51,54,54,44,45,48,46,54,53,52,32,48,46,51,55,55,44,45,48,46,54,53,57,32,48,46,51,57,49,44,45,48,46,54,53,57,67,48,46,52,48,52,44,45,48,46,54,53,57,32,
48,46,52,49,53,44,45,48,46,54,53,52,32,48,46,52,50,53,44,45,48,46,54,52,53,67,48,46,52,51,53,44,45,48,46,54,51,53,32,48,46,52,51,57,44,45,48,46,54,50,52,32,48,46,52,51,57,44,45,48,46,54,49,67,48,46,52,
51,57,44,45,48,46,53,57,55,32,48,46,52,51,53,44,45,48,46,53,56,53,32,48,46,52,50,53,44,45,48,46,53,55,54,76,48,46,50,49,53,44,45,48,46,51,54,54,76,48,46,52,50,53,44,45,48,46,49,53,54,90,34,32,115,116,
121,108,101,61,34,102,105,108,108,58,114,103,98,40,49,50,49,44,49,50,49,44,49,50,49,41,59,102,105,108,108,45,114,117,108,101,58,110,111,110,122,101,114,111,59,34,47,62,10,32,32,32,32,32,32,32,32,60,47,
103,62,10,32,32,32,32,60,47,103,62,10,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,49,44,48,44,48,44,49,44,51,49,46,50,50,50,55,44,49,49,46,48,50,52,53,41,34,
62,10,32,32,32,32,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,50,52,44,48,44,48,44,50,52,44,52,48,54,46,54,50,49,44,49,55,46,50,54,52,53,41,34,62,10,32,32,
32,32,32,32,32,32,32,32,32,32,60,112,97,116,104,32,100,61,34,77,48,46,51,50,50,44,45,48,46,51,54,54,76,48,46,49,49,50,44,45,48,46,53,55,54,67,48,46,49,48,51,44,45,48,46,53,56,53,32,48,46,48,57,56,44,45,
48,46,53,57,55,32,48,46,48,57,56,44,45,48,46,54,49,67,48,46,48,57,56,44,45,48,46,54,50,52,32,48,46,49,48,50,44,45,48,46,54,51,53,32,48,46,49,49,50,44,45,48,46,54,52,53,67,48,46,49,50,50,44,45,48,46,54,
53,52,32,48,46,49,51,51,44,45,48,46,54,53,57,32,48,46,49,52,54,44,45,48,46,54,53,57,67,48,46,49,54,44,45,48,46,54,53,57,32,48,46,49,55,49,44,45,48,46,54,53,52,32,48,46,49,56,49,44,45,48,46,54,52,53,76,
48,46,52,50,53,44,45,48,46,52,48,49,67,48,46,52,51,53,44,45,48,46,51,57,49,32,48,46,52,51,57,44,45,48,46,51,56,32,48,46,52,51,57,44,45,48,46,51,54,54,67,48,46,52,51,57,44,45,48,46,51,53,51,32,48,46,52,
51,53,44,45,48,46,51,52,49,32,48,46,52,50,53,44,45,48,46,51,51,50,76,48,46,49,56,49,44,45,48,46,48,56,55,67,48,46,49,55,49,44,45,48,46,48,55,56,32,48,46,49,54,44,45,48,46,48,55,51,32,48,46,49,52,54,44,
45,48,46,48,55,51,67,48,46,49,51,51,44,45,48,46,48,55,51,32,48,46,49,50,50,44,45,48,46,48,55,56,32,48,46,49,49,50,44,45,48,46,48,56,56,67,48,46,49,48,50,44,45,48,46,48,57,55,32,48,46,48,57,56,44,45,48,
46,49,48,57,32,48,46,48,57,56,44,45,48,46,49,50,50,67,48,46,48,57,56,44,45,48,46,49,51,53,32,48,46,49,48,51,44,45,48,46,49,52,55,32,48,46,49,49,50,44,45,48,46,49,53,54,76,48,46,51,50,50,44,45,48,46,51,
54,54,90,34,32,115,116,121,108,101,61,34,102,105,108,108,58,114,103,98,40,49,50,49,44,49,50,49,44,49,50,49,41,59,102,105,108,108,45,114,117,108,101,58,110,111,110,122,101,114,111,59,34,47,62,10,32,32,
32,32,32,32,32,32,60,47,103,62,10,32,32,32,32,60,47,103,62,10,60,47,115,118,103,62,10,0,0};
const char* PresetBar::presetnavigation_svg = (const char*) resource_PresetBar_presetnavigation_svg;
const int PresetBar::presetnavigation_svgSize = 2078;
//[EndFile] You can add extra defines here...
//[/EndFile]

View file

@ -0,0 +1,79 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 6.0.8
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited.
==============================================================================
*/
#pragma once
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
class ObxdAudioProcessorEditor;
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Projucer.
Describe your class and how it works here!
//[/Comments]
*/
class PresetBar : public juce::Component,
public Timer,
public juce::Button::Listener
{
public:
//==============================================================================
PresetBar (ObxdAudioProcessorEditor &gui);
~PresetBar() override;
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void timerCallback() override;
void update();
//[/UserMethods]
void paint (juce::Graphics& g) override;
void resized() override;
void buttonClicked (juce::Button* buttonThatWasClicked) override;
// Binary resources:
static const char* presetnavigation_svg;
static const int presetnavigation_svgSize;
private:
//[UserVariables] -- You can add your own custom variables in this section.
ObxdAudioProcessorEditor &editor;
//[/UserVariables]
//==============================================================================
std::unique_ptr<juce::Label> presetNameLb;
std::unique_ptr<juce::ImageButton> previousBtn;
std::unique_ptr<juce::ImageButton> nextBtn;
std::unique_ptr<juce::Drawable> drawable1;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PresetBar)
};
//[EndFile] You can add extra defines here...
//[/EndFile]

View file

@ -31,6 +31,8 @@ public:
int controllers[255]; int controllers[255];
int controllers_default[255]; int controllers_default[255];
std::map<String, int> mapping;
bool loaded = false; bool loaded = false;
MidiMap() MidiMap()
{ {
@ -39,243 +41,320 @@ public:
} }
void reset(){ void reset(){
for(int i = 0 ; i < 255;i++){ for(int i = 0 ; i < 255;i++){
controllers[i] = 0; controllers[i] = -1;
controllers_default[i] = 0; controllers_default[i] = -1;
} }
} }
void set_default(){ void set_default(){
int midicc = 71; int midicc = 71;
controllers[midicc] = controllers_default[midicc] = VOLUME; controllers[midicc] = controllers_default[midicc] = VOLUME;
mapping["VOLUME"]=VOLUME;
midicc = 15; midicc = 15;
controllers[midicc] = controllers_default[midicc] = VOICE_COUNT; controllers[midicc] = controllers_default[midicc] = VOICE_COUNT;
mapping["VOICE_COUNT"]=VOICE_COUNT;
midicc = 33; midicc = 33;
controllers[midicc] = controllers_default[midicc] = TUNE; controllers[midicc] = controllers_default[midicc] = TUNE;
mapping["TUNE"]=TUNE;
midicc = 17; midicc = 17;
controllers[midicc] = controllers_default[midicc] = OCTAVE; controllers[midicc] = controllers_default[midicc] = OCTAVE;
mapping["OCTAVE"]=OCTAVE;
midicc = 118; midicc = 118;
controllers[midicc] = controllers_default[midicc] = BENDRANGE; controllers[midicc] = controllers_default[midicc] = BENDRANGE;
mapping["BENDRANGE"]=BENDRANGE;
midicc = 34; midicc = 34;
controllers[midicc] = controllers_default[midicc] = BENDOSC2; controllers[midicc] = controllers_default[midicc] = BENDOSC2;
mapping["BENDOSC2"]=BENDOSC2;
midicc = 35; midicc = 35;
controllers[midicc] = controllers_default[midicc] = LEGATOMODE; controllers[midicc] = controllers_default[midicc] = LEGATOMODE;
mapping["LEGATOMODE"]=LEGATOMODE;
midicc = 75; midicc = 75;
controllers[midicc] = controllers_default[midicc] = BENDLFORATE; controllers[midicc] = controllers_default[midicc] = BENDLFORATE;
mapping["BENDLFORATE"]=BENDLFORATE;
midicc = 76; midicc = 76;
controllers[midicc] = controllers_default[midicc] = VFLTENV; controllers[midicc] = controllers_default[midicc] = VFLTENV;
mapping["VFLTENV"]=VFLTENV;
midicc = 20; midicc = 20;
controllers[midicc] = controllers_default[midicc] = VAMPENV; controllers[midicc] = controllers_default[midicc] = VAMPENV;
mapping["VAMPENV"]=VAMPENV;
midicc = 21; midicc = 21;
controllers[midicc] = controllers_default[midicc] = ASPLAYEDALLOCATION; controllers[midicc] = controllers_default[midicc] = ASPLAYEDALLOCATION;
mapping["ASPLAYEDALLOCATION"]=ASPLAYEDALLOCATION;
midicc = 23; midicc = 23;
controllers[midicc] = controllers_default[midicc] = PORTAMENTO; controllers[midicc] = controllers_default[midicc] = PORTAMENTO;
mapping["PORTAMENTO"]=PORTAMENTO;
midicc = 16; midicc = 16;
controllers[midicc] = controllers_default[midicc] = UNISON; controllers[midicc] = controllers_default[midicc] = UNISON;
mapping["UNISON"]=UNISON;
midicc = 24; midicc = 24;
controllers[midicc] = controllers_default[midicc] = UDET; controllers[midicc] = controllers_default[midicc] = UDET;
mapping["UDET"]=UDET;
midicc = 43; midicc = 43;
controllers[midicc] = controllers_default[midicc] = OSC2_DET; controllers[midicc] = controllers_default[midicc] = OSC2_DET;
mapping["OSC2_DET"]=OSC2_DET;
midicc = 19; midicc = 19;
controllers[midicc] = controllers_default[midicc] = LFOFREQ; controllers[midicc] = controllers_default[midicc] = LFOFREQ;
mapping["LFOFREQ"]=LFOFREQ;
midicc = 44; midicc = 44;
controllers[midicc] = controllers_default[midicc] = LFOSINWAVE; controllers[midicc] = controllers_default[midicc] = LFOSINWAVE;
mapping["LFOSINWAVE"]=LFOSINWAVE;
midicc = 45; midicc = 45;
controllers[midicc] = controllers_default[midicc] = LFOSQUAREWAVE; controllers[midicc] = controllers_default[midicc] = LFOSQUAREWAVE;
mapping["LFOSQUAREWAVE"]=LFOSQUAREWAVE;
midicc = 46; midicc = 46;
controllers[midicc] = controllers_default[midicc] = LFOSHWAVE; controllers[midicc] = controllers_default[midicc] = LFOSHWAVE;
mapping["LFOSHWAVE"]=LFOSHWAVE;
midicc = 22; midicc = 22;
controllers[midicc] = controllers_default[midicc] = LFO1AMT; controllers[midicc] = controllers_default[midicc] = LFO1AMT;
mapping["LFO1AMT"]=LFO1AMT;
midicc = 25; midicc = 25;
controllers[midicc] = controllers_default[midicc] = LFO2AMT; controllers[midicc] = controllers_default[midicc] = LFO2AMT;
mapping["LFO2AMT"]=LFO2AMT;
midicc = 47; midicc = 47;
controllers[midicc] = controllers_default[midicc] = LFOOSC1; controllers[midicc] = controllers_default[midicc] = LFOOSC1;
mapping["LFOOSC1"]=LFOOSC1;
midicc = 48; midicc = 48;
controllers[midicc] = controllers_default[midicc] = LFOOSC2; controllers[midicc] = controllers_default[midicc] = LFOOSC2;
mapping["LFOOSC2"]=LFOOSC2;
midicc = 49; midicc = 49;
controllers[midicc] = controllers_default[midicc] = LFOFILTER; controllers[midicc] = controllers_default[midicc] = LFOFILTER;
mapping["LFOFILTER"]=LFOFILTER;
midicc = 50; midicc = 50;
controllers[midicc] = controllers_default[midicc] = LFOPW1; controllers[midicc] = controllers_default[midicc] = LFOPW1;
mapping["LFOPW1"]=LFOPW1;
midicc = 51; midicc = 51;
controllers[midicc] = controllers_default[midicc] = LFOPW2; controllers[midicc] = controllers_default[midicc] = LFOPW2;
mapping["LFOPW2"]=LFOPW2;
midicc = 52; midicc = 52;
controllers[midicc] = controllers_default[midicc] = OSC2HS; controllers[midicc] = controllers_default[midicc] = OSC2HS;
mapping["OSC2HS"]=OSC2HS;
midicc = 53; midicc = 53;
controllers[midicc] = controllers_default[midicc] = XMOD; controllers[midicc] = controllers_default[midicc] = XMOD;
mapping["XMOD"]=XMOD;
midicc = 54; midicc = 54;
controllers[midicc] = controllers_default[midicc] = OSC1P; controllers[midicc] = controllers_default[midicc] = OSC1P;
mapping["OSC1P"]=OSC1P;
midicc = 55; midicc = 55;
controllers[midicc] = controllers_default[midicc] = OSC2P; controllers[midicc] = controllers_default[midicc] = OSC2P;
mapping["OSC2P"]=OSC2P;
midicc = 56; midicc = 56;
controllers[midicc] = controllers_default[midicc] = OSCQuantize; controllers[midicc] = controllers_default[midicc] = OSCQuantize;
mapping["OSCQuantize"]=OSCQuantize;
midicc = 57; midicc = 57;
controllers[midicc] = controllers_default[midicc] = OSC1Saw; controllers[midicc] = controllers_default[midicc] = OSC1Saw;
mapping["OSC1Saw"]=OSC1Saw;
midicc = 58; midicc = 58;
controllers[midicc] = controllers_default[midicc] = OSC1Pul; controllers[midicc] = controllers_default[midicc] = OSC1Pul;
mapping["OSC1Pul"]=OSC1Pul;
midicc = 59; midicc = 59;
controllers[midicc] = controllers_default[midicc] = OSC2Saw; controllers[midicc] = controllers_default[midicc] = OSC2Saw;
mapping["OSC2Saw"]=OSC2Saw;
midicc = 60; midicc = 60;
controllers[midicc] = controllers_default[midicc] = OSC2Pul; controllers[midicc] = controllers_default[midicc] = OSC2Pul;
mapping["OSC2Pul"]=OSC2Pul;
midicc = 61; midicc = 61;
controllers[midicc] = controllers_default[midicc] = PW; controllers[midicc] = controllers_default[midicc] = PW;
mapping["PW"]=PW;
midicc = 62; midicc = 62;
controllers[midicc] = controllers_default[midicc] = BRIGHTNESS; controllers[midicc] = controllers_default[midicc] = BRIGHTNESS;
mapping["BRIGHTNESS"]=BRIGHTNESS;
midicc = 63; midicc = 63;
controllers[midicc] = controllers_default[midicc] = ENVPITCH; controllers[midicc] = controllers_default[midicc] = ENVPITCH;
mapping["ENVPITCH"]=ENVPITCH;
midicc = 77; midicc = 77;
controllers[midicc] = controllers_default[midicc] = OSC1MIX; controllers[midicc] = controllers_default[midicc] = OSC1MIX;
mapping["OSC1MIX"]=OSC1MIX;
midicc = 78; midicc = 78;
controllers[midicc] = controllers_default[midicc] = OSC2MIX; controllers[midicc] = controllers_default[midicc] = OSC2MIX;
mapping["OSC2MIX"]=OSC2MIX;
midicc = 102; midicc = 102;
controllers[midicc] = controllers_default[midicc] = NOISEMIX; controllers[midicc] = controllers_default[midicc] = NOISEMIX;
mapping["NOISEMIX"]=NOISEMIX;
midicc = 103; midicc = 103;
controllers[midicc] = controllers_default[midicc] = FLT_KF; controllers[midicc] = controllers_default[midicc] = FLT_KF;
mapping["FLT_KF"]=FLT_KF;
midicc = 74; midicc = 74;
controllers[midicc] = controllers_default[midicc] = CUTOFF; controllers[midicc] = controllers_default[midicc] = CUTOFF;
mapping["CUTOFF"]=CUTOFF;
midicc = 42; midicc = 42;
controllers[midicc] = controllers_default[midicc] = RESONANCE; controllers[midicc] = controllers_default[midicc] = RESONANCE;
mapping["RESONANCE"]=RESONANCE;
midicc = 104; midicc = 104;
controllers[midicc] = controllers_default[midicc] = MULTIMODE; controllers[midicc] = controllers_default[midicc] = MULTIMODE;
mapping["MULTIMODE"]=MULTIMODE;
midicc = 18; midicc = 18;
controllers[midicc] = controllers_default[midicc] = FILTER_WARM; controllers[midicc] = controllers_default[midicc] = FILTER_WARM;
mapping["FILTER_WARM"]=FILTER_WARM;
midicc = 105; midicc = 105;
controllers[midicc] = controllers_default[midicc] = BANDPASS; controllers[midicc] = controllers_default[midicc] = BANDPASS;
mapping["BANDPASS"]=BANDPASS;
midicc = 106; midicc = 106;
controllers[midicc] = controllers_default[midicc] = FOURPOLE; controllers[midicc] = controllers_default[midicc] = FOURPOLE;
mapping["FOURPOLE"]=FOURPOLE;
midicc = 107; midicc = 107;
controllers[midicc] = controllers_default[midicc] = ENVELOPE_AMT; controllers[midicc] = controllers_default[midicc] = ENVELOPE_AMT;
mapping["ENVELOPE_AMT"]=ENVELOPE_AMT;
midicc = 73; midicc = 73;
controllers[midicc] = controllers_default[midicc] = LATK; controllers[midicc] = controllers_default[midicc] = LATK;
mapping["LATK"]=LATK;
midicc = 36; midicc = 36;
controllers[midicc] = controllers_default[midicc] = LDEC; controllers[midicc] = controllers_default[midicc] = LDEC;
mapping["LDEC"]=LDEC;
midicc = 37; midicc = 37;
controllers[midicc] = controllers_default[midicc] = LSUS; controllers[midicc] = controllers_default[midicc] = LSUS;
mapping["LSUS"]=LSUS;
midicc = 72; midicc = 72;
controllers[midicc] = controllers_default[midicc] = LREL; controllers[midicc] = controllers_default[midicc] = LREL;
mapping["LREL"]=LREL;
midicc = 38; midicc = 38;
controllers[midicc] = controllers_default[midicc] = FATK; controllers[midicc] = controllers_default[midicc] = FATK;
mapping["FATK"]=FATK;
midicc = 39; midicc = 39;
controllers[midicc] = controllers_default[midicc] = FDEC; controllers[midicc] = controllers_default[midicc] = FDEC;
mapping["FDEC"]=FDEC;
midicc = 40; midicc = 40;
controllers[midicc] = controllers_default[midicc] = FSUS; controllers[midicc] = controllers_default[midicc] = FSUS;
mapping["FSUS"]=FSUS;
midicc = 41; midicc = 41;
controllers[midicc] = controllers_default[midicc] = FREL; controllers[midicc] = controllers_default[midicc] = FREL;
mapping["FREL"]=FREL;
midicc = 108; midicc = 108;
controllers[midicc] = controllers_default[midicc] = ENVDER; controllers[midicc] = controllers_default[midicc] = ENVDER;
mapping["ENVDER"]=ENVDER;
midicc = 109; midicc = 109;
controllers[midicc] = controllers_default[midicc] = FILTERDER; controllers[midicc] = controllers_default[midicc] = FILTERDER;
mapping["FILTERDER"]=FILTERDER;
midicc = 110; midicc = 110;
controllers[midicc] = controllers_default[midicc] = PORTADER; controllers[midicc] = controllers_default[midicc] = PORTADER;
mapping["PORTADER"]=PORTADER;
midicc = 81; midicc = 81;
controllers[midicc] = controllers_default[midicc] = PAN1; controllers[midicc] = controllers_default[midicc] = PAN1;
mapping["PAN1"]=PAN1;
midicc = 82; midicc = 82;
controllers[midicc] = controllers_default[midicc] = PAN2; controllers[midicc] = controllers_default[midicc] = PAN2;
mapping["PAN2"]=PAN2;
midicc = 83; midicc = 83;
controllers[midicc] = controllers_default[midicc] = PAN3; controllers[midicc] = controllers_default[midicc] = PAN3;
mapping["PAN3"]=PAN3;
midicc = 84; midicc = 84;
controllers[midicc] = controllers_default[midicc] = PAN4; controllers[midicc] = controllers_default[midicc] = PAN4;
mapping["PAN4"]=PAN4;
midicc = 85; midicc = 85;
controllers[midicc] = controllers_default[midicc] = PAN5; controllers[midicc] = controllers_default[midicc] = PAN5;
mapping["PAN5"]=PAN5;
midicc = 86; midicc = 86;
controllers[midicc] = controllers_default[midicc] = PAN6; controllers[midicc] = controllers_default[midicc] = PAN6;
mapping["PAN6"]=PAN6;
midicc = 87; midicc = 87;
controllers[midicc] = controllers_default[midicc] = PAN7; controllers[midicc] = controllers_default[midicc] = PAN7;
mapping["PAN7"]=PAN7;
midicc = 88; midicc = 88;
controllers[midicc] = controllers_default[midicc] = PAN8; controllers[midicc] = controllers_default[midicc] = PAN8;
mapping["PAN8"]=PAN8;
midicc = 111; midicc = 111;
controllers[midicc] = controllers_default[midicc] = ECONOMY_MODE; controllers[midicc] = controllers_default[midicc] = ECONOMY_MODE;
mapping["ECONOMY_MODE"]=ECONOMY_MODE;
//midicc = 112; //midicc = 112;
//controllers[midicc] = controllers_default[midicc] = LFO_SYNC; //controllers[midicc] = controllers_default[midicc] = LFO_SYNC;
midicc = 113; midicc = 113;
controllers[midicc] = controllers_default[midicc] = PW_ENV; controllers[midicc] = controllers_default[midicc] = PW_ENV;
mapping["PW_ENV"]=PW_ENV;
midicc = 114; midicc = 114;
controllers[midicc] = controllers_default[midicc] = PW_ENV_BOTH; controllers[midicc] = controllers_default[midicc] = PW_ENV_BOTH;
mapping["PW_ENV_BOTH"]=PW_ENV_BOTH;
midicc = 115; midicc = 115;
controllers[midicc] = controllers_default[midicc] = ENV_PITCH_BOTH; controllers[midicc] = controllers_default[midicc] = ENV_PITCH_BOTH;
mapping["ENV_PITCH_BOTH"]=ENV_PITCH_BOTH;
midicc = 116; midicc = 116;
controllers[midicc] = controllers_default[midicc] = FENV_INVERT; controllers[midicc] = controllers_default[midicc] = FENV_INVERT;
mapping["FENV_INVERT"]=FENV_INVERT;
midicc = 117; midicc = 117;
controllers[midicc] = controllers_default[midicc] = PW_OSC2_OFS; controllers[midicc] = controllers_default[midicc] = PW_OSC2_OFS;
mapping["PW_OSC2_OFS"]=PW_OSC2_OFS;
midicc = 118; midicc = 118;
controllers[midicc] = controllers_default[midicc] = LEVEL_DIF; controllers[midicc] = controllers_default[midicc] = LEVEL_DIF;
mapping["LEVEL_DIF"]=LEVEL_DIF;
midicc = 119; midicc = 119;
controllers[midicc] = controllers_default[midicc] = SELF_OSC_PUSH; controllers[midicc] = controllers_default[midicc] = SELF_OSC_PUSH;
mapping["SELF_OSC_PUSH"]=SELF_OSC_PUSH;
} }
@ -290,19 +369,31 @@ public:
void setXml( XmlElement &xml){ void setXml( XmlElement &xml){
for (int i = 0; i < 255; ++i) for (int i = 0; i < 255; ++i)
{ {
xml.setAttribute("Val_" + String(i), controllers[i]); if (controllers[i]!= -1){
xml.setAttribute("MIDI_" +String(i), getTag(controllers[i]));
}
} }
} }
String getTag(int paraId){
for (std::map<String, int>::iterator it = this->mapping.begin(); it != this->mapping.end(); it ++){
if (paraId == it->second){
return it->first;
}
}
return "undefine";
}
int getParaId(String tagName){
return mapping[tagName];
}
void getXml(XmlElement &xml){ void getXml(XmlElement &xml){
for (int i = 0; i < 255; ++i) for (int i = 0; i < 255; ++i)
{ {
int tmp = xml.getIntAttribute("Val_" + String(i), controllers_default[i]); String tmp = xml.getStringAttribute("MIDI_" + String(i), "undefine");
if (tmp == 0){ if (tmp != "undefine"){
tmp = controllers_default[i]; controllers[i] = getParaId(tmp);
} }
controllers[i] = tmp;
} }
// Backward keys // Backward keys
@ -316,4 +407,35 @@ public:
} }
} }
bool loadFile(File& xml){
reset();
set_default();
if (xml.existsAsFile()){
XmlDocument xmlDoc (xml);
this->getXml(*xmlDoc.getDocumentElement());
return true;
}
return false;
}
void updateCC(int idx_para, int midiCC) {
for (int i =0; i < 255; i++) {
if (controllers[i] == idx_para){
controllers[i] = -1;
}
}
controllers[midiCC] = idx_para;
}
void saveFile(File& xml){
XmlElement ele("Data");
this->setXml(ele);
ele.writeToFile(xml, String());
}
void clean(){
reset();
}
}; };

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 471 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
<rect x="0" y="0" width="471" height="39"/>
<path d="M398,9.205C398,7.436 396.564,6 394.795,6L24.205,6C22.436,6 21,7.436 21,9.205L21,29.795C21,31.564 22.436,33 24.205,33L394.795,33C396.564,33 398,31.564 398,29.795L398,9.205Z" style="stroke:rgb(121,121,121);stroke-width:1px;"/>
<g transform="matrix(1,0,0,1,4.22266,11.0245)">
<g transform="matrix(24,0,0,24,406.621,17.2645)">
<path d="M0.425,-0.156C0.435,-0.147 0.439,-0.135 0.439,-0.122C0.439,-0.109 0.435,-0.097 0.425,-0.088C0.415,-0.078 0.404,-0.073 0.391,-0.073C0.377,-0.073 0.366,-0.078 0.356,-0.087L0.112,-0.332C0.102,-0.341 0.098,-0.353 0.098,-0.366C0.098,-0.38 0.103,-0.391 0.112,-0.401L0.356,-0.645C0.366,-0.654 0.377,-0.659 0.391,-0.659C0.404,-0.659 0.415,-0.654 0.425,-0.645C0.435,-0.635 0.439,-0.624 0.439,-0.61C0.439,-0.597 0.435,-0.585 0.425,-0.576L0.215,-0.366L0.425,-0.156Z" style="fill:rgb(121,121,121);fill-rule:nonzero;"/>
</g>
</g>
<g transform="matrix(1,0,0,1,31.2227,11.0245)">
<g transform="matrix(24,0,0,24,406.621,17.2645)">
<path d="M0.322,-0.366L0.112,-0.576C0.103,-0.585 0.098,-0.597 0.098,-0.61C0.098,-0.624 0.102,-0.635 0.112,-0.645C0.122,-0.654 0.133,-0.659 0.146,-0.659C0.16,-0.659 0.171,-0.654 0.181,-0.645L0.425,-0.401C0.435,-0.391 0.439,-0.38 0.439,-0.366C0.439,-0.353 0.435,-0.341 0.425,-0.332L0.181,-0.087C0.171,-0.078 0.16,-0.073 0.146,-0.073C0.133,-0.073 0.122,-0.078 0.112,-0.088C0.102,-0.097 0.098,-0.109 0.098,-0.122C0.098,-0.135 0.103,-0.147 0.112,-0.156L0.322,-0.366Z" style="fill:rgb(121,121,121);fill-rule:nonzero;"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -45,12 +45,14 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
getTopLevelComponent()->addKeyListener (commandManager.getKeyMappings()); getTopLevelComponent()->addKeyListener (commandManager.getKeyMappings());
//Timer::callAfterDelay (100, [this] { this->grabKeyboardFocus(); }); // ensure that key presses are sent to the KeyPressTarget object //Timer::callAfterDelay (100, [this] { this->grabKeyboardFocus(); }); // ensure that key presses are sent to the KeyPressTarget object
#if JUCE_WINDOWS
// No run timer to grab component on window
#else
startTimer(100); // This will fix the issue startTimer(100); // This will fix the issue
#endif
DBG("W: " <<getWidth() << " H:" << getHeight());
loadSkin (processor); loadSkin (processor);
repaint(); repaint();
updateFromHost(); updateFromHost();
@ -103,9 +105,9 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
setSize (1440, 450); setSize (1440, 450);
} }
else { else {
int xScreen = getWidth(), yScreen = getHeight();
if (doc->getTagName() == "PROPERTIES"){ if (doc->getTagName() == "PROPERTIES"){
forEachXmlChildElementWithTagName(*doc, child, "VALUE"){ forEachXmlChildElementWithTagName(*doc, child, "VALUE"){
if (child->hasAttribute("NAME") && child->hasAttribute("x") && child->hasAttribute("y")) { if (child->hasAttribute("NAME") && child->hasAttribute("x") && child->hasAttribute("y")) {
String name = child->getStringAttribute("NAME"); String name = child->getStringAttribute("NAME");
@ -115,7 +117,17 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
int w = child->getIntAttribute("w"); int w = child->getIntAttribute("w");
int h = child->getIntAttribute("h"); int h = child->getIntAttribute("h");
if (name == "guisize"){ setSize (x, y); } if (name == "guisize"){
xScreen = x;
yScreen = y;
if (processor.getShowPresetBar()) {
setSize(xScreen, yScreen +40);
}
else {
setSize(xScreen, yScreen);
}
}
if (name == "resonanceKnob"){ resonanceKnob = addKnob (x, y, d, ownerFilter, RESONANCE, "Resonance", 0); } if (name == "resonanceKnob"){ resonanceKnob = addKnob (x, y, d, ownerFilter, RESONANCE, "Resonance", 0); }
if (name == "cutoffKnob"){ cutoffKnob = addKnob (x, y, d, ownerFilter, CUTOFF, "Cutoff", 0.4); } if (name == "cutoffKnob"){ cutoffKnob = addKnob (x, y, d, ownerFilter, CUTOFF, "Cutoff", 0.4); }
@ -239,6 +251,17 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
} }
} }
} }
presetBar.reset(new PresetBar(*this));
addAndMakeVisible(*presetBar);
presetBar->setVisible(processor.getShowPresetBar());
presetBar->setBounds(
(xScreen - presetBar->getWidth()) / 2, yScreen, presetBar->getWidth(), presetBar->getHeight());
updatePresetBar(false);
} }
// Prepare data // Prepare data
@ -264,7 +287,10 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
} }
createMenu(); createMenu();
ownerFilter.addChangeListener (this); ownerFilter.addChangeListener (this);
repaint(); repaint();
} }
ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor() ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor()
@ -408,6 +434,8 @@ void ObxdAudioProcessorEditor::createMenu ()
PopupMenu bankMenu; PopupMenu bankMenu;
PopupMenu skinMenu; PopupMenu skinMenu;
PopupMenu fileMenu; PopupMenu fileMenu;
PopupMenu viewMenu;
PopupMenu midiMenu;
skins = processor.getSkinFiles(); skins = processor.getSkinFiles();
banks = processor.getBankFiles(); banks = processor.getBankFiles();
{ {
@ -505,12 +533,62 @@ void ObxdAudioProcessorEditor::createMenu ()
menu->addSubMenu ("Themes", skinMenu); menu->addSubMenu ("Themes", skinMenu);
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false); // About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
} }
viewMenu.addItem(progStart + 1000, "Preset Bar", true, processor.showPresetBar);
menu->addSubMenu ("View", viewMenu);
menuMidiNum = progStart +2000;
createMidi(menuMidiNum, midiMenu);
menu->addSubMenu ("MIDI", midiMenu);
popupMenus.add (menu); popupMenus.add (menu);
} }
void ObxdAudioProcessorEditor::createMidi(int menuNo, PopupMenu &menuMidi) {
File midi_dir = processor.getMidiFolder();
File default_file = midi_dir.getChildFile("Default.xml");
if(default_file.exists()){
if (processor.currentMidiPath != default_file.getFullPathName()){
menuMidi.addItem(menuNo++, default_file.getFileNameWithoutExtension(), true, false);
} else {
menuMidi.addItem(menuNo++, default_file.getFileNameWithoutExtension(), true, true);
}
midiFiles.add(default_file.getFullPathName());
}
File custom_file = midi_dir.getChildFile("Custom.xml");
if(custom_file.exists()){
if (processor.currentMidiPath != custom_file.getFullPathName()){
menuMidi.addItem(menuNo++, custom_file.getFileNameWithoutExtension(), true, false);
} else {
menuMidi.addItem(menuNo++, custom_file.getFileNameWithoutExtension(), true, true);
}
midiFiles.add(custom_file.getFullPathName());
}
DirectoryIterator iter (midi_dir, true, "*.xml");
StringArray list;
while (iter.next())
{
list.add(iter.getFile().getFullPathName());
}
list.sort(true);
for (int i =0; i < list.size() ; i ++){
File f (list[i]);
if (f.getFileNameWithoutExtension() != "Default" && f.getFileNameWithoutExtension() != "Custom" && f.getFileNameWithoutExtension() != "Config") {
if (processor.currentMidiPath != f.getFullPathName()){
menuMidi.addItem(menuNo++, f.getFileNameWithoutExtension(), true, false);
} else {
menuMidi.addItem(menuNo++, f.getFileNameWithoutExtension(), true, true);
}
midiFiles.add(f.getFullPathName());
}
}
}
void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos) void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
{ {
createMenu();
int result = popupMenus[0]->showAt (Rectangle<int> (pos.getX(), pos.getY(), 1, 1)); int result = popupMenus[0]->showAt (Rectangle<int> (pos.getX(), pos.getY(), 1, 1));
if (result >= (skinStart + 1) && result <= (skinStart + skins.size())) if (result >= (skinStart + 1) && result <= (skinStart + skins.size()))
@ -546,6 +624,43 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
else if (result < progStart){ else if (result < progStart){
MenuActionCallback(result); MenuActionCallback(result);
} }
else if (result == progStart + 1000){
processor.setShowPresetBar(!processor.getShowPresetBar());
//createMenu();
updatePresetBar();
}
else if (result >= menuMidiNum){
unsigned int selected_idx = result - menuMidiNum;
if (selected_idx >= 0 && selected_idx < midiFiles.size()){
File f(midiFiles[selected_idx]);
if (f.exists()) {
processor.currentMidiPath = midiFiles[selected_idx];
processor.bindings.loadFile(f);
processor.updateConfig();
//createMenu();
}
}
}
}
void ObxdAudioProcessorEditor::updatePresetBar(bool resize){
DBG(" H: " << getHeight() <<" W:" <<getWidth() << " CW:"<<presetBar->getWidth() << " CH" <<presetBar->getHeight() << " CX:" <<presetBar->getX() << " CY: " <<presetBar->getY());
if (processor.getShowPresetBar()) {
if (resize) {
this->setSize(this->getWidth(), this->getHeight() + 40);
}
presetBar->setVisible(true);
}
else if (presetBar->isVisible()) {
if (resize) {
this->setSize(this->getWidth(), this->getHeight() - 40);
}
presetBar->setVisible(false);
}
presetBar->update();
} }
void ObxdAudioProcessorEditor::MenuActionCallback(int action){ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
@ -563,7 +678,7 @@ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
if (result == file || result.copyFileTo(file)){ if (result == file || result.copyFileTo(file)){
processor.loadFromFXBFile(file); processor.loadFromFXBFile(file);
processor.scanAndUpdateBanks(); processor.scanAndUpdateBanks();
createMenu(); //createMenu();
} }
} }
}; };
@ -619,7 +734,7 @@ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
if (name.isNotEmpty()) if (name.isNotEmpty())
{ {
processor.newPreset(name); processor.newPreset(name);
createMenu(); //createMenu();
} }
} }
@ -648,7 +763,7 @@ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
if (name.isNotEmpty()) if (name.isNotEmpty())
{ {
processor.changePresetName(name); processor.changePresetName(name);
createMenu(); //createMenu();
} }
} }
@ -666,7 +781,7 @@ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
{ {
if(NativeMessageBox::showOkCancelBox(AlertWindow::NoIcon, "Delete Preset", "Delete current preset " + processor.currentPreset + "?")){ if(NativeMessageBox::showOkCancelBox(AlertWindow::NoIcon, "Delete Preset", "Delete current preset " + processor.currentPreset + "?")){
processor.deletePreset(); processor.deletePreset();
createMenu(); //createMenu();
} }
return; return;
} }
@ -684,7 +799,7 @@ void ObxdAudioProcessorEditor::MenuActionCallback(int action){
DBG("Import Preset: " << result.getFileName()); DBG("Import Preset: " << result.getFileName());
//if (result == file || result.copyFileTo(file)){ //if (result == file || result.copyFileTo(file)){
processor.loadPreset(result); processor.loadPreset(result);
createMenu(); //createMenu();
//} //}
} }
}; };
@ -722,7 +837,11 @@ void ObxdAudioProcessorEditor::nextProgram() {
if (cur == processor.getNumPrograms()) { if (cur == processor.getNumPrograms()) {
cur = 0; cur = 0;
} }
processor.setCurrentProgram (cur); processor.setCurrentProgram (cur, false);
needNotifytoHost = true;
countTimer = 0;
clean(); clean();
loadSkin (processor); loadSkin (processor);
} }
@ -731,7 +850,11 @@ void ObxdAudioProcessorEditor::prevProgram() {
if (cur < 0) { if (cur < 0) {
cur = processor.getNumPrograms() - 1; cur = processor.getNumPrograms() - 1;
} }
processor.setCurrentProgram (cur); processor.setCurrentProgram (cur, false);
needNotifytoHost = true;
countTimer = 0;
clean(); clean();
loadSkin (processor); loadSkin (processor);
} }
@ -754,6 +877,7 @@ void ObxdAudioProcessorEditor::buttonClicked (Button* b)
auto toggleButton = dynamic_cast<TooglableButton*> (b); auto toggleButton = dynamic_cast<TooglableButton*> (b);
if (toggleButton == midiUnlearnButton){ if (toggleButton == midiUnlearnButton){
if (midiUnlearnButton->getToggleState()){ if (midiUnlearnButton->getToggleState()){
countTimerForLed = 0;
processor.getMidiMap().reset(); processor.getMidiMap().reset();
processor.getMidiMap().set_default(); processor.getMidiMap().set_default();
processor.sendChangeMessage(); processor.sendChangeMessage();
@ -781,9 +905,10 @@ void ObxdAudioProcessorEditor::updateFromHost() {
} }
// Set to unlearn to false // Set to unlearn to false
if ( midiUnlearnButton && midiUnlearnButton->getToggleState()) { //if ( midiUnlearnButton && midiUnlearnButton->getToggleState()) {
midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification); // Thread::sleep(500);
} // midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification);
//}
repaint(); repaint();
} }
@ -838,6 +963,67 @@ void ObxdAudioProcessorEditor::paint(Graphics& g)
} }
bool ObxdAudioProcessorEditor::isInterestedInFileDrag(const StringArray& files)
{
StringArray extensions;
extensions.add(".fxp");
extensions.add(".fxb");
if (files.size() == 1) {
File file = File(files[0]);
String ext = file.getFileExtension().toLowerCase();
return file.existsAsFile() && extensions.contains(ext);
} else {
for (int q = 0; q < files.size(); q++) {
File file = File(files[q]);
String ext = file.getFileExtension().toLowerCase();
if (ext == ".fxb" || ext == ".fxp") {
return true;
}
}
}
return false;
}
void ObxdAudioProcessorEditor::filesDropped(const StringArray& files, int x, int y)
{
if (files.size() == 1) {
File file = File(files[0]);
String ext = file.getFileExtension().toLowerCase();
if (ext == ".fxp") {
processor.loadPreset(file);
//createMenu();
} else if (ext == ".fxb") {
auto name = file.getFileName().replace("%20", " ");
auto result = processor.getBanksFolder().getChildFile(name);
if (file.copyFileTo(result)){
processor.loadFromFXBFile(result);
processor.scanAndUpdateBanks();
//createMenu();
}
}
} else {
int i = processor.getCurrentProgram();
for (int q = 0; q < files.size(); q++) {
File file = File(files[q]);
String ext = file.getFileExtension().toLowerCase();
if (ext == ".fxp") {
processor.setCurrentProgram(i++);
processor.loadPreset(file);
}
if (i >=processor.getNumPrograms()){
i = 0;
}
}
processor.sendChangeMessage();
//createMenu();
}
}
/* /*
bool ObxdAudioProcessorEditor::keyPressed(const KeyPress & press) { bool ObxdAudioProcessorEditor::keyPressed(const KeyPress & press) {
if (press.getKeyCode() == '+' || press.getKeyCode() == KeyPress::numberPadAdd) if (press.getKeyCode() == '+' || press.getKeyCode() == KeyPress::numberPadAdd)

View file

@ -18,7 +18,7 @@
#include "Gui/TooglableButton.h" #include "Gui/TooglableButton.h"
#include "Gui/ButtonList.h" #include "Gui/ButtonList.h"
#include "Components/SetPresetNameWindow.h" #include "Components/SetPresetNameWindow.h"
#include "Components/PresetBar.h"
enum KeyPressCommandIDs enum KeyPressCommandIDs
{ {
buttonNextProgram = 1, buttonNextProgram = 1,
@ -55,24 +55,46 @@ class ObxdAudioProcessorEditor : public AudioProcessorEditor
// , public ComboBox::Listener // , public ComboBox::Listener
, public ApplicationCommandTarget , public ApplicationCommandTarget
, public Timer , public Timer
, public FileDragAndDropTarget
{ {
public: public:
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter); ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
~ObxdAudioProcessorEditor(); ~ObxdAudioProcessorEditor();
bool isInterestedInFileDrag(const StringArray& files) override;
void filesDropped(const StringArray& files, int x, int y) override;
void mouseUp (const MouseEvent& e) override; void mouseUp (const MouseEvent& e) override;
void paint (Graphics& g) override; void paint (Graphics& g) override;
void updateFromHost(); void updateFromHost();
String getCurrentProgramName(){
return processor.getProgramName(processor.getCurrentProgram());
}
void updatePresetBar(bool resize=true);
//============================================================================== //==============================================================================
void changeListenerCallback (ChangeBroadcaster* source) override; void changeListenerCallback (ChangeBroadcaster* source) override;
void buttonClicked (Button *) override; void buttonClicked (Button *) override;
//bool keyPressed(const KeyPress & press) override; //bool keyPressed(const KeyPress & press) override;
void timerCallback() override { void timerCallback() override {
#if JUCE_WINDOWS || JUCE_LINUX
// No run timer to grab component on window
#else
this->grabKeyboardFocus(); this->grabKeyboardFocus();
#endif
countTimer ++;
if (countTimer == 4 && needNotifytoHost){
countTimer = 0;
needNotifytoHost= false;
processor.updateHostDisplay();
}
countTimerForLed++;
if (midiUnlearnButton && midiUnlearnButton->getToggleState() && countTimerForLed > 3) {
midiUnlearnButton->setToggleState(false, NotificationType::sendNotification);
countTimerForLed = 0;
}
} }
ApplicationCommandTarget* getNextCommandTarget() override { ApplicationCommandTarget* getNextCommandTarget() override {
return nullptr; return nullptr;
@ -151,9 +173,11 @@ private:
ButtonList* addList(int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name, Image img); ButtonList* addList(int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name, Image img);
void addMenuButton (int x, int y, int d, const Image&); void addMenuButton (int x, int y, int d, const Image&);
void createMenu (); void createMenu ();
void createMidi(int, PopupMenu &);
void resultFromMenu (const Point<int>); void resultFromMenu (const Point<int>);
void clean(); void clean();
void rebuildComponents (ObxdAudioProcessor&); void rebuildComponents (ObxdAudioProcessor&);
void loadSkin(ObxdAudioProcessor&); void loadSkin(ObxdAudioProcessor&);
//============================================================================== //==============================================================================
@ -248,12 +272,21 @@ private:
int progStart; int progStart;
int bankStart; int bankStart;
int skinStart; int skinStart;
Array<File> skins; Array<File> skins;
Array<File> banks; Array<File> banks;
std::unique_ptr<SetPresetNameWindow> setPresetNameWindow; std::unique_ptr<SetPresetNameWindow> setPresetNameWindow;
std::unique_ptr<PresetBar> presetBar;
std::unique_ptr<FileChooser> fileChooser; std::unique_ptr<FileChooser> fileChooser;
// Command manager // Command manager
ApplicationCommandManager commandManager; ApplicationCommandManager commandManager;
int countTimer =0;
bool needNotifytoHost = false;
Array<String> midiFiles;
int menuMidiNum;
int countTimerForLed = 0;
}; };
#endif // PLUGINEDITOR_H_INCLUDED #endif // PLUGINEDITOR_H_INCLUDED

View file

@ -70,7 +70,7 @@ ObxdAudioProcessor::ObxdAudioProcessor()
options.millisecondsBeforeSaving = 2500; options.millisecondsBeforeSaving = 2500;
options.processLock = &configLock; options.processLock = &configLock;
config = std::unique_ptr<PropertiesFile> (new PropertiesFile (getDocumentFolder().getChildFile ("Skin.xml"), options)); config = std::unique_ptr<PropertiesFile> (new PropertiesFile (getDocumentFolder().getChildFile ("Skin.xml"), options));
showPresetBar = config->getBoolValue("presetnavigation");
currentSkin = config->containsKey("skin") ? config->getValue("skin") : "Ilkka Rosma Dark"; currentSkin = config->containsKey("skin") ? config->getValue("skin") : "Ilkka Rosma Dark";
currentBank = "000 - FMR OB-Xa Patch Book"; currentBank = "000 - FMR OB-Xa Patch Book";
@ -89,10 +89,12 @@ ObxdAudioProcessor::ObxdAudioProcessor()
} }
apvtState.state = ValueTree (JucePlugin_Name); apvtState.state = ValueTree (JucePlugin_Name);
initMidi();
} }
ObxdAudioProcessor::~ObxdAudioProcessor() ObxdAudioProcessor::~ObxdAudioProcessor()
{ {
config->saveIfNeeded(); config->saveIfNeeded();
config = nullptr; config = nullptr;
} }
@ -166,6 +168,23 @@ int ObxdAudioProcessor::getCurrentProgram()
return programs.currentProgram; return programs.currentProgram;
} }
void ObxdAudioProcessor::setCurrentProgram (int index, bool updateHost){
programs.currentProgram = index;
programs.currentProgramPtr = programs.programs + programs.currentProgram;
isHostAutomatedChange = false;
for (int i = 0; i < PARAM_COUNT; ++i)
setEngineParameterValue (i, programs.currentProgramPtr->values[i], true);
isHostAutomatedChange = true;
sendChangeMessage();
// Will delay
if (updateHost) {
updateHostDisplay();
}
}
void ObxdAudioProcessor::setCurrentProgram (int index) void ObxdAudioProcessor::setCurrentProgram (int index)
{ {
programs.currentProgram = index; programs.currentProgram = index;
@ -253,11 +272,18 @@ inline void ObxdAudioProcessor::processMidiPerSample (MidiBuffer::Iterator* iter
lastMovedController = midiMsg->getControllerNumber(); lastMovedController = midiMsg->getControllerNumber();
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){ if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){
midiControlledParamSet = true; midiControlledParamSet = true;
bindings[lastMovedController] = lastUsedParameter; //bindings[lastMovedController] = lastUsedParameter;
bindings.updateCC(lastUsedParameter, lastMovedController);
File midi_file = getMidiFolder().getChildFile("Custom.xml");
bindings.saveFile(midi_file);
currentMidiPath = midi_file.getFullPathName();
setEngineParameterValue (MIDILEARN, 0, true); setEngineParameterValue (MIDILEARN, 0, true);
lastMovedController = 0; lastMovedController = 0;
lastUsedParameter = 0; lastUsedParameter = 0;
midiControlledParamSet = false; midiControlledParamSet = false;
} }
if (bindings[lastMovedController] > 0) if (bindings[lastMovedController] > 0)
@ -355,7 +381,7 @@ void ObxdAudioProcessor::getStateInformation(MemoryBlock& destData)
xmlState.addChildElement(xprogs); xmlState.addChildElement(xprogs);
bindings.setXml(xmlState); //bindings.setXml(xmlState);
copyXmlToBinary(xmlState, destData); copyXmlToBinary(xmlState, destData);
} }
@ -412,7 +438,7 @@ void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
} }
} }
bindings.getXml(*xmlState); //bindings.getXml(*xmlState);
#if ! DEMOVERSION #if ! DEMOVERSION
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0)); setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
@ -506,12 +532,14 @@ bool ObxdAudioProcessor::saveFXPFile(const File& fxpFile){
fxpFile.replaceWithData(memoryBlock.getData(), memoryBlock.getSize()); fxpFile.replaceWithData(memoryBlock.getData(), memoryBlock.getSize());
} }
return true;
} }
bool ObxdAudioProcessor::savePreset(const File& fxpFile) { bool ObxdAudioProcessor::savePreset(const File& fxpFile) {
saveFXPFile(fxpFile); saveFXPFile(fxpFile);
currentPreset = fxpFile.getFileName(); currentPreset = fxpFile.getFileName();
currentPresetFile = fxpFile; currentPresetFile = fxpFile;
return true;
} }
void ObxdAudioProcessor::changePresetName(const String &name){ void ObxdAudioProcessor::changePresetName(const String &name){
@ -653,6 +681,7 @@ bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
return false; return false;
setStateInformation(cset->chunk, fxbSwap (cset->chunkSize)); setStateInformation(cset->chunk, fxbSwap (cset->chunkSize));
setCurrentProgram(0); // Set to first preset position
} }
else if (compareMagic (set->fxMagic, "FPCh")) else if (compareMagic (set->fxMagic, "FPCh"))
{ {
@ -760,6 +789,12 @@ File ObxdAudioProcessor::getBanksFolder() const
return getDocumentFolder().getChildFile("Banks"); return getDocumentFolder().getChildFile("Banks");
} }
File ObxdAudioProcessor::getMidiFolder() const
{
return getDocumentFolder().getChildFile("Midi");
}
File ObxdAudioProcessor::getPresetsFolder() const File ObxdAudioProcessor::getPresetsFolder() const
{ {
return getDocumentFolder().getChildFile("Presets"); return getDocumentFolder().getChildFile("Presets");
@ -1165,3 +1200,42 @@ AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{ {
return new ObxdAudioProcessor(); return new ObxdAudioProcessor();
} }
void ObxdAudioProcessor::initMidi(){
//Documents > Obxd > MIDI > Default.xml
File default_file = getMidiFolder().getChildFile("Default.xml");
if (!default_file.exists()){
bindings.saveFile(default_file);
}
File midi_config_file = getMidiFolder().getChildFile("Config.xml");
XmlDocument xmlDoc (midi_config_file);
std::unique_ptr<XmlElement> ele_file = xmlDoc.getDocumentElementIfTagMatches("File");
if (ele_file) {
String file_name = ele_file->getStringAttribute("name");
// Midi cc loading
File midi_file = getMidiFolder().getChildFile(file_name);
if (bindings.loadFile(midi_file)){
currentMidiPath = midi_file.getFullPathName();
} else {
File midi_file = getMidiFolder().getChildFile("Default.xml");
if (bindings.loadFile(midi_file)){
currentMidiPath = midi_file.getFullPathName();
}
}
}
}
void ObxdAudioProcessor::updateConfig(){
File midi_config_file = getMidiFolder().getChildFile("Config.xml");
XmlDocument xmlDoc (midi_config_file);
std::unique_ptr<XmlElement> ele_file = xmlDoc.getDocumentElementIfTagMatches("File");
if (ele_file) {
File f(currentMidiPath);
ele_file->setAttribute("name", f.getFileName());
ele_file->writeTo(midi_config_file.getFullPathName());
}
}

View file

@ -138,7 +138,7 @@ public:
//============================================================================== //==============================================================================
void initAllParams(); void initAllParams();
void initMidi();
const String getInputChannelName (int channelIndex) const override; // WATCH OUT! const String getInputChannelName (int channelIndex) const override; // WATCH OUT!
const String getOutputChannelName (int channelIndex) const override; // WATCH OUT! const String getOutputChannelName (int channelIndex) const override; // WATCH OUT!
bool isInputChannelStereoPair (int index) const override; // WATCH OUT! bool isInputChannelStereoPair (int index) const override; // WATCH OUT!
@ -153,6 +153,7 @@ public:
int getNumPrograms() override; int getNumPrograms() override;
int getCurrentProgram() override; int getCurrentProgram() override;
void setCurrentProgram (int index) override; void setCurrentProgram (int index) override;
void setCurrentProgram (int index, bool updateHost);
const String getProgramName (int index) override; const String getProgramName (int index) override;
void changeProgramName (int index, const String& newName) override; void changeProgramName (int index, const String& newName) override;
@ -190,6 +191,7 @@ public:
File getSkinFolder() const; File getSkinFolder() const;
File getPresetsFolder() const; File getPresetsFolder() const;
File getBanksFolder() const; File getBanksFolder() const;
File getMidiFolder() const;
File getCurrentSkinFolder() const; File getCurrentSkinFolder() const;
void setCurrentSkinFolder(const String& folderName); void setCurrentSkinFolder(const String& folderName);
@ -200,7 +202,15 @@ public:
void setEngineParameterValue (int, float, bool notifyToHost= false); void setEngineParameterValue (int, float, bool notifyToHost= false);
void parameterChanged (const String&, float) override; void parameterChanged (const String&, float) override;
AudioProcessorValueTreeState& getPluginState(); AudioProcessorValueTreeState& getPluginState();
bool getShowPresetBar(){
return this->showPresetBar;
}
void setShowPresetBar(bool val){
this->showPresetBar = val;
config->setValue("presetnavigation", this->showPresetBar);
}
private: private:
//============================================================================== //==============================================================================
bool isHostAutomatedChange; bool isHostAutomatedChange;
@ -210,7 +220,7 @@ private:
MidiMessage* nextMidi; MidiMessage* nextMidi;
MidiMessage* midiMsg; MidiMessage* midiMsg;
MidiMap bindings;
bool midiControlledParamSet; bool midiControlledParamSet;
bool hasMidiMessage; bool hasMidiMessage;
@ -225,10 +235,14 @@ public:
File currentBankFile; File currentBankFile;
void saveBank(); void saveBank();
String currentMidiPath;
String currentPreset; String currentPreset;
File currentPresetFile; File currentPresetFile;
void savePreset(); void savePreset();
MidiMap bindings;
bool showPresetBar = false;
void updateConfig();
private: private:
Array<File> bankFiles; Array<File> bankFiles;
Array<File> skinFiles; Array<File> skinFiles;