Commit 3e50f1ae authored by Benjamin Heisch's avatar Benjamin Heisch
Browse files

try an approach to generated an random id, before extra information can be...

try an approach to generated an random id, before extra information  can be passed to format plugins.
parent d7ea7088
Pipeline #19371 passed with stages
in 6 minutes and 3 seconds
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
XPlug is an crossplatform audio abstraction plugin, which is currently under heavy development. XPlug is an crossplatform audio abstraction plugin, which is currently under heavy development.
At the moment it supports VST2, VST3, LV2 and LADSPA. But there are a lot more to come, because its made for adding more Formats to it. At the moment it supports VST2, VST3, LV2 and LADSPA. But there are a lot more to come, because its made for adding more Formats to it.
Because its in an early phase of development it just supports audio and midi processing ( sure a lot more too, but that are details). Because its in an early phase of development it just supports audio and midi processing ( sure a lot more too, but that are details).
There should be GUI and Parameter support soon, so that this Library can be used in production. There should be GUI and Parameter support soon, so that this Library can be used in production. 6
## Dependencies ## Dependencies
Before building XPlug make sure, that all dependencies are installed. For the buildprocess you need CMake and an compiler. Before building XPlug make sure, that all dependencies are installed. For the buildprocess you need CMake and an compiler.
......
...@@ -131,7 +131,7 @@ extern "C" ...@@ -131,7 +131,7 @@ extern "C"
desc->Maker = plug->getInfoComponent()->getCreatorName().data(); desc->Maker = plug->getInfoComponent()->getCreatorName().data();
desc->Name = plug->getInfoComponent()->getPluginName().data(); desc->Name = plug->getInfoComponent()->getPluginName().data();
// desc->Name = "Hans peter"; // desc->Name = "Hans peter";
desc->UniqueID = 278375745; desc->UniqueID = plug->getInfoComponent()->getID();
desc->run = [](LADSPA_Handle instance, unsigned long SampleCount) { desc->run = [](LADSPA_Handle instance, unsigned long SampleCount) {
auto data = static_cast<LADSPAHandleDataType*>(instance); auto data = static_cast<LADSPAHandleDataType*>(instance);
......
...@@ -357,7 +357,7 @@ extern "C" ...@@ -357,7 +357,7 @@ extern "C"
effect->dispatcher = vst_dispatcher; effect->dispatcher = vst_dispatcher;
/******************INFORMATION*****************/ /******************INFORMATION*****************/
effect->uniqueID = 0; effect->uniqueID = implementationData->plug->getInfoComponent()->getID();
effect->version = 0; effect->version = 0;
effect->numInputs = static_cast<int>(getNumberOfPorts<IAudioPort>( effect->numInputs = static_cast<int>(getNumberOfPorts<IAudioPort>(
implementationData->plug, PortDirection::Input)); implementationData->plug, PortDirection::Input));
......
...@@ -16,13 +16,15 @@ public: ...@@ -16,13 +16,15 @@ public:
std::string pluginCopyright; std::string pluginCopyright;
std::string creatorName; std::string creatorName;
std::string creatorURL; std::string creatorURL;
int64_t id;
StaticInfoComponent(); StaticInfoComponent();
StaticInfoComponent(std::string pluginName, StaticInfoComponent(std::string pluginName,
std::string pluginUri, std::string pluginUri,
std::string pluginDescription, std::string pluginDescription,
std::string pluginCopyright, std::string pluginCopyright,
std::string creatorName, std::string creatorName,
std::string creatorURL); std::string creatorURL,
int64_t _id);
virtual std::string_view getPluginName() override; virtual std::string_view getPluginName() override;
virtual std::string_view getPluginURI() override; virtual std::string_view getPluginURI() override;
...@@ -30,6 +32,7 @@ public: ...@@ -30,6 +32,7 @@ public:
virtual std::string_view getPluginCopyright() override; virtual std::string_view getPluginCopyright() override;
virtual std::string_view getCreatorName() override; virtual std::string_view getCreatorName() override;
virtual std::string_view getCreatorURL() override; virtual std::string_view getCreatorURL() override;
virtual int64_t getID() override;
}; };
} }
#endif //! INFO_COMPONENTS_HPP #endif //! INFO_COMPONENTS_HPP
\ No newline at end of file
...@@ -35,7 +35,11 @@ public: ...@@ -35,7 +35,11 @@ public:
* @return Copyright or Licence of the Plugin. * @return Copyright or Licence of the Plugin.
*/ */
virtual std::string_view getPluginCopyright() = 0; virtual std::string_view getPluginCopyright() = 0;
/**
* @brief Gets the ID of the Plugin, which is used in the format libraries.
* @return returns the id of the plugin.
*/
virtual int64_t getID() = 0;
/********************Creator/Vendor information*********************/ /********************Creator/Vendor information*********************/
/** /**
* @brief Gets the Name of the creator, vendor or developer. * @brief Gets the Name of the creator, vendor or developer.
......
...@@ -8,13 +8,15 @@ XPlug::StaticInfoComponent::StaticInfoComponent() ...@@ -8,13 +8,15 @@ XPlug::StaticInfoComponent::StaticInfoComponent()
this->pluginCopyright = ""; this->pluginCopyright = "";
this->creatorName = ""; this->creatorName = "";
this->creatorURL = ""; this->creatorURL = "";
this->id = 0;
} }
XPlug::StaticInfoComponent::StaticInfoComponent(std::string _pluginName, XPlug::StaticInfoComponent::StaticInfoComponent(std::string _pluginName,
std::string _pluginUri, std::string _pluginUri,
std::string _pluginDescription, std::string _pluginDescription,
std::string _pluginCopyright, std::string _pluginCopyright,
std::string _creatorName, std::string _creatorName,
std::string _creatorURL) std::string _creatorURL,
int64_t _id)
{ {
this->pluginName = _pluginName; this->pluginName = _pluginName;
this->pluginUri = _pluginUri; this->pluginUri = _pluginUri;
...@@ -22,6 +24,7 @@ XPlug::StaticInfoComponent::StaticInfoComponent(std::string _pluginName, ...@@ -22,6 +24,7 @@ XPlug::StaticInfoComponent::StaticInfoComponent(std::string _pluginName,
this->pluginCopyright = _pluginCopyright; this->pluginCopyright = _pluginCopyright;
this->creatorName = _creatorName; this->creatorName = _creatorName;
this->creatorURL = _creatorURL; this->creatorURL = _creatorURL;
this->id = _id;
} }
std::string_view std::string_view
XPlug::StaticInfoComponent::getPluginName() XPlug::StaticInfoComponent::getPluginName()
...@@ -52,4 +55,10 @@ std::string_view ...@@ -52,4 +55,10 @@ std::string_view
XPlug::StaticInfoComponent::getCreatorURL() XPlug::StaticInfoComponent::getCreatorURL()
{ {
return this->creatorURL; return this->creatorURL;
} }
\ No newline at end of file
int64_t
XPlug::StaticInfoComponent::getID()
{
return this->id;
}
#include <base/PluginBases.hpp> #include <base/PluginBases.hpp>
#include <memory> #include <memory>
#include <random>
using namespace XPlug; using namespace XPlug;
XPlug::LazyPlugin::LazyPlugin() XPlug::LazyPlugin::LazyPlugin()
{ {
std::default_random_engine engine;
this->infoComponent = std::make_unique<StaticInfoComponent>( this->infoComponent = std::make_unique<StaticInfoComponent>(
"No Name Plugin", "No Name Plugin",
"urn://LazyPlugin/ToLazyToInit", "urn://LazyPlugin/ToLazyToInit",
"A simple plugin wich does something... at least it exists", "A simple plugin wich does something... at least it exists",
"LGPL", "LGPL",
"Me", "Me",
"http://myhompeage.never.existed.com"); "http://myhompeage.never.existed.com",
std::uniform_int_distribution<int64_t>()(engine));
this->portComponent= std::make_unique<DynamicPortComponent>(); this->portComponent = std::make_unique<DynamicPortComponent>();
this->featureComponent = std::make_unique<AutomaticFeatureComponent>(this->portComponent.get()); this->featureComponent =
std::make_unique<AutomaticFeatureComponent>(this->portComponent.get());
} }
XPlug::LazyPlugin::LazyPlugin(std::vector<std::unique_ptr<IPort>> ports) XPlug::LazyPlugin::LazyPlugin(std::vector<std::unique_ptr<IPort>> ports)
......
...@@ -9,6 +9,7 @@ TEST_CASE("Test InfoComponent Methods") ...@@ -9,6 +9,7 @@ TEST_CASE("Test InfoComponent Methods")
"pluginDescription", "pluginDescription",
"pluginCopyright", "pluginCopyright",
"creatorName", "creatorName",
"creatorURL"); "creatorURL",
1234);
testIInfoComponent(&comp); testIInfoComponent(&comp);
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment