Dark Mode, Toob Neural Amp Modeler

This commit is contained in:
Robin Davies
2023-07-03 07:02:59 -04:00
parent 28215eb1d5
commit 15ae8ec049
65 changed files with 1169 additions and 223 deletions
+1 -1
View File
@@ -991,7 +991,7 @@ int main(int argc, char **argv)
parser.AddOption("--help", &help);
parser.AddOption("--prefix", &prefixOption);
parser.AddOption("--port", &portOption);
parser.AddOption("--enable-ap", &enable_ap);
parser.AddOption("--enable-legacy-ap", &enable_ap);
parser.AddOption("--disable-ap", &disable_ap);
parser.AddOption("--enable-p2p", &enable_p2p);
parser.AddOption("--disable-p2p", &disable_p2p);
+3 -1
View File
@@ -378,6 +378,8 @@ void PiPedalModel::OnNotifyMaybeLv2StateChanged(uint64_t instanceId)
IPiPedalModelSubscriber **t = new IPiPedalModelSubscriber *[this->subscribers.size()];
Lv2PluginState newState = item->lv2State();
for (size_t i = 0; i < subscribers.size(); ++i)
{
t[i] = this->subscribers[i];
@@ -386,7 +388,7 @@ void PiPedalModel::OnNotifyMaybeLv2StateChanged(uint64_t instanceId)
{
for (size_t i = 0; i < n; ++i)
{
t[i]->OnLv2StateChanged(instanceId);
t[i]->OnLv2StateChanged(instanceId,newState);
}
}
delete[] t;
+1 -1
View File
@@ -55,7 +55,7 @@ namespace pipedal
virtual void OnInputVolumeChanged(float value) = 0;
virtual void OnOutputVolumeChanged(float value) = 0;
virtual void OnLv2StateChanged(int64_t pedalItemId) = 0;
virtual void OnLv2StateChanged(int64_t pedalItemId,const Lv2PluginState&newState ) = 0;
virtual void OnVst3ControlChanged(int64_t clientId, int64_t pedalItemId, const std::string &symbol, float value, const std::string &state) = 0;
virtual void OnPedalboardChanged(int64_t clientId, const Pedalboard &pedalboard) = 0;
virtual void OnPresetsChanged(int64_t clientId, const PresetIndex &presets) = 0;
+18 -2
View File
@@ -57,6 +57,21 @@ JSON_MAP_REFERENCE(GetPatchPropertyBody, instanceId)
JSON_MAP_REFERENCE(GetPatchPropertyBody, propertyUri)
JSON_MAP_END()
class Lv2StateChangedBody {
public:
uint64_t instanceId_;
Lv2PluginState state_;
DECLARE_JSON_MAP(Lv2StateChangedBody);
};
JSON_MAP_BEGIN(Lv2StateChangedBody)
JSON_MAP_REFERENCE(Lv2StateChangedBody, instanceId)
JSON_MAP_REFERENCE(Lv2StateChangedBody, state)
JSON_MAP_END()
class SetPatchPropertyBody {
public:
uint64_t instanceId_;
@@ -1493,9 +1508,10 @@ protected:
}
private:
virtual void OnLv2StateChanged(int64_t instanceId)
virtual void OnLv2StateChanged(int64_t instanceId, const Lv2PluginState &state)
{
Send("onLv2StateChanged",instanceId);
Lv2StateChangedBody message { (uint64_t)instanceId, state};
Send("onLv2StateChanged",message);
}
virtual void OnErrorMessage(const std::string&message)
+101 -5
View File
@@ -26,14 +26,16 @@
#include "PluginHost.hpp"
#include "ss.hpp"
#include "MimeTypes.hpp"
#include "AutoLilvNode.hpp"
using namespace pipedal;
PiPedalUI::PiPedalUI(PluginHost *pHost, const LilvNode *uiNode, const std::filesystem::path &resourcePath)
{
auto pWorld = pHost->getWorld();
LilvNodes *fileNodes = lilv_world_find_nodes(pWorld, uiNode, pHost->lilvUris.pipedalUI__fileProperties, nullptr);
AutoLilvNodes fileNodes = lilv_world_find_nodes(pWorld, uiNode, pHost->lilvUris.pipedalUI__fileProperties, nullptr);
LILV_FOREACH(nodes, i, fileNodes)
{
const LilvNode *fileNode = lilv_nodes_get(fileNodes, i);
@@ -47,8 +49,23 @@ PiPedalUI::PiPedalUI(PluginHost *pHost, const LilvNode *uiNode, const std::files
pHost->LogWarning(SS("Failed to read pipedalui::fileProperties. " << e.what()));
}
}
AutoLilvNodes frequencyPlotNodes = lilv_world_find_nodes(pWorld, uiNode, pHost->lilvUris.pipedalUI__frequencyPlot, nullptr);
LILV_FOREACH(nodes, i, frequencyPlotNodes)
{
const LilvNode *frequencyPlotNode = lilv_nodes_get(frequencyPlotNodes, i);
try
{
UiFrequencyPlot::ptr frequencyPlotUI =
std::make_shared<UiFrequencyPlot>(pHost, frequencyPlotNode, resourcePath);
this->frequencyPlots_.push_back(std::move(frequencyPlotUI));
}
catch (const std::exception &e)
{
pHost->LogWarning(SS("Failed to read pipedalui::frequencyPlots. " << e.what()));
}
}
LilvNodes *portNotifications = lilv_world_find_nodes(pWorld, uiNode, pHost->lilvUris.ui__portNotification, nullptr);
AutoLilvNodes portNotifications = lilv_world_find_nodes(pWorld, uiNode, pHost->lilvUris.ui__portNotification, nullptr);
LILV_FOREACH(nodes, i, portNotifications)
{
const LilvNode *portNotificationNode = lilv_nodes_get(portNotifications, i);
@@ -62,8 +79,6 @@ PiPedalUI::PiPedalUI(PluginHost *pHost, const LilvNode *uiNode, const std::files
pHost->LogWarning(SS("Failed to read ui:portNotifications. " << e.what()));
}
}
lilv_nodes_free(fileNodes);
}
UiFileType::UiFileType(PluginHost *pHost, const LilvNode *node)
@@ -330,7 +345,15 @@ UiFileProperty::UiFileProperty(const std::string &name, const std::string &patch
directory_(directory)
{
}
PiPedalUI::PiPedalUI(std::vector<UiFileProperty::ptr> &&fileProperties)
PiPedalUI::PiPedalUI(
std::vector<UiFileProperty::ptr> &&fileProperties,
std::vector<UiFrequencyPlot::ptr>&& frequencyPlots)
{
this->fileProperties_ = std::move(fileProperties);
this->frequencyPlots_ = std::move(frequencyPlots);
}
PiPedalUI::PiPedalUI(
std::vector<UiFileProperty::ptr> &&fileProperties)
{
this->fileProperties_ = std::move(fileProperties);
}
@@ -357,6 +380,66 @@ UiFileType::UiFileType(const std::string&label, const std::string &fileType)
}
}
static float GetFloat(LilvWorld *pWorld,const LilvNode*node,const LilvNode*property,float defaultValue)
{
AutoLilvNode value = lilv_world_get(
pWorld,
node,
property,
nullptr);
return value.AsFloat(defaultValue);
}
UiFrequencyPlot::UiFrequencyPlot(PluginHost*pHost, const LilvNode*node,
const std::filesystem::path&resourcePath)
{
auto pWorld = pHost->getWorld();
AutoLilvNode patchProperty = lilv_world_get(
pWorld,
node,
pHost->lilvUris.pipedalUI__patchProperty,
nullptr);
if (patchProperty)
{
this->patchProperty_ = patchProperty.AsUri();
}
else
{
throw std::logic_error("PiPedal FileProperty is missing pipedalui:patchProperty value.");
}
AutoLilvNode index = lilv_world_get(
pWorld,
node,
pHost->lilvUris.lv2core__index,
nullptr);
if (index)
{
this->index_ = index.AsInt(-1);
}
else
{
this->index_ = -1;
}
AutoLilvNode portGroup = lilv_world_get(pWorld,node,pHost->lilvUris.portgroups__group,nullptr);
if (portGroup)
{
this->portGroup_ = portGroup.AsUri();
}
this->xLeft_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__xLeft,100);
this->xRight_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__xRight,22000);
this->yTop_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__yTop,5);
this->yBottom_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__yBottom,-35);
this->xLog_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__xLog,-35);
this->width_ = GetFloat(pWorld,node,pHost->lilvUris.pipedalUI__width,60);
}
JSON_MAP_BEGIN(UiPortNotification)
JSON_MAP_REFERENCE(UiPortNotification, portIndex)
JSON_MAP_REFERENCE(UiPortNotification, symbol)
@@ -377,4 +460,17 @@ JSON_MAP_REFERENCE(UiFileProperty, directory)
JSON_MAP_REFERENCE(UiFileProperty, patchProperty)
JSON_MAP_REFERENCE(UiFileProperty, fileTypes)
JSON_MAP_REFERENCE(UiFileProperty, portGroup)
JSON_MAP_END()
JSON_MAP_BEGIN(UiFrequencyPlot)
JSON_MAP_REFERENCE(UiFrequencyPlot, patchProperty)
JSON_MAP_REFERENCE(UiFrequencyPlot, index)
JSON_MAP_REFERENCE(UiFrequencyPlot, portGroup)
JSON_MAP_REFERENCE(UiFrequencyPlot, xLeft)
JSON_MAP_REFERENCE(UiFrequencyPlot, xRight)
JSON_MAP_REFERENCE(UiFrequencyPlot, xLog)
JSON_MAP_REFERENCE(UiFrequencyPlot, yTop)
JSON_MAP_REFERENCE(UiFrequencyPlot, yBottom)
JSON_MAP_REFERENCE(UiFrequencyPlot, width)
JSON_MAP_END()
+48 -2
View File
@@ -50,12 +50,20 @@
#define PIPEDAL_UI__outputPorts PIPEDAL_UI_PREFIX "outputPorts"
#define PIPEDAL_UI__text PIPEDAL_UI_PREFIX "text"
#define PIPEDAL_UI__frequencyPlot PIPEDAL_UI_PREFIX "frequencyPlot"
#define PIPEDAL_UI__xLeft PIPEDAL_UI_PREFIX "xLeft"
#define PIPEDAL_UI__xRight PIPEDAL_UI_PREFIX "xRight"
#define PIPEDAL_UI__xLog PIPEDAL_UI_PREFIX "xLog"
#define PIPEDAL_UI__yTop PIPEDAL_UI_PREFIX "yTop"
#define PIPEDAL_UI__yBottom PIPEDAL_UI_PREFIX "yBottom"
#define PIPEDAL_UI__width PIPEDAL_UI_PREFIX "width"
namespace pipedal {
class PluginHost;
class UiFileType {
private:
std::string label_;
@@ -126,18 +134,55 @@ namespace pipedal {
public:
DECLARE_JSON_MAP(UiFileProperty);
};
class UiFrequencyPlot {
private:
std::string patchProperty_;
std::int64_t index_ = -1;
std::string portGroup_;
float xLeft_ = 100;
float xRight_ = 22000;
float yTop_ = 5;
float yBottom_ = -30;
bool xLog_ = true;
float width_ = 60;
public:
using ptr = std::shared_ptr<UiFrequencyPlot>;
UiFrequencyPlot() { }
UiFrequencyPlot(PluginHost*pHost, const LilvNode*node,
const std::filesystem::path&resourcePath);
const std::string &patchProperty() const { return patchProperty_; }
int64_t index() const { return index_; }
const std::string&portGroup() const { return portGroup_; }
float xLeft() const { return xLeft_; }
float xRight() const { return xRight_; }
float xLog() const { return xLog_; }
float yTop() const { return yTop_; }
float yBottom() const { return yBottom_; }
float width() const { return width_; }
public:
DECLARE_JSON_MAP(UiFrequencyPlot);
};
class PiPedalUI {
public:
using ptr = std::shared_ptr<PiPedalUI>;
PiPedalUI(PluginHost*pHost, const LilvNode*uiNode, const std::filesystem::path&resourcePath);
PiPedalUI(std::vector<UiFileProperty::ptr> &&fileProperites);
PiPedalUI(
std::vector<UiFileProperty::ptr> &&fileProperties,
std::vector<UiFrequencyPlot::ptr> &&frequencyPlots);
PiPedalUI(
std::vector<UiFileProperty::ptr> &&fileProperties);
const std::vector<UiFileProperty::ptr>& fileProperties() const
{
return fileProperties_;
}
const std::vector<UiFrequencyPlot::ptr>& frequencyPlots() const
{
return frequencyPlots_;
}
const std::vector<UiPortNotification::ptr> &portNotifications() const { return portNotifications_; }
@@ -155,6 +200,7 @@ namespace pipedal {
private:
std::vector<UiFileProperty::ptr> fileProperties_;
std::vector<UiFrequencyPlot::ptr> frequencyPlots_;
std::vector<UiPortNotification::ptr> portNotifications_;
};
+1 -1
View File
@@ -107,7 +107,7 @@ PiPedalVersion::PiPedalVersion(PiPedalModel&model)
std::string p2pAddr = GetInterfaceIpv4Address("p2p-wlan0-0");
if (p2pAddr.length() != 0)
{
this->webAddresses_.push_back(MakeWebAddress(p2pAddr,port));
this->webAddresses_.push_back(MakeWebAddress(p2pAddr,port) + " (WiFi Direct)");
}
+33
View File
@@ -145,6 +145,14 @@ void PluginHost::LilvUris::Initialize(LilvWorld *pWorld)
pipedalUI__outputPorts = lilv_new_uri(pWorld, PIPEDAL_UI__outputPorts);
pipedalUI__text = lilv_new_uri(pWorld, PIPEDAL_UI__text);
pipedalUI__frequencyPlot = lilv_new_uri(pWorld, PIPEDAL_UI__frequencyPlot);
pipedalUI__xLeft = lilv_new_uri(pWorld, PIPEDAL_UI__xLeft);
pipedalUI__xRight = lilv_new_uri(pWorld, PIPEDAL_UI__xRight);
pipedalUI__yTop = lilv_new_uri(pWorld, PIPEDAL_UI__yTop);
pipedalUI__yBottom = lilv_new_uri(pWorld, PIPEDAL_UI__yBottom);
pipedalUI__xLog = lilv_new_uri(pWorld, PIPEDAL_UI__xLog);
pipedalUI__width = lilv_new_uri(pWorld, PIPEDAL_UI__width);
ui__portNotification = lilv_new_uri(pWorld, LV2_UI__portNotification);
ui__plugin = lilv_new_uri(pWorld, LV2_UI__plugin);
ui__protocol = lilv_new_uri(pWorld, LV2_UI__protocol);
@@ -154,6 +162,9 @@ void PluginHost::LilvUris::Initialize(LilvWorld *pWorld)
lv2__symbol = lilv_new_uri(pWorld, LV2_CORE__symbol);
lv2__port = lilv_new_uri(pWorld, LV2_CORE__port);
#define MOD_PREFIX "http://moddevices.com/ns/mod#"
mod__label = lilv_new_uri(pWorld,MOD_PREFIX "label");
mod__brand = lilv_new_uri(pWorld,MOD_PREFIX "brand");
// ui:portNotification
// [
// ui:portIndex 3;
@@ -639,11 +650,25 @@ Lv2PluginInfo::Lv2PluginInfo(PluginHost *lv2Host, LilvWorld *pWorld, const LilvP
this->has_factory_presets_ = HasFactoryPresets(lv2Host, pPlugin);
AutoLilvNode plugUri = lilv_plugin_get_uri(pPlugin);
this->uri_ = nodeAsString(lilv_plugin_get_uri(pPlugin));
AutoLilvNode name = (lilv_plugin_get_name(pPlugin));
this->name_ = nodeAsString(name);
AutoLilvNode brand = lilv_world_get(pWorld,plugUri,lv2Host->lilvUris.mod__brand, nullptr);
this->brand_ = nodeAsString(brand);
AutoLilvNode label = lilv_world_get(pWorld,plugUri,lv2Host->lilvUris.mod__label, nullptr);
this->label_ = nodeAsString(label);
if (label_.length() == 0)
{
this->label_ = name;
} else {
std::cout << this->label_ << std::endl;
}
AutoLilvNode author_name = (lilv_plugin_get_author_name(pPlugin));
this->author_name_ = nodeAsString(author_name);
@@ -1015,6 +1040,8 @@ bool PluginHost::is_a(const std::string &class_, const std::string &target_class
Lv2PluginUiInfo::Lv2PluginUiInfo(PluginHost *pHost, const Lv2PluginInfo *plugin)
: uri_(plugin->uri()),
name_(plugin->name()),
brand_(plugin->brand()),
label_(plugin->label()),
author_name_(plugin->author_name()),
author_homepage_(plugin->author_homepage()),
plugin_type_(uri_to_plugin_type(plugin->plugin_class())),
@@ -1082,6 +1109,7 @@ Lv2PluginUiInfo::Lv2PluginUiInfo(PluginHost *pHost, const Lv2PluginInfo *plugin)
if (piPedalUI)
{
this->fileProperties_ = piPedalUI->fileProperties();
this->frequencyPlots_ = piPedalUI->frequencyPlots();
this->uiPortNotifications_ = piPedalUI->portNotifications();
}
}
@@ -1401,6 +1429,8 @@ json_map::storage_type<Lv2PluginInfo> Lv2PluginInfo::jmap{{
json_map::reference("bundle_path", &Lv2PluginInfo::bundle_path_),
json_map::reference("uri", &Lv2PluginInfo::uri_),
json_map::reference("name", &Lv2PluginInfo::name_),
json_map::reference("brand", &Lv2PluginInfo::brand_),
json_map::reference("label", &Lv2PluginInfo::label_),
json_map::reference("plugin_class", &Lv2PluginInfo::plugin_class_),
json_map::reference("supported_features", &Lv2PluginInfo::supported_features_),
json_map::reference("required_features", &Lv2PluginInfo::required_features_),
@@ -1466,6 +1496,8 @@ json_map::storage_type<Lv2PluginUiInfo>
{
json_map::reference("uri", &Lv2PluginUiInfo::uri_),
json_map::reference("name", &Lv2PluginUiInfo::name_),
json_map::reference("brand", &Lv2PluginUiInfo::brand_),
json_map::reference("label", &Lv2PluginUiInfo::label_),
json_map::enum_reference("plugin_type", &Lv2PluginUiInfo::plugin_type_, get_plugin_type_enum_converter()),
json_map::reference("plugin_display_type", &Lv2PluginUiInfo::plugin_display_type_),
json_map::reference("author_name", &Lv2PluginUiInfo::author_name_),
@@ -1479,5 +1511,6 @@ json_map::storage_type<Lv2PluginUiInfo>
json_map::reference("port_groups", &Lv2PluginUiInfo::port_groups_),
json_map::reference("is_vst3", &Lv2PluginUiInfo::is_vst3_),
json_map::reference("fileProperties", &Lv2PluginUiInfo::fileProperties_),
json_map::reference("frequencyPlots", &Lv2PluginUiInfo::frequencyPlots_),
json_map::reference("uiPortNotifications", &Lv2PluginUiInfo::uiPortNotifications_),
}};
+24
View File
@@ -346,6 +346,8 @@ namespace pipedal
std::string uri_;
std::string name_;
std::string plugin_class_;
std::string brand_;
std::string label_;
std::vector<std::string> supported_features_;
std::vector<std::string> required_features_;
std::vector<std::string> optional_features_;
@@ -367,6 +369,8 @@ namespace pipedal
LV2_PROPERTY_GETSET(bundle_path)
LV2_PROPERTY_GETSET(uri)
LV2_PROPERTY_GETSET(name)
LV2_PROPERTY_GETSET(brand)
LV2_PROPERTY_GETSET(label)
LV2_PROPERTY_GETSET(plugin_class)
LV2_PROPERTY_GETSET(supported_features)
LV2_PROPERTY_GETSET(required_features)
@@ -574,6 +578,8 @@ namespace pipedal
private:
std::string uri_;
std::string name_;
std::string brand_;
std::string label_;
std::string author_name_;
std::string author_homepage_;
PluginType plugin_type_;
@@ -588,11 +594,14 @@ namespace pipedal
std::vector<Lv2PluginUiPort> controls_;
std::vector<Lv2PluginUiPortGroup> port_groups_;
std::vector<UiFileProperty::ptr> fileProperties_;
std::vector<UiFrequencyPlot::ptr> frequencyPlots_;
std::vector<UiPortNotification::ptr> uiPortNotifications_;
public:
LV2_PROPERTY_GETSET(uri)
LV2_PROPERTY_GETSET(name)
LV2_PROPERTY_GETSET(brand)
LV2_PROPERTY_GETSET(label)
LV2_PROPERTY_GETSET(author_name)
LV2_PROPERTY_GETSET(author_homepage)
LV2_PROPERTY_GETSET_SCALAR(plugin_type)
@@ -606,6 +615,7 @@ namespace pipedal
LV2_PROPERTY_GETSET(port_groups)
LV2_PROPERTY_GETSET_SCALAR(is_vst3)
LV2_PROPERTY_GETSET(fileProperties)
LV2_PROPERTY_GETSET(frequencyPlots)
LV2_PROPERTY_GETSET(uiPortNotifications)
static json_map::storage_type<Lv2PluginUiInfo> jmap;
@@ -676,6 +686,15 @@ namespace pipedal
AutoLilvNode pipedalUI__fileExtension;
AutoLilvNode pipedalUI__mimeType;
AutoLilvNode pipedalUI__frequencyPlot;
AutoLilvNode pipedalUI__xLeft;
AutoLilvNode pipedalUI__xRight;
AutoLilvNode pipedalUI__xLog;
AutoLilvNode pipedalUI__yTop;
AutoLilvNode pipedalUI__yBottom;
AutoLilvNode pipedalUI__width;
AutoLilvNode pipedalUI__outputPorts;
AutoLilvNode pipedalUI__text;
@@ -696,9 +715,14 @@ namespace pipedal
AutoLilvNode lv2__symbol;
AutoLilvNode lv2__port;
AutoLilvNode ui__FrequencyPlot;
AutoLilvNode patch__writable;
AutoLilvNode patch__readable;
AutoLilvNode mod__brand;
AutoLilvNode mod__label;
AutoLilvNode dc__format;
};
LilvUris lilvUris;