Browse Source

Fix states; Fix vst build without UI

pull/6/head
falkTX 10 years ago
parent
commit
f0561d522e
2 changed files with 17 additions and 11 deletions
  1. +1
    -1
      distrho/DistrhoPlugin.hpp
  2. +16
    -10
      distrho/src/DistrhoPluginVST.cpp

+ 1
- 1
distrho/DistrhoPlugin.hpp View File

@@ -592,7 +592,7 @@ protected:
This function will be called once, shortly after the plugin is created.@n 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. 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 #endif


/* -------------------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------------------


+ 16
- 10
distrho/src/DistrhoPluginVST.cpp View File

@@ -107,9 +107,9 @@ public:
bool* parameterChecks; bool* parameterChecks;
float* parameterValues; float* parameterValues;


#if DISTRHO_PLUGIN_WANT_STATE
# if DISTRHO_PLUGIN_WANT_STATE
virtual void setStateFromUI(const char* const newKey, const char* const newValue) = 0; 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 // 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) void setStateFromPlugin(const char* const key, const char* const value)
{ {
fUI.stateChanged(key, value); fUI.stateChanged(key, value);
} }
#endif
# endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------


@@ -191,25 +191,25 @@ protected:


void setState(const char* const key, const char* const value) void setState(const char* const key, const char* const value)
{ {
#if DISTRHO_PLUGIN_WANT_STATE
# if DISTRHO_PLUGIN_WANT_STATE
fUiHelper->setStateFromUI(key, value); fUiHelper->setStateFromUI(key, value);
#else
# else
return; // unused return; // unused
(void)key; (void)key;
(void)value; (void)value;
#endif
# endif
} }


void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) 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 // TODO
#else
# else
return; // unused return; // unused
(void)channel; (void)channel;
(void)note; (void)note;
(void)velocity; (void)velocity;
#endif
# endif
} }


void setSize(const uint width, const uint height) void setSize(const uint width, const uint height)
@@ -537,8 +537,10 @@ public:


setStateFromUI(key, value); setStateFromUI(key, value);


# if DISTRHO_PLUGIN_HAS_UI
if (fVstUI != nullptr) if (fVstUI != nullptr)
fVstUI->setStateFromPlugin(key, value); fVstUI->setStateFromPlugin(key, value);
# endif


// get next key // get next key
key = value+(std::strlen(value)+1); key = value+(std::strlen(value)+1);
@@ -762,7 +764,11 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// functions called from the UI side, may block // functions called from the UI side, may block


# if DISTRHO_PLUGIN_HAS_UI
void setStateFromUI(const char* const key, const char* const newValue) override 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); fPlugin.setState(key, newValue);




Loading…
Cancel
Save