summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfalkTX <falktx@falktx.com>2022-11-20 16:47:37 +0000
committerfalkTX <falktx@falktx.com>2022-11-20 16:47:37 +0000
commit53148852c03fc5a0a914cefda6f3850bd9aebdd0 (patch)
tree6bc7f261e39de68c09261882396583a2481c8777
parent22413340a6d8ef2ffbf38ce841fb44c448a1a84a (diff)
Implement custom State::fileTypes for MOD
Signed-off-by: falkTX <falktx@falktx.com>
-rw-r--r--distrho/DistrhoPlugin.hpp21
-rw-r--r--distrho/src/DistrhoPluginInternal.hpp9
-rw-r--r--distrho/src/DistrhoPluginLV2export.cpp9
3 files changed, 39 insertions, 0 deletions
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
index 02d2cda7..79b65a8c 100644
--- a/distrho/DistrhoPlugin.hpp
+++ b/distrho/DistrhoPlugin.hpp
@@ -763,6 +763,27 @@ struct State {
*/
String description;
+ #ifdef __MOD_DEVICES__
+ /**
+ The file types that a filename path state supports, written as a comma-separated string without whitespace.
+ Currently supported file types are:
+ - audioloop: Audio Loops, meant to be used for looper-style plugins
+ - audiorecording: Audio Recordings, triggered by plugins and stored in the unit
+ - audiosample: One-shot Audio Samples, meant to be used for sampler-style plugins
+ - audiotrack: Audio Tracks, meant to be used as full-performance/song or backtrack
+ - cabsim: Speaker Cabinets, meant as small IR audio files
+ - h2drumkit: Hydrogen Drumkits, must use h2drumkit file extension
+ - ir: Impulse Responses
+ - midiclip: MIDI Clips, to be used in sync with host tempo, must have mid or midi file extension
+ - midisong: MIDI Songs, meant to be used as full-performance/song or backtrack
+ - sf2: SF2 Instruments, must have sf2 or sf3 file extension
+ - sfz: SFZ Instruments, must have sfz file extension
+
+ @note This is a custom extension only valid in builds MOD Audio.
+ */
+ String fileTypes;
+ #endif
+
/**
Default constructor for a null state.
*/
diff --git a/distrho/src/DistrhoPluginInternal.hpp b/distrho/src/DistrhoPluginInternal.hpp
index 30b31355..413654d7 100644
--- a/distrho/src/DistrhoPluginInternal.hpp
+++ b/distrho/src/DistrhoPluginInternal.hpp
@@ -859,6 +859,15 @@ public:
return fData->states[index].description;
}
+ #ifdef __MOD_DEVICES__
+ const String& getStateFileTypes(const uint32_t index) const noexcept
+ {
+ DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->stateCount, sFallbackString);
+
+ return fData->states[index].fileTypes;
+ }
+ #endif
+
# if DISTRHO_PLUGIN_WANT_FULL_STATE
String getStateValue(const char* const key) const
{
diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp
index 24d9e229..8b93e7c7 100644
--- a/distrho/src/DistrhoPluginLV2export.cpp
+++ b/distrho/src/DistrhoPluginLV2export.cpp
@@ -393,9 +393,18 @@ void lv2_generate_ttl(const char* const basename)
}
if ((hints & kStateIsFilenamePath) == kStateIsFilenamePath)
+ {
+ #ifdef __MOD_DEVICES__
+ const String& fileTypes(plugin.getStateFileTypes(i));
+ if (fileTypes.isNotEmpty())
+ pluginString += " mod:fileTypes \"" + fileTypes + "\" ; \n";
+ #endif
pluginString += " rdfs:range atom:Path .\n\n";
+ }
else
+ {
pluginString += " rdfs:range atom:String .\n\n";
+ }
hasHostVisibleState = true;
}