summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfalkTX <falktx@gmail.com>2019-01-29 10:21:40 +0100
committerfalkTX <falktx@gmail.com>2019-01-29 10:21:40 +0100
commit50ccb7e0f4447d66e61883bcd6b2f147de03f7a2 (patch)
treea2a52c54304b0224e2da76db7a9cca2e6b642dc1
parenta291737aef87bfbac914f004bcf3f36bea80affc (diff)
Dynamic AU res id based on plugin unique id
Signed-off-by: falkTX <falktx@gmail.com>
-rw-r--r--distrho/DistrhoPlugin.hpp2
-rw-r--r--distrho/src/DistrhoPluginAUexport.cpp24
2 files changed, 22 insertions, 4 deletions
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
index 1da2bdb6..9eecce6c 100644
--- a/distrho/DistrhoPlugin.hpp
+++ b/distrho/DistrhoPlugin.hpp
@@ -771,7 +771,7 @@ protected:
/**
Get the plugin unique Id.@n
- This value is used by LADSPA, DSSI and VST plugin formats.
+ This value is used by LADSPA, DSSI, VST and AU plugin formats.
@see d_cconst()
*/
virtual int64_t getUniqueId() const = 0;
diff --git a/distrho/src/DistrhoPluginAUexport.cpp b/distrho/src/DistrhoPluginAUexport.cpp
index 2c1f749f..e60f1ba1 100644
--- a/distrho/src/DistrhoPluginAUexport.cpp
+++ b/distrho/src/DistrhoPluginAUexport.cpp
@@ -21,7 +21,7 @@
// -----------------------------------------------------------------------
-void au_generate_r(const char* const basename)
+int au_generate_r(const char* const basename)
{
USE_NAMESPACE_DISTRHO
@@ -72,6 +72,23 @@ void au_generate_r(const char* const basename)
rFile << "#define DISTRHO_PLUGIN_DESCRIPTION \"" + description + "\"\n";
}
+ // res id
+ if (const int64_t uniqueId = plugin.getUniqueId())
+ {
+ if (uniqueId < 0)
+ {
+ d_stderr2("AU plugin Id cannot be negative");
+ return 1;
+ }
+ if (uniqueId >= UINT32_MAX)
+ {
+ d_stderr2("AU plugin Id cannot be higher than uint32");
+ return 1;
+ }
+
+ rFile << "#define DISTRHO_PLUGIN_AU_RES_ID \"" + String(uniqueId) + "\"\n";
+ }
+
#ifndef DEBUG
// version
{
@@ -88,6 +105,8 @@ void au_generate_r(const char* const basename)
rFile.close();
std::cout << " done!" << std::endl;
+
+ return 0;
}
// -----------------------------------------------------------------------
@@ -100,8 +119,7 @@ int main(int argc, char* argv[])
return 1;
}
- au_generate_r(argv[1]);
- return 0;
+ return au_generate_r(argv[1]);
}
// -----------------------------------------------------------------------