new syntax sugar for plugin registration
parent
e4475cbce0
commit
dd6c9009a7
4
notes
4
notes
|
@ -40,6 +40,10 @@ TODO {
|
|||
}
|
||||
}
|
||||
|
||||
fix weird blips with QuickLevel
|
||||
|
||||
normalize pulse waves from 2x03
|
||||
|
||||
revert-to-saved menu action
|
||||
|
||||
distortion effect
|
||||
|
|
|
@ -37,3 +37,10 @@ namespace Xybrid::Config {
|
|||
void populatePluginMenu(QMenu*, std::function<void(std::shared_ptr<Data::Node>)>, Data::Graph* = nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
#define RegisterPlugin(NAME, ...) \
|
||||
namespace { bool _x___reg_##NAME = Xybrid::Config::PluginRegistry::enqueueRegistration([] { \
|
||||
auto i = std::make_shared<Xybrid::Config::PluginInfo>();\
|
||||
i->createInstance = []{ return std::make_shared<NAME>(); };\
|
||||
__VA_ARGS__ \
|
||||
Xybrid::Config::PluginRegistry::registerPlugin(i); }); }
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using Xybrid::Effects::Delay;
|
||||
using namespace Xybrid::Data;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "nodelib/basics.h"
|
||||
using namespace Xybrid::NodeLib;
|
||||
|
||||
|
@ -20,23 +22,16 @@ using namespace Xybrid::Audio;
|
|||
#include "ui/gadgets/knobgadget.h"
|
||||
using namespace Xybrid::UI;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QCborMap>
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "fx:delay";
|
||||
i->oldIds = {"gadget:delay"};
|
||||
i->displayName = "Delay";
|
||||
i->category = "Effect";
|
||||
i->createInstance = []{ return std::make_shared<Delay>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
}
|
||||
RegisterPlugin(Delay, {
|
||||
i->id = "fx:delay";
|
||||
i->oldIds = {"gadget:delay"};
|
||||
i->displayName = "Delay";
|
||||
i->category = "Effect";
|
||||
})
|
||||
|
||||
Delay::Delay() { }
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
using Xybrid::Effects::SVF;
|
||||
using namespace Xybrid::Data;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "nodelib/basics.h"
|
||||
using namespace Xybrid::NodeLib;
|
||||
|
||||
|
@ -38,21 +40,12 @@ using namespace Xybrid::UI;
|
|||
|
||||
#include <QCborMap>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
#define MIN(a,b) (a<b?a:b)
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "fx:svf";
|
||||
i->oldIds = {"gadget:svf"};
|
||||
i->displayName = "Filter";
|
||||
i->category = "Effect";
|
||||
i->createInstance = []{ return std::make_shared<SVF>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
}
|
||||
RegisterPlugin(SVF, {
|
||||
i->id = "fx:svf";
|
||||
i->oldIds = {"gadget:svf"};
|
||||
i->displayName = "Filter";
|
||||
i->category = "Effect";
|
||||
})
|
||||
|
||||
SVF::SVF() { }
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using Xybrid::Gadgets::GainBalance;
|
||||
using namespace Xybrid::Data;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "nodelib/basics.h"
|
||||
using namespace Xybrid::NodeLib;
|
||||
|
||||
|
@ -23,20 +25,12 @@ using namespace Xybrid::UI;
|
|||
|
||||
#include <QCborMap>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "gadget:gainbalance";
|
||||
i->displayName = "Gain/Balance";
|
||||
i->category = "Gadget";
|
||||
//i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<GainBalance>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
}
|
||||
RegisterPlugin(GainBalance, {
|
||||
i->id = "gadget:gainbalance";
|
||||
i->displayName = "Gain/Balance";
|
||||
i->category = "Gadget";
|
||||
//i->hidden = true;
|
||||
})
|
||||
|
||||
GainBalance::GainBalance() {
|
||||
|
||||
|
|
|
@ -26,17 +26,13 @@ using namespace Xybrid::Audio;
|
|||
|
||||
#include "util/strings.h"
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "ioport";
|
||||
i->displayName = "I/O Port";
|
||||
i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<IOPort>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
RegisterPlugin(IOPort, {
|
||||
i->id = "ioport";
|
||||
i->displayName = "I/O Port";
|
||||
i->hidden = true;
|
||||
})
|
||||
|
||||
namespace {
|
||||
Port::Type opposite(Port::Type t) {
|
||||
if (t == Port::Input) return Port::Output;
|
||||
return Port::Input;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using Xybrid::Gadgets::MixBoard;
|
||||
using namespace Xybrid::Data;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "nodelib/basics.h"
|
||||
using namespace Xybrid::NodeLib;
|
||||
|
||||
|
@ -27,18 +29,11 @@ using namespace Xybrid::UI;
|
|||
#include <QCborMap>
|
||||
#include <QCborArray>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "gadget:mixboard";
|
||||
i->displayName = "Mixer Board";
|
||||
i->category = "Gadget";
|
||||
i->createInstance = []{ return std::make_shared<MixBoard>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
}
|
||||
RegisterPlugin(MixBoard, {
|
||||
i->id = "gadget:mixboard";
|
||||
i->displayName = "Mixer Board";
|
||||
i->category = "Gadget";
|
||||
})
|
||||
|
||||
MixBoard::MixBoard() {
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace Xybrid::Data;
|
|||
#include <QGraphicsScene>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#define qs QStringLiteral
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "config/pluginregistry.h"
|
||||
using namespace Xybrid::Config;
|
||||
|
@ -23,16 +23,11 @@ using namespace Xybrid::UI;
|
|||
#include "data/audioframe.h"
|
||||
#include "data/porttypes.h"
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "gadget:quicklevel";
|
||||
i->displayName = "Quick Level";
|
||||
i->category = "Gadget";
|
||||
i->createInstance = []{ return std::make_shared<QuickLevel>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
}
|
||||
RegisterPlugin(QuickLevel, {
|
||||
i->id = "gadget:quicklevel";
|
||||
i->displayName = "Quick Level";
|
||||
i->category = "Gadget";
|
||||
})
|
||||
|
||||
QuickLevel::QuickLevel() {
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using Xybrid::Gadgets::Transpose;
|
||||
using namespace Xybrid::Data;
|
||||
|
||||
#include "util/strings.h"
|
||||
|
||||
#include "data/porttypes.h"
|
||||
|
||||
#include "config/pluginregistry.h"
|
||||
|
@ -19,20 +21,11 @@ using namespace Xybrid::UI;
|
|||
|
||||
#include <QCborMap>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "gadget:transpose";
|
||||
i->displayName = "Transpose";
|
||||
i->category = "Gadget";
|
||||
//i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<Transpose>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
}
|
||||
RegisterPlugin(Transpose, {
|
||||
i->id = "gadget:transpose";
|
||||
i->displayName = "Transpose";
|
||||
i->category = "Gadget";
|
||||
})
|
||||
|
||||
Transpose::Transpose() {
|
||||
|
||||
|
|
|
@ -26,18 +26,13 @@ using namespace Xybrid::UI;
|
|||
#include <QCborValue>
|
||||
#include <QCborArray>
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:2x03";
|
||||
i->displayName = "2x03";
|
||||
i->category = "Instrument";
|
||||
//i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<I2x03>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
RegisterPlugin(I2x03, {
|
||||
i->id = "plug:2x03";
|
||||
i->displayName = "2x03";
|
||||
i->category = "Instrument";
|
||||
})
|
||||
|
||||
namespace {
|
||||
std::unordered_map<int8_t, QString> waveNames = [] {
|
||||
std::unordered_map<int8_t, QString> m;
|
||||
|
||||
|
|
|
@ -23,18 +23,14 @@ using namespace Xybrid::UI;
|
|||
|
||||
#include "nodelib/resampler.h"
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:testsynth";
|
||||
i->displayName = "The Testron";
|
||||
i->category = "Instrument";
|
||||
//i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<TestSynth>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
RegisterPlugin(TestSynth, {
|
||||
i->id = "plug:testsynth";
|
||||
i->displayName = "The Testron";
|
||||
i->category = "Instrument";
|
||||
i->hidden = true;
|
||||
})
|
||||
|
||||
namespace {
|
||||
const double PI = std::atan(1)*4;
|
||||
const double SEMI = std::pow(2.0, 1.0/12.0);
|
||||
|
||||
|
|
|
@ -28,16 +28,13 @@ using namespace Xybrid::UI;
|
|||
#include <QCborValue>
|
||||
#include <QCborArray>
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:thicc";
|
||||
i->displayName = "THiCC";
|
||||
i->category = "Instrument";
|
||||
i->createInstance = []{ return std::make_shared<Thicc>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
RegisterPlugin(Thicc, {
|
||||
i->id = "plug:thicc";
|
||||
i->displayName = "THiCC";
|
||||
i->category = "Instrument";
|
||||
})
|
||||
|
||||
namespace {
|
||||
[[maybe_unused]] inline double wrap(double d) {
|
||||
while (true) {
|
||||
if (d > 1.0) d = (d - 2.0) * -1; //d-=2.0;
|
||||
|
|
|
@ -26,16 +26,13 @@ using namespace Xybrid::UI;
|
|||
#include <QCborValue>
|
||||
#include <QCborArray>
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:xriek";
|
||||
i->displayName = "Xriek";
|
||||
i->category = "Instrument";
|
||||
i->createInstance = []{ return std::make_shared<Xriek>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
});
|
||||
RegisterPlugin(Xriek, {
|
||||
i->id = "plug:xriek";
|
||||
i->displayName = "Xriek";
|
||||
i->category = "Instrument";
|
||||
})
|
||||
|
||||
namespace {
|
||||
[[maybe_unused]] inline double wrap(double d) {
|
||||
while (true) {
|
||||
if (d > 1.0) d = (d - 2.0) * -1; //d-=2.0;
|
||||
|
|
|
@ -42,21 +42,11 @@ using namespace Xybrid::UI;
|
|||
#include <QMenu>
|
||||
#include <QGraphicsProxyWidget>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:beatpad";
|
||||
i->displayName = "BeatPad";
|
||||
i->category = "Sampler";
|
||||
//i->hidden = true;
|
||||
i->createInstance = []{ return std::make_shared<BeatPad>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
|
||||
}
|
||||
RegisterPlugin(BeatPad, {
|
||||
i->id = "plug:beatpad";
|
||||
i->displayName = "BeatPad";
|
||||
i->category = "Sampler";
|
||||
})
|
||||
|
||||
BeatPad::BeatPad() {
|
||||
|
||||
|
|
|
@ -41,20 +41,11 @@ using namespace Xybrid::UI;
|
|||
#include <QMenu>
|
||||
#include <QGraphicsProxyWidget>
|
||||
|
||||
#define qs QStringLiteral
|
||||
|
||||
namespace {
|
||||
bool _ = PluginRegistry::enqueueRegistration([] {
|
||||
auto i = std::make_shared<PluginInfo>();
|
||||
i->id = "plug:capaxitor";
|
||||
i->displayName = "CapaXitor";
|
||||
i->category = "Sampler";
|
||||
i->createInstance = []{ return std::make_shared<Capaxitor>(); };
|
||||
PluginRegistry::registerPlugin(i);
|
||||
//inf = i;
|
||||
});
|
||||
|
||||
}
|
||||
RegisterPlugin(Capaxitor, {
|
||||
i->id = "plug:capaxitor";
|
||||
i->displayName = "CapaXitor";
|
||||
i->category = "Sampler";
|
||||
})
|
||||
|
||||
Capaxitor::Capaxitor() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue