DPF

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

commit f0561d522e3bf5e561ae4cfd74957fd26475509c
parent 4ecfc82f6b42025e401fb529146d920c006c1072
Author: falkTX <falktx@gmail.com>
Date:   Sun, 26 Apr 2015 21:34:51 +0200

Fix states; Fix vst build without UI

Diffstat:
Mdistrho/DistrhoPlugin.hpp | 2+-
Mdistrho/src/DistrhoPluginVST.cpp | 26++++++++++++++++----------
2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp @@ -592,7 +592,7 @@ protected: This function will be called once, shortly after the plugin is created.@n Must be implemented by your plugin class only if DISTRHO_PLUGIN_WANT_STATE is enabled. */ - virtual void initState(uint32_t index, const char* stateKey, String& defaultStateValue) = 0; + virtual void initState(uint32_t index, String& stateKey, String& defaultStateValue) = 0; #endif /* -------------------------------------------------------------------------------------------------------- diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp @@ -107,9 +107,9 @@ public: bool* parameterChecks; float* parameterValues; -#if DISTRHO_PLUGIN_WANT_STATE +# if DISTRHO_PLUGIN_WANT_STATE virtual void setStateFromUI(const char* const newKey, const char* const newValue) = 0; -#endif +# endif }; // ----------------------------------------------------------------------- @@ -160,12 +160,12 @@ public: // ------------------------------------------------------------------- // functions called from the plugin side, may block -#if DISTRHO_PLUGIN_WANT_STATE +# if DISTRHO_PLUGIN_WANT_STATE void setStateFromPlugin(const char* const key, const char* const value) { fUI.stateChanged(key, value); } -#endif +# endif // ------------------------------------------------------------------- @@ -191,25 +191,25 @@ protected: void setState(const char* const key, const char* const value) { -#if DISTRHO_PLUGIN_WANT_STATE +# if DISTRHO_PLUGIN_WANT_STATE fUiHelper->setStateFromUI(key, value); -#else +# else return; // unused (void)key; (void)value; -#endif +# endif } void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) { -#if 0 //DISTRHO_PLUGIN_WANT_MIDI_INPUT +# if 0 //DISTRHO_PLUGIN_WANT_MIDI_INPUT // TODO -#else +# else return; // unused (void)channel; (void)note; (void)velocity; -#endif +# endif } void setSize(const uint width, const uint height) @@ -537,8 +537,10 @@ public: setStateFromUI(key, value); +# if DISTRHO_PLUGIN_HAS_UI if (fVstUI != nullptr) fVstUI->setStateFromPlugin(key, value); +# endif // get next key key = value+(std::strlen(value)+1); @@ -762,7 +764,11 @@ private: // ------------------------------------------------------------------- // functions called from the UI side, may block +# if DISTRHO_PLUGIN_HAS_UI void setStateFromUI(const char* const key, const char* const newValue) override +# else + void setStateFromUI(const char* const key, const char* const newValue) +# endif { fPlugin.setState(key, newValue);