diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp index 0e8df089..1ad0b16a 100644 --- a/distrho/src/DistrhoPluginLV2.cpp +++ b/distrho/src/DistrhoPluginLV2.cpp @@ -570,7 +570,11 @@ public: if (std::strcmp((const char*)data, "__dpf_ui_data__") == 0) { for (uint32_t i=0, count=fPlugin.getStateCount(); i < count; ++i) + { + if (fPlugin.getStateHints(i) & kStateIsOnlyForDSP) + continue; fNeededUiSends[i] = true; + } } // no, send to DSP as usual else if (fWorker != nullptr) @@ -930,10 +934,14 @@ public: if (curKey != key) continue; - const String& value(cit->second); - const uint32_t hints = fPlugin.getStateHints(i); + #if ! DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_WANT_DIRECT_ACCESS + // do not save UI-only messages if there is no UI available + if ((hints & kStateIsOnlyForUI) == 0x0) + continue; + #endif + if (hints & kStateIsHostReadable) { lv2key = DISTRHO_PLUGIN_URI "#"; @@ -949,6 +957,8 @@ public: lv2key += key; + const String& value(cit->second); + // some hosts need +1 for the null terminator, even though the type is string store(handle, fUridMap->map(fUridMap->handle, lv2key.buffer()), @@ -1011,7 +1021,8 @@ public: #if DISTRHO_PLUGIN_WANT_STATE // signal msg needed for UI - fNeededUiSends[i] = true; + if ((hints & kStateIsOnlyForDSP) == 0x0) + fNeededUiSends[i] = true; #endif } @@ -1061,7 +1072,8 @@ public: { if (fPlugin.getStateKey(i) == key) { - fNeededUiSends[i] = true; + if ((fPlugin.getStateHints(i) & kStateIsOnlyForDSP) == 0x0) + fNeededUiSends[i] = true; break; } } @@ -1293,7 +1305,8 @@ private: { if (fPlugin.getStateKey(i) == key) { - fNeededUiSends[i] = true; + if ((fPlugin.getStateHints(i) & kStateIsOnlyForDSP) == 0x0) + fNeededUiSends[i] = true; break; } } diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp index 19df7a1b..0bb2158f 100644 --- a/distrho/src/DistrhoUILV2.cpp +++ b/distrho/src/DistrhoUILV2.cpp @@ -181,6 +181,33 @@ public: fUI.stateChanged(key, value); } + else if (atom->type == fURIDs.atomObject) + { + /* TODO + const LV2_Atom_Object* const obj = (const LV2_Atom_Object*)LV2_ATOM_BODY_CONST(atom); + + const LV2_Atom* property = nullptr; + const LV2_Atom* avalue = nullptr; + lv2_atom_object_get(obj, fURIDs.patchProperty, &property, fURIDs.patchValue, &avalue, 0); + + DISTRHO_SAFE_ASSERT_RETURN(property != nullptr,); + DISTRHO_SAFE_ASSERT_RETURN(avalue != nullptr,); + + DISTRHO_SAFE_ASSERT_RETURN(property->type == fURIDs.atomURID,); + DISTRHO_SAFE_ASSERT_RETURN(avalue->type == fURIDs.atomPath || avalue->type == fURIDs.atomString,); + + if (property != nullptr && property->type == fURIDs.atomURID && + avalue != nullptr && (avalue->type == fURIDs.atomPath || avalue->type == fURIDs.atomString)) + { + const char* const key = (const char*)LV2_ATOM_BODY_CONST(property); + const char* const value = (const char*)LV2_ATOM_BODY_CONST(avalue); + + d_stdout("received atom object '%s' '%s'", key, value); + + fUI.stateChanged(key, value); + } + */ + } else { d_stdout("received atom not dpfKeyValue"); @@ -368,15 +395,19 @@ private: // LV2 URIDs const struct URIDs { const LV2_URID_Map* _uridMap; - LV2_URID dpfKeyValue; - LV2_URID atomEventTransfer; - LV2_URID atomFloat; - LV2_URID atomLong; - LV2_URID atomPath; - LV2_URID atomString; - LV2_URID midiEvent; - LV2_URID paramSampleRate; - LV2_URID patchSet; + const LV2_URID dpfKeyValue; + const LV2_URID atomEventTransfer; + const LV2_URID atomFloat; + const LV2_URID atomLong; + const LV2_URID atomObject; + const LV2_URID atomPath; + const LV2_URID atomString; + const LV2_URID atomURID; + const LV2_URID midiEvent; + const LV2_URID paramSampleRate; + const LV2_URID patchProperty; + const LV2_URID patchSet; + const LV2_URID patchValue; URIDs(const LV2_URID_Map* const uridMap) : _uridMap(uridMap), @@ -384,11 +415,15 @@ private: atomEventTransfer(map(LV2_ATOM__eventTransfer)), atomFloat(map(LV2_ATOM__Float)), atomLong(map(LV2_ATOM__Long)), + atomObject(map(LV2_ATOM__Object)), atomPath(map(LV2_ATOM__Path)), atomString(map(LV2_ATOM__String)), + atomURID(map(LV2_ATOM__URID)), midiEvent(map(LV2_MIDI__MidiEvent)), paramSampleRate(map(LV2_PARAMETERS__sampleRate)), - patchSet(map(LV2_PATCH__Set)) {} + patchProperty(map(LV2_PATCH__property)), + patchSet(map(LV2_PATCH__Set)), + patchValue(map(LV2_PATCH__value)) {} inline LV2_URID map(const char* const uri) const {