DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 53148852c03fc5a0a914cefda6f3850bd9aebdd0
parent 22413340a6d8ef2ffbf38ce841fb44c448a1a84a
Author: falkTX <falktx@falktx.com>
Date:   Sun, 20 Nov 2022 16:47:10 +0000

Implement custom State::fileTypes for MOD

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/DistrhoPlugin.hpp | 21+++++++++++++++++++++
Mdistrho/src/DistrhoPluginInternal.hpp | 9+++++++++
Mdistrho/src/DistrhoPluginLV2export.cpp | 9+++++++++
3 files changed, 39 insertions(+), 0 deletions(-)

diff --git 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 @@ -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 @@ -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; }