Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03cb4d0d71 | |||
| cb69f21c5c | |||
| 7c5332e79e | |||
| 49f58cd079 | |||
| e0232ea370 | |||
| 17e78997e5 | |||
| 9778406516 | |||
| e2ce3e4c68 | |||
| 6f2ed283ed | |||
| 2a407bc741 | |||
| 9b458273ed | |||
| bb67537e88 | |||
| db81016abc |
+16
-16
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<JUCERPROJECT id="NTe0XB0ij" name="Light Host" projectType="guiapp" version="1.1.0"
|
<JUCERPROJECT id="NTe0XB0ij" name="Light Host" projectType="guiapp" version="1.2.0"
|
||||||
juceLinkage="amalg_multi" juceFolder="../../../juce" buildVST="1"
|
juceLinkage="amalg_multi" juceFolder="../../../juce" buildVST="1"
|
||||||
buildRTAS="0" buildAU="1" vstFolderMac="~/SDKs/vstsdk2.4" vstFolderPC="c:\SDKs\vstsdk2.4"
|
buildRTAS="0" buildAU="1" vstFolderMac="~/SDKs/vstsdk2.4" vstFolderPC="c:\SDKs\vstsdk2.4"
|
||||||
rtasFolderMac="~/SDKs/PT_80_SDK" rtasFolderPC="c:\SDKs\PT_80_SDK"
|
rtasFolderMac="~/SDKs/PT_80_SDK" rtasFolderPC="c:\SDKs\PT_80_SDK"
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
pluginSilenceInIsSilenceOut="0" pluginTailLength="0" pluginEditorRequiresKeys="0"
|
pluginSilenceInIsSilenceOut="0" pluginTailLength="0" pluginEditorRequiresKeys="0"
|
||||||
pluginAUExportPrefix="JuceProjectAU" pluginAUViewClass="JuceProjectAU_V1"
|
pluginAUExportPrefix="JuceProjectAU" pluginAUViewClass="JuceProjectAU_V1"
|
||||||
pluginRTASCategory="" bundleIdentifier="com.rolandoislas.lighthost"
|
pluginRTASCategory="" bundleIdentifier="com.rolandoislas.lighthost"
|
||||||
jucerVersion="4.1.0" companyName="Rolando Islas" includeBinaryInAppConfig="1"
|
jucerVersion="4.2.4" companyName="Rolando Islas" includeBinaryInAppConfig="1"
|
||||||
companyWebsite="https://www.rolandoislas.com" companyEmail="admin@rolandoislas.com">
|
companyWebsite="https://www.rolandoislas.com" companyEmail="admin@rolandoislas.com">
|
||||||
<EXPORTFORMATS>
|
<EXPORTFORMATS>
|
||||||
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="" rtasFolder="~/SDKs/PT_80_SDK"
|
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="" rtasFolder="~/SDKs/PT_80_SDK"
|
||||||
@@ -137,20 +137,20 @@
|
|||||||
JUCE_PLUGINHOST_VST="enabled" JUCE_PLUGINHOST_AU="enabled" JUCE_WEB_BROWSER="disabled"
|
JUCE_PLUGINHOST_VST="enabled" JUCE_PLUGINHOST_AU="enabled" JUCE_WEB_BROWSER="disabled"
|
||||||
JUCE_PLUGINHOST_VST3="enabled" JUCE_ASIO="enabled"/>
|
JUCE_PLUGINHOST_VST3="enabled" JUCE_ASIO="enabled"/>
|
||||||
<MODULES>
|
<MODULES>
|
||||||
<MODULE id="juce_audio_basics" showAllCode="1"/>
|
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_audio_devices" showAllCode="1"/>
|
<MODULE id="juce_audio_devices" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_audio_formats" showAllCode="1"/>
|
<MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_audio_processors" showAllCode="1"/>
|
<MODULE id="juce_audio_processors" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_audio_utils" showAllCode="1"/>
|
<MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_core" showAllCode="1"/>
|
<MODULE id="juce_core" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_cryptography" showAllCode="1"/>
|
<MODULE id="juce_cryptography" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_data_structures" showAllCode="1"/>
|
<MODULE id="juce_data_structures" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_events" showAllCode="1"/>
|
<MODULE id="juce_events" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_graphics" showAllCode="1"/>
|
<MODULE id="juce_graphics" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_gui_basics" showAllCode="1"/>
|
<MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_gui_extra" showAllCode="1"/>
|
<MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_opengl" showAllCode="1"/>
|
<MODULE id="juce_opengl" showAllCode="1" useLocalCopy="1"/>
|
||||||
<MODULE id="juce_video" showAllCode="1"/>
|
<MODULE id="juce_video" showAllCode="1" useLocalCopy="1"/>
|
||||||
</MODULES>
|
</MODULES>
|
||||||
<LIVE_SETTINGS>
|
<LIVE_SETTINGS>
|
||||||
<OSX headerPath=""/>
|
<OSX headerPath=""/>
|
||||||
|
|||||||
+31
-11
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
class PluginHostApp : public JUCEApplication
|
class PluginHostApp : public JUCEApplication
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PluginHostApp() {}
|
PluginHostApp() {}
|
||||||
|
|
||||||
@@ -17,6 +18,8 @@ public:
|
|||||||
options.filenameSuffix = "settings";
|
options.filenameSuffix = "settings";
|
||||||
options.osxLibrarySubFolder = "Preferences";
|
options.osxLibrarySubFolder = "Preferences";
|
||||||
|
|
||||||
|
checkArguments(&options);
|
||||||
|
|
||||||
appProperties = new ApplicationProperties();
|
appProperties = new ApplicationProperties();
|
||||||
appProperties->setStorageParameters (options);
|
appProperties->setStorageParameters (options);
|
||||||
|
|
||||||
@@ -26,16 +29,6 @@ public:
|
|||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
Process::setDockIconVisible(false);
|
Process::setDockIconVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
File fileToOpen;
|
|
||||||
|
|
||||||
for (int i = 0; i < getCommandLineParameterArray().size(); ++i)
|
|
||||||
{
|
|
||||||
fileToOpen = File::getCurrentWorkingDirectory().getChildFile (getCommandLineParameterArray()[i]);
|
|
||||||
|
|
||||||
if (fileToOpen.existsAsFile())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdown() override
|
void shutdown() override
|
||||||
@@ -52,7 +45,10 @@ public:
|
|||||||
|
|
||||||
const String getApplicationName() override { return "Light Host"; }
|
const String getApplicationName() override { return "Light Host"; }
|
||||||
const String getApplicationVersion() override { return ProjectInfo::versionString; }
|
const String getApplicationVersion() override { return ProjectInfo::versionString; }
|
||||||
bool moreThanOneInstanceAllowed() override { return false; }
|
bool moreThanOneInstanceAllowed() override {
|
||||||
|
StringArray multiInstance = getParameter("-multi-instance");
|
||||||
|
return multiInstance.size() == 2;
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationCommandManager commandManager;
|
ApplicationCommandManager commandManager;
|
||||||
ScopedPointer<ApplicationProperties> appProperties;
|
ScopedPointer<ApplicationProperties> appProperties;
|
||||||
@@ -60,6 +56,30 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ScopedPointer<IconMenu> mainWindow;
|
ScopedPointer<IconMenu> mainWindow;
|
||||||
|
|
||||||
|
StringArray getParameter(String lookFor) {
|
||||||
|
StringArray parameters = getCommandLineParameterArray();
|
||||||
|
StringArray found;
|
||||||
|
for (int i = 0; i < parameters.size(); ++i)
|
||||||
|
{
|
||||||
|
String param = parameters[i];
|
||||||
|
if (param.contains(lookFor))
|
||||||
|
{
|
||||||
|
found.add(lookFor);
|
||||||
|
int delimiter = param.indexOf(0, "=") + 1;
|
||||||
|
String val = param.substring(delimiter);
|
||||||
|
found.add(val);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkArguments(PropertiesFile::Options *options) {
|
||||||
|
StringArray multiInstance = getParameter("-multi-instance");
|
||||||
|
if (multiInstance.size() == 2)
|
||||||
|
options->filenameSuffix = multiInstance[1] + "." + options->filenameSuffix;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PluginHostApp& getApp() { return *dynamic_cast<PluginHostApp*>(JUCEApplication::getInstance()); }
|
static PluginHostApp& getApp() { return *dynamic_cast<PluginHostApp*>(JUCEApplication::getInstance()); }
|
||||||
|
|||||||
+191
-52
@@ -10,6 +10,7 @@
|
|||||||
#include "IconMenu.hpp"
|
#include "IconMenu.hpp"
|
||||||
#include "PluginWindow.h"
|
#include "PluginWindow.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <limits.h>
|
||||||
#if JUCE_WINDOWS
|
#if JUCE_WINDOWS
|
||||||
#include "Windows.h"
|
#include "Windows.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -59,7 +60,7 @@ private:
|
|||||||
IconMenu& owner;
|
IconMenu& owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
IconMenu::IconMenu()
|
IconMenu::IconMenu() : INDEX_EDIT(1000000), INDEX_BYPASS(2000000), INDEX_DELETE(3000000), INDEX_MOVE_UP(4000000), INDEX_MOVE_DOWN(5000000)
|
||||||
{
|
{
|
||||||
// Initiialization
|
// Initiialization
|
||||||
formatManager.addDefaultFormats();
|
formatManager.addDefaultFormats();
|
||||||
@@ -83,6 +84,17 @@ IconMenu::IconMenu()
|
|||||||
activePluginList.recreateFromXml(*savedPluginListActive);
|
activePluginList.recreateFromXml(*savedPluginListActive);
|
||||||
loadActivePlugins();
|
loadActivePlugins();
|
||||||
activePluginList.addChangeListener(this);
|
activePluginList.addChangeListener(this);
|
||||||
|
setIcon();
|
||||||
|
setIconTooltip(JUCEApplication::getInstance()->getApplicationName());
|
||||||
|
};
|
||||||
|
|
||||||
|
IconMenu::~IconMenu()
|
||||||
|
{
|
||||||
|
savePluginStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IconMenu::setIcon()
|
||||||
|
{
|
||||||
// Set menu icon
|
// Set menu icon
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
if (exec("defaults read -g AppleInterfaceStyle").compare("Dark") == 1)
|
if (exec("defaults read -g AppleInterfaceStyle").compare("Dark") == 1)
|
||||||
@@ -90,57 +102,77 @@ IconMenu::IconMenu()
|
|||||||
else
|
else
|
||||||
setIconImage(ImageFileFormat::loadFrom(BinaryData::menu_icon_png, BinaryData::menu_icon_pngSize));
|
setIconImage(ImageFileFormat::loadFrom(BinaryData::menu_icon_png, BinaryData::menu_icon_pngSize));
|
||||||
#else
|
#else
|
||||||
setIconImage(ImageFileFormat::loadFrom(BinaryData::menu_icon_png, BinaryData::menu_icon_pngSize));
|
String defaultColor;
|
||||||
|
#if JUCE_WINDOWS
|
||||||
|
defaultColor = "white";
|
||||||
|
#elif JUCE_LINUX
|
||||||
|
defaultColor = "black";
|
||||||
|
#endif
|
||||||
|
if (!getAppProperties().getUserSettings()->containsKey("icon"))
|
||||||
|
getAppProperties().getUserSettings()->setValue("icon", defaultColor);
|
||||||
|
String color = getAppProperties().getUserSettings()->getValue("icon");
|
||||||
|
Image icon;
|
||||||
|
if (color.equalsIgnoreCase("white"))
|
||||||
|
icon = ImageFileFormat::loadFrom(BinaryData::menu_icon_white_png, BinaryData::menu_icon_white_pngSize);
|
||||||
|
else if (color.equalsIgnoreCase("black"))
|
||||||
|
icon = ImageFileFormat::loadFrom(BinaryData::menu_icon_png, BinaryData::menu_icon_pngSize);
|
||||||
|
setIconImage(icon);
|
||||||
#endif
|
#endif
|
||||||
setIconTooltip(JUCEApplication::getInstance()->getApplicationName());
|
|
||||||
};
|
|
||||||
|
|
||||||
IconMenu::~IconMenu()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconMenu::loadActivePlugins()
|
void IconMenu::loadActivePlugins()
|
||||||
{
|
{
|
||||||
|
const int INPUT = 1000000;
|
||||||
|
const int OUTPUT = INPUT + 1;
|
||||||
|
const int CHANNEL_ONE = 0;
|
||||||
|
const int CHANNEL_TWO = 1;
|
||||||
|
PluginWindow::closeAllCurrentlyOpenWindows();
|
||||||
graph.clear();
|
graph.clear();
|
||||||
inputNode = graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode), 1);
|
inputNode = graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode), INPUT);
|
||||||
outputNode = graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode), 2);
|
outputNode = graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode), OUTPUT);
|
||||||
if (activePluginList.getNumTypes() == 0)
|
if (activePluginList.getNumTypes() == 0)
|
||||||
{
|
{
|
||||||
graph.addConnection(1, 0, 2, 0);
|
graph.addConnection(INPUT, CHANNEL_ONE, OUTPUT, CHANNEL_ONE);
|
||||||
graph.addConnection(1, 1, 2, 1);
|
graph.addConnection(INPUT, CHANNEL_TWO, OUTPUT, CHANNEL_TWO);
|
||||||
}
|
}
|
||||||
int pluginTime = 0;
|
int pluginTime = 0;
|
||||||
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
int lastId = 0;
|
||||||
|
bool hasInputConnected = false;
|
||||||
|
// NOTE: Node ids cannot begin at 0.
|
||||||
|
for (int i = 1; i <= activePluginList.getNumTypes(); i++)
|
||||||
{
|
{
|
||||||
PluginDescription plugin = getNextPluginOlderThanTime(pluginTime);
|
PluginDescription plugin = getNextPluginOlderThanTime(pluginTime);
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
AudioPluginInstance* instance = formatManager.createPluginInstance(plugin, graph.getSampleRate(), graph.getBlockSize(), errorMessage);
|
AudioPluginInstance* instance = formatManager.createPluginInstance(plugin, graph.getSampleRate(), graph.getBlockSize(), errorMessage);
|
||||||
String pluginUid;
|
String pluginUid = getKey("state", plugin);
|
||||||
pluginUid << "pluginState-" << i;
|
|
||||||
String savedPluginState = getAppProperties().getUserSettings()->getValue(pluginUid);
|
String savedPluginState = getAppProperties().getUserSettings()->getValue(pluginUid);
|
||||||
MemoryBlock savedPluginBinary;
|
MemoryBlock savedPluginBinary;
|
||||||
savedPluginBinary.fromBase64Encoding(savedPluginState);
|
savedPluginBinary.fromBase64Encoding(savedPluginState);
|
||||||
instance->setStateInformation(savedPluginBinary.getData(), savedPluginBinary.getSize());
|
instance->setStateInformation(savedPluginBinary.getData(), savedPluginBinary.getSize());
|
||||||
graph.addNode(instance, i+3);
|
graph.addNode(instance, i);
|
||||||
|
String key = getKey("bypass", plugin);
|
||||||
|
bool bypass = getAppProperties().getUserSettings()->getBoolValue(key, false);
|
||||||
// Input to plugin
|
// Input to plugin
|
||||||
if (i == 0)
|
if ((!hasInputConnected) && (!bypass))
|
||||||
{
|
{
|
||||||
graph.addConnection(1, 0, i+3, 0);
|
graph.addConnection(INPUT, CHANNEL_ONE, i, CHANNEL_ONE);
|
||||||
graph.addConnection(1, 1, i+3, 1);
|
graph.addConnection(INPUT, CHANNEL_TWO, i, CHANNEL_TWO);
|
||||||
}
|
hasInputConnected = true;
|
||||||
// Plugin to output
|
|
||||||
if (i == activePluginList.getNumTypes() - 1)
|
|
||||||
{
|
|
||||||
graph.addConnection(i+3, 0, 2, 0);
|
|
||||||
graph.addConnection(i+3, 1, 2, 1);
|
|
||||||
}
|
}
|
||||||
// Connect previous plugin to current
|
// Connect previous plugin to current
|
||||||
if (i > 0)
|
else if (!bypass)
|
||||||
{
|
{
|
||||||
graph.addConnection(i+2, 0, i+3, 0);
|
graph.addConnection(lastId, CHANNEL_ONE, i, CHANNEL_ONE);
|
||||||
graph.addConnection(i+2, 1, i+3, 1);
|
graph.addConnection(lastId, CHANNEL_TWO, i, CHANNEL_TWO);
|
||||||
}
|
}
|
||||||
|
if (!bypass)
|
||||||
|
lastId = i;
|
||||||
|
}
|
||||||
|
if (lastId > 0)
|
||||||
|
{
|
||||||
|
// Last active plugin to output
|
||||||
|
graph.addConnection(lastId, CHANNEL_ONE, OUTPUT, CHANNEL_ONE);
|
||||||
|
graph.addConnection(lastId, CHANNEL_TWO, OUTPUT, CHANNEL_TWO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +184,7 @@ PluginDescription IconMenu::getNextPluginOlderThanTime(int &time)
|
|||||||
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
||||||
{
|
{
|
||||||
PluginDescription plugin = *activePluginList.getType(i);
|
PluginDescription plugin = *activePluginList.getType(i);
|
||||||
String key = "pluginOrder-" + plugin.descriptiveName + plugin.version + plugin.pluginFormatName;
|
String key = getKey("order", plugin);
|
||||||
String pluginTimeString = getAppProperties().getUserSettings()->getValue(key);
|
String pluginTimeString = getAppProperties().getUserSettings()->getValue(key);
|
||||||
int pluginTime = atoi(pluginTimeString.toStdString().c_str());
|
int pluginTime = atoi(pluginTimeString.toStdString().c_str());
|
||||||
if (pluginTime > timeStatic && abs(timeStatic - pluginTime) < diff)
|
if (pluginTime > timeStatic && abs(timeStatic - pluginTime) < diff)
|
||||||
@@ -212,24 +244,38 @@ void IconMenu::timerCallback()
|
|||||||
menu.addItem(1, "Preferences");
|
menu.addItem(1, "Preferences");
|
||||||
menu.addItem(2, "Edit Plugins");
|
menu.addItem(2, "Edit Plugins");
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
menu.addSectionHeader("Active Plugins");
|
||||||
// Active plugins
|
// Active plugins
|
||||||
int time = 0;
|
int time = 0;
|
||||||
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
||||||
{
|
{
|
||||||
PopupMenu options;
|
PopupMenu options;
|
||||||
options.addItem(i+3, "Edit");
|
options.addItem(INDEX_EDIT + i, "Edit");
|
||||||
options.addItem(activePluginList.getNumTypes()+i+3, "Delete");
|
std::vector<PluginDescription> timeSorted = getTimeSortedList();
|
||||||
// TODO bypass
|
String key = getKey("bypass", timeSorted[i]);
|
||||||
|
bool bypass = getAppProperties().getUserSettings()->getBoolValue(key);
|
||||||
|
options.addItem(INDEX_BYPASS + i, "Bypass", true, bypass);
|
||||||
|
options.addSeparator();
|
||||||
|
options.addItem(INDEX_MOVE_UP + i, "Move Up", i > 0);
|
||||||
|
options.addItem(INDEX_MOVE_DOWN + i, "Move Down", i < timeSorted.size() - 1);
|
||||||
|
options.addSeparator();
|
||||||
|
options.addItem(INDEX_DELETE + i, "Delete");
|
||||||
PluginDescription plugin = getNextPluginOlderThanTime(time);
|
PluginDescription plugin = getNextPluginOlderThanTime(time);
|
||||||
menu.addSubMenu(plugin.name, options);
|
menu.addSubMenu(plugin.name, options);
|
||||||
}
|
}
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
menu.addSectionHeader("Avaliable Plugins");
|
||||||
// All plugins
|
// All plugins
|
||||||
knownPluginList.addToMenu(menu, pluginSortMethod);
|
knownPluginList.addToMenu(menu, pluginSortMethod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu.addItem(1, "Quit");
|
menu.addItem(1, "Quit");
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addItem(2, "Delete Plugin States");
|
||||||
|
#if !JUCE_MAC
|
||||||
|
menu.addItem(3, "Invert Icon Color");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if JUCE_MAC || JUCE_LINUX
|
#if JUCE_MAC || JUCE_LINUX
|
||||||
menu.showMenuAsync(PopupMenu::Options().withTargetComponent(this), ModalCallbackFunction::forComponent(menuInvocationCallback, this));
|
menu.showMenuAsync(PopupMenu::Options().withTargetComponent(this), ModalCallbackFunction::forComponent(menuInvocationCallback, this));
|
||||||
@@ -261,10 +307,24 @@ void IconMenu::mouseDown(const MouseEvent& e)
|
|||||||
void IconMenu::menuInvocationCallback(int id, IconMenu* im)
|
void IconMenu::menuInvocationCallback(int id, IconMenu* im)
|
||||||
{
|
{
|
||||||
// Right click
|
// Right click
|
||||||
if ((!im->menuIconLeftClicked) && id == 1)
|
if ((!im->menuIconLeftClicked))
|
||||||
|
{
|
||||||
|
if (id == 1)
|
||||||
{
|
{
|
||||||
im->savePluginStates();
|
im->savePluginStates();
|
||||||
return JUCEApplication::getInstance()->quit();
|
return JUCEApplication::getInstance()->quit();
|
||||||
|
}
|
||||||
|
if (id == 2)
|
||||||
|
{
|
||||||
|
im->deletePluginStates();
|
||||||
|
return im->loadActivePlugins();
|
||||||
|
}
|
||||||
|
if (id == 3)
|
||||||
|
{
|
||||||
|
String color = getAppProperties().getUserSettings()->getValue("icon");
|
||||||
|
getAppProperties().getUserSettings()->setValue("icon", color.equalsIgnoreCase("black") ? "white" : "black");
|
||||||
|
return im->setIcon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
// Click elsewhere
|
// Click elsewhere
|
||||||
@@ -281,27 +341,42 @@ void IconMenu::menuInvocationCallback(int id, IconMenu* im)
|
|||||||
if (id > 2)
|
if (id > 2)
|
||||||
{
|
{
|
||||||
// Delete plugin
|
// Delete plugin
|
||||||
if (id > im->activePluginList.getNumTypes() + 2 && id <= im->activePluginList.getNumTypes() * 2 + 2)
|
if (id >= im->INDEX_DELETE && id < im->INDEX_DELETE + 1000000)
|
||||||
{
|
{
|
||||||
im->deletePluginStates();
|
im->deletePluginStates();
|
||||||
|
|
||||||
int index = id - im->activePluginList.getNumTypes() - 3;
|
int index = id - im->INDEX_DELETE;
|
||||||
PluginDescription plugin = *im->activePluginList.getType(index);
|
std::vector<PluginDescription> timeSorted = im->getTimeSortedList();
|
||||||
String key = "pluginOrder-" + plugin.descriptiveName + plugin.version + plugin.pluginFormatName;
|
String key = getKey("order", timeSorted[index]);
|
||||||
getAppProperties().getUserSettings()->removeValue(key);
|
int unsortedIndex = 0;
|
||||||
getAppProperties().saveIfNeeded();
|
for (int i = 0; im->activePluginList.getNumTypes(); i++)
|
||||||
im->activePluginList.removeType(index);
|
{
|
||||||
|
PluginDescription current = *im->activePluginList.getType(i);
|
||||||
|
if (key.equalsIgnoreCase(getKey("order", current)))
|
||||||
|
{
|
||||||
|
unsortedIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove plugin order
|
||||||
|
getAppProperties().getUserSettings()->removeValue(key);
|
||||||
|
// Remove bypass entry
|
||||||
|
getAppProperties().getUserSettings()->removeValue(getKey("bypass", timeSorted[index]));
|
||||||
|
getAppProperties().saveIfNeeded();
|
||||||
|
|
||||||
|
// Remove plugin from list
|
||||||
|
im->activePluginList.removeType(unsortedIndex);
|
||||||
|
|
||||||
|
// Save current states
|
||||||
im->savePluginStates();
|
im->savePluginStates();
|
||||||
im->loadActivePlugins();
|
im->loadActivePlugins();
|
||||||
}
|
}
|
||||||
// Add plugin
|
// Add plugin
|
||||||
else if (id > im->activePluginList.getNumTypes() + 2)
|
else if (im->knownPluginList.getIndexChosenByMenu(id) > -1)
|
||||||
{
|
{
|
||||||
im->deletePluginStates();
|
|
||||||
|
|
||||||
PluginDescription plugin = *im->knownPluginList.getType(im->knownPluginList.getIndexChosenByMenu(id));
|
PluginDescription plugin = *im->knownPluginList.getType(im->knownPluginList.getIndexChosenByMenu(id));
|
||||||
String key = "pluginOrder-" + plugin.descriptiveName + plugin.version + plugin.pluginFormatName;
|
String key = getKey("order", plugin);
|
||||||
int t = time(0);
|
int t = time(0);
|
||||||
getAppProperties().getUserSettings()->setValue(key, t);
|
getAppProperties().getUserSettings()->setValue(key, t);
|
||||||
getAppProperties().saveIfNeeded();
|
getAppProperties().saveIfNeeded();
|
||||||
@@ -310,24 +385,88 @@ void IconMenu::menuInvocationCallback(int id, IconMenu* im)
|
|||||||
im->savePluginStates();
|
im->savePluginStates();
|
||||||
im->loadActivePlugins();
|
im->loadActivePlugins();
|
||||||
}
|
}
|
||||||
// Show active plugin GUI
|
// Bypass plugin
|
||||||
else
|
else if (id >= im->INDEX_BYPASS && id < im->INDEX_BYPASS + 1000000)
|
||||||
{
|
{
|
||||||
if (const AudioProcessorGraph::Node::Ptr f = im->graph.getNodeForId(id))
|
int index = id - im->INDEX_BYPASS;
|
||||||
|
std::vector<PluginDescription> timeSorted = im->getTimeSortedList();
|
||||||
|
String key = getKey("bypass", timeSorted[index]);
|
||||||
|
|
||||||
|
// Set bypass flag
|
||||||
|
bool bypassed = getAppProperties().getUserSettings()->getBoolValue(key);
|
||||||
|
getAppProperties().getUserSettings()->setValue(key, !bypassed);
|
||||||
|
getAppProperties().saveIfNeeded();
|
||||||
|
|
||||||
|
im->savePluginStates();
|
||||||
|
im->loadActivePlugins();
|
||||||
|
}
|
||||||
|
// Show active plugin GUI
|
||||||
|
else if (id >= im->INDEX_EDIT && id < im->INDEX_EDIT + 1000000)
|
||||||
|
{
|
||||||
|
if (const AudioProcessorGraph::Node::Ptr f = im->graph.getNodeForId(id - im->INDEX_EDIT + 1))
|
||||||
if (PluginWindow* const w = PluginWindow::getWindowFor(f, PluginWindow::Normal))
|
if (PluginWindow* const w = PluginWindow::getWindowFor(f, PluginWindow::Normal))
|
||||||
w->toFront(true);
|
w->toFront(true);
|
||||||
}
|
}
|
||||||
|
// Move plugin up the list
|
||||||
|
else if (id >= im->INDEX_MOVE_UP && id < im->INDEX_MOVE_UP + 1000000)
|
||||||
|
{
|
||||||
|
im->savePluginStates();
|
||||||
|
std::vector<PluginDescription> timeSorted = im->getTimeSortedList();
|
||||||
|
PluginDescription toMove = timeSorted[id - im->INDEX_MOVE_UP];
|
||||||
|
for (int i = 0; i < timeSorted.size(); i++)
|
||||||
|
{
|
||||||
|
bool move = getKey("move", toMove).equalsIgnoreCase(getKey("move", timeSorted[i]));
|
||||||
|
getAppProperties().getUserSettings()->setValue(getKey("order", timeSorted[i]), move ? i : i+1);
|
||||||
|
if (move)
|
||||||
|
getAppProperties().getUserSettings()->setValue(getKey("order", timeSorted[i-1]), i+1);
|
||||||
|
}
|
||||||
|
im->loadActivePlugins();
|
||||||
|
}
|
||||||
|
// Move plugin down the list
|
||||||
|
else if (id >= im->INDEX_MOVE_DOWN && id < im->INDEX_MOVE_DOWN + 1000000)
|
||||||
|
{
|
||||||
|
im->savePluginStates();
|
||||||
|
std::vector<PluginDescription> timeSorted = im->getTimeSortedList();
|
||||||
|
PluginDescription toMove = timeSorted[id - im->INDEX_MOVE_DOWN];
|
||||||
|
for (int i = 0; i < timeSorted.size(); i++)
|
||||||
|
{
|
||||||
|
bool move = getKey("move", toMove).equalsIgnoreCase(getKey("move", timeSorted[i]));
|
||||||
|
getAppProperties().getUserSettings()->setValue(getKey("order", timeSorted[i]), move ? i+2 : i+1);
|
||||||
|
if (move)
|
||||||
|
{
|
||||||
|
getAppProperties().getUserSettings()->setValue(getKey("order", timeSorted[i + 1]), i + 1);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
im->loadActivePlugins();
|
||||||
|
}
|
||||||
// Update menu
|
// Update menu
|
||||||
im->startTimer(50);
|
im->startTimer(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<PluginDescription> IconMenu::getTimeSortedList()
|
||||||
|
{
|
||||||
|
int time = 0;
|
||||||
|
std::vector<PluginDescription> list;
|
||||||
|
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
||||||
|
list.push_back(getNextPluginOlderThanTime(time));
|
||||||
|
return list;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String IconMenu::getKey(String type, PluginDescription plugin)
|
||||||
|
{
|
||||||
|
String key = "plugin-" + type.toLowerCase() + "-" + plugin.name + plugin.version + plugin.pluginFormatName;
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
void IconMenu::deletePluginStates()
|
void IconMenu::deletePluginStates()
|
||||||
{
|
{
|
||||||
|
std::vector<PluginDescription> list = getTimeSortedList();
|
||||||
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
||||||
{
|
{
|
||||||
String pluginUid;
|
String pluginUid = getKey("state", list[i]);
|
||||||
pluginUid << "pluginState-" << i;
|
|
||||||
getAppProperties().getUserSettings()->removeValue(pluginUid);
|
getAppProperties().getUserSettings()->removeValue(pluginUid);
|
||||||
getAppProperties().saveIfNeeded();
|
getAppProperties().saveIfNeeded();
|
||||||
}
|
}
|
||||||
@@ -335,14 +474,14 @@ void IconMenu::deletePluginStates()
|
|||||||
|
|
||||||
void IconMenu::savePluginStates()
|
void IconMenu::savePluginStates()
|
||||||
{
|
{
|
||||||
|
std::vector<PluginDescription> list = getTimeSortedList();
|
||||||
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
for (int i = 0; i < activePluginList.getNumTypes(); i++)
|
||||||
{
|
{
|
||||||
AudioProcessorGraph::Node* node = graph.getNodeForId(i+3);
|
AudioProcessorGraph::Node* node = graph.getNodeForId(i + 1);
|
||||||
if (node == nullptr)
|
if (node == nullptr)
|
||||||
break;
|
break;
|
||||||
AudioProcessor& processor = *node->getProcessor();
|
AudioProcessor& processor = *node->getProcessor();
|
||||||
String pluginUid;
|
String pluginUid = getKey("state", list[i]);
|
||||||
pluginUid << "pluginState-" << i;
|
|
||||||
MemoryBlock savedStateBinary;
|
MemoryBlock savedStateBinary;
|
||||||
processor.getStateInformation(savedStateBinary);
|
processor.getStateInformation(savedStateBinary);
|
||||||
getAppProperties().getUserSettings()->setValue(pluginUid, savedStateBinary.toBase64Encoding());
|
getAppProperties().getUserSettings()->setValue(pluginUid, savedStateBinary.toBase64Encoding());
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public:
|
|||||||
void mouseDown(const MouseEvent&);
|
void mouseDown(const MouseEvent&);
|
||||||
static void menuInvocationCallback(int id, IconMenu*);
|
static void menuInvocationCallback(int id, IconMenu*);
|
||||||
void changeListenerCallback(ChangeBroadcaster* changed);
|
void changeListenerCallback(ChangeBroadcaster* changed);
|
||||||
|
static String getKey(String type, PluginDescription plugin);
|
||||||
|
|
||||||
|
const int INDEX_EDIT, INDEX_BYPASS, INDEX_DELETE, INDEX_MOVE_UP, INDEX_MOVE_DOWN;
|
||||||
private:
|
private:
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
std::string exec(const char* cmd);
|
std::string exec(const char* cmd);
|
||||||
@@ -31,6 +34,8 @@ private:
|
|||||||
void deletePluginStates();
|
void deletePluginStates();
|
||||||
PluginDescription getNextPluginOlderThanTime(int &time);
|
PluginDescription getNextPluginOlderThanTime(int &time);
|
||||||
void removePluginsLackingInputOutput();
|
void removePluginsLackingInputOutput();
|
||||||
|
std::vector<PluginDescription> getTimeSortedList();
|
||||||
|
void setIcon();
|
||||||
|
|
||||||
AudioDeviceManager deviceManager;
|
AudioDeviceManager deviceManager;
|
||||||
AudioPluginFormatManager formatManager;
|
AudioPluginFormatManager formatManager;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
Light Host
|
Light Host
|
||||||
---
|
---
|
||||||
|
|
||||||
A simple VST/AU host for OS X, Windows, and Linux that sits in the menubar.
|
A simple VST/AU host for OS X, Windows, and Linux that sits in the menu/task bar.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Add/remove plugins (AU/VST/VST3)
|
See [#1](https://github.com/rolandoislas/LightHost/issues/1)
|
||||||
- Change output and input
|
|
||||||
- ASIO support for Windows
|
### Screenshot
|
||||||
- Plugin states saved
|
|
||||||
- Saved plugin order
|

|
||||||
Reference in New Issue
Block a user