Browse Source

Add new metadata fields; Export more LV2 stuff, more MOD support

pull/6/head
falkTX 8 years ago
parent
commit
eafa8349a9
5 changed files with 109 additions and 10 deletions
  1. +16
    -3
      distrho/DistrhoPlugin.hpp
  2. +9
    -0
      distrho/DistrhoUtils.hpp
  3. +14
    -0
      distrho/src/DistrhoPluginInternal.hpp
  4. +68
    -5
      distrho/src/DistrhoPluginLV2export.cpp
  5. +2
    -2
      utils/lv2-ttl-generator/GNUmakefile

+ 16
- 3
distrho/DistrhoPlugin.hpp View File

@@ -549,26 +549,39 @@ protected:
*/
virtual const char* getLabel() const = 0;

/**
Get an extensive comment/description about the plugin.@n
Optional, returns nothing by default.
*/
virtual const char* getDescription() const { return ""; }

/**
Get the plugin author/maker.
*/
virtual const char* getMaker() const = 0;

/**
Get the plugin license name (a single line of text).@n
Get the plugin homepage.@n
Optional, returns nothing by default.
*/
virtual const char* getHomePage() const { return ""; }

/**
Get the plugin license (a single line of text or a URL).@n
For commercial plugins this should return some short copyright information.
*/
virtual const char* getLicense() const = 0;

/**
Get the plugin version, in hexadecimal.@n
TODO format to be defined
Get the plugin version, in hexadecimal.
@see d_version()
*/
virtual uint32_t getVersion() const = 0;

/**
Get the plugin unique Id.@n
This value is used by LADSPA, DSSI and VST plugin formats.
@see d_cconst()
*/
virtual int64_t getUniqueId() const = 0;



+ 9
- 0
distrho/DistrhoUtils.hpp View File

@@ -62,6 +62,15 @@ int64_t d_cconst(const uint8_t a, const uint8_t b, const uint8_t c, const uint8_
return (a << 24) | (b << 16) | (c << 8) | (d << 0);
}

/*
* Return an hexadecimal representation of a MAJ.MIN.MICRO version number.
*/
static inline
uint32_t d_version(const uint8_t major, const uint8_t minor, const uint8_t micro) noexcept
{
return (major << 16) | (minor << 8) | (micro << 0);
}

/*
* Dummy function.
*/


+ 14
- 0
distrho/src/DistrhoPluginInternal.hpp View File

@@ -196,6 +196,13 @@ public:
return fPlugin->getLabel();
}

const char* getDescription() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, "");

return fPlugin->getDescription();
}

const char* getMaker() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, "");
@@ -203,6 +210,13 @@ public:
return fPlugin->getMaker();
}

const char* getHomePage() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, "");

return fPlugin->getHomePage();
}

const char* getLicense() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, "");


+ 68
- 5
distrho/src/DistrhoPluginLV2export.cpp View File

@@ -195,6 +195,10 @@ void lv2_generate_ttl(const char* const basename)
pluginString += "@prefix doap: <http://usefulinc.com/ns/doap#> .\n";
pluginString += "@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n";
pluginString += "@prefix lv2: <" LV2_CORE_PREFIX "> .\n";
#ifdef DISTRHO_PLUGIN_BRAND
pluginString += "@prefix mod: <http://moddevices.com/ns/mod#> .\n";
#endif
pluginString += "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n";
pluginString += "@prefix rsz: <" LV2_RESIZE_PORT_PREFIX "> .\n";
#if DISTRHO_PLUGIN_HAS_UI
pluginString += "@prefix ui: <" LV2_UI_PREFIX "> .\n";
@@ -266,7 +270,7 @@ void lv2_generate_ttl(const char* const basename)
pluginString += " a lv2:InputPort, lv2:AudioPort ;\n";

pluginString += " lv2:index " + String(portIndex) + " ;\n";
pluginString += " lv2:symbol \"" + port.symbol + "\" ;\n";
pluginString += " lv2:symbol \"lv2_" + port.symbol + "\" ;\n";
pluginString += " lv2:name \"" + port.name + "\" ;\n";

if (port.hints & kAudioPortIsSidechain)
@@ -296,7 +300,7 @@ void lv2_generate_ttl(const char* const basename)
pluginString += " a lv2:OutputPort, lv2:AudioPort ;\n";

pluginString += " lv2:index " + String(portIndex) + " ;\n";
pluginString += " lv2:symbol \"" + port.symbol + "\" ;\n";
pluginString += " lv2:symbol \"lv2_" + port.symbol + "\" ;\n";
pluginString += " lv2:name \"" + port.name + "\" ;\n";

if (port.hints & kAudioPortIsSidechain)
@@ -426,6 +430,14 @@ void lv2_generate_ttl(const char* const basename)
{
pluginString += " unit:unit unit:mhz ;\n";
}
else if (unit == "ms")
{
pluginString += " unit:unit unit:ms ;\n";
}
else if (unit == "s")
{
pluginString += " unit:unit unit:s ;\n";
}
else if (unit == "%")
{
pluginString += " unit:unit unit:pc ;\n";
@@ -433,8 +445,7 @@ void lv2_generate_ttl(const char* const basename)
else
{
pluginString += " unit:unit [\n";
pluginString += " a unit:Unit ;\n";
pluginString += " unit:name \"" + unit + "\" ;\n";
pluginString += " rdfs:label \"" + unit + "\" ;\n";
pluginString += " unit:symbol \"" + unit + "\" ;\n";
pluginString += " unit:render \"%f " + unit + "\" ;\n";
pluginString += " ] ;\n";
@@ -466,8 +477,60 @@ void lv2_generate_ttl(const char* const basename)
}
}

// comment
{
const String comment(plugin.getDescription());

if (comment.isNotEmpty())
pluginString += " rdfs:comment \"\"\"\n" + comment + "\n\"\"\" ;\n\n";
}

#ifdef DISTRHO_PLUGIN_BRAND
// MOD
pluginString += " mod:brand \"" DISTRHO_PLUGIN_BRAND "\" ;\n";
pluginString += " mod:label \"" + String(plugin.getName()) + "\" ;\n\n";
#endif

// name
pluginString += " doap:name \"" + String(plugin.getName()) + "\" ;\n";
pluginString += " doap:maintainer [ foaf:name \"" + String(plugin.getMaker()) + "\" ] .\n";

// license
{
const String license(plugin.getLicense());

if (license.contains("://"))
pluginString += " doap:license <" + license + "> ;\n\n";
else
pluginString += " doap:license \"" + license + "\" ;\n\n";
}

// developer
{
const String homepage(plugin.getHomePage());

pluginString += " doap:maintainer [\n";
pluginString += " foaf:name \"" + String(plugin.getMaker()) + "\" ;\n";

if (homepage.isNotEmpty())
pluginString += " foaf:homepage <" + homepage + "> ;\n";

pluginString += " ] ;\n\n";
}

{
const uint32_t version(plugin.getVersion());

const uint32_t majorVersion = (version & 0xFF0000) >> 16;
const uint32_t microVersion = (version & 0x00FF00) >> 8;
/* */ uint32_t minorVersion = (version & 0x0000FF) >> 0;

// NOTE: LV2 ignores 'major' version and says 0 for minor is pre-release/unstable.
if (majorVersion > 0)
minorVersion += 2;

pluginString += " lv2:microVersion " + String(microVersion) + " ;\n";
pluginString += " lv2:minorVersion " + String(minorVersion) + " .\n";
}

pluginFile << pluginString << std::endl;
pluginFile.close();


+ 2
- 2
utils/lv2-ttl-generator/GNUmakefile View File

@@ -9,10 +9,10 @@ build: ../lv2_ttl_generator
endif

../lv2_ttl_generator: lv2_ttl_generator.c
$(CC) lv2_ttl_generator.c -o ../lv2_ttl_generator -ldl
$(CC) $< -o $@ -ldl

../lv2_ttl_generator.exe: lv2_ttl_generator.c
$(CC) lv2_ttl_generator.c -o ../lv2_ttl_generator.exe -static
$(CC) $< -o $@ -static
touch ../lv2_ttl_generator

clean:


Loading…
Cancel
Save