| @@ -636,7 +636,7 @@ struct MidiEvent { | |||
| If size > kDataSize, dataExt is used (otherwise null). | |||
| When dataExt is used, the event holder is responsible for | |||
| keeping the pointer valid during the entirity of the run function. | |||
| keeping the pointer valid during the entirety of the run function. | |||
| */ | |||
| uint8_t data[kDataSize]; | |||
| const uint8_t* dataExt; | |||
| @@ -2022,7 +2022,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_float(attrlist, "value", sampleRate); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -2039,7 +2038,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_float(attrlist, "value", value); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -2056,7 +2054,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_string(attrlist, "value", ScopedUTF16String(value)); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -2071,7 +2068,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_int(attrlist, "__dpf_msg_target__", 2); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| #endif | |||
| @@ -2745,8 +2741,6 @@ struct dpf_edit_controller : v3_edit_controller_cpp { | |||
| static V3_API double get_parameter_normalised(void* self, v3_param_id index) | |||
| { | |||
| // NOTE very noisy, called many times | |||
| // d_stdout("dpf_edit_controller::get_parameter_normalised => %p %u", self, index); | |||
| dpf_edit_controller* const controller = *(dpf_edit_controller**)self; | |||
| DISTRHO_SAFE_ASSERT_RETURN(controller != nullptr, 0.0); | |||
| @@ -2758,7 +2752,6 @@ struct dpf_edit_controller : v3_edit_controller_cpp { | |||
| static V3_API v3_result set_parameter_normalised(void* self, v3_param_id index, double normalised) | |||
| { | |||
| d_stdout("dpf_edit_controller::set_parameter_normalised => %p %u %f", self, index, normalised); | |||
| dpf_edit_controller* const controller = *(dpf_edit_controller**)self; | |||
| DISTRHO_SAFE_ASSERT_RETURN(controller != nullptr, V3_NOT_INITIALIZED); | |||
| @@ -2813,8 +2806,8 @@ struct dpf_edit_controller : v3_edit_controller_cpp { | |||
| } | |||
| v3_plugin_view** const view = dpf_plugin_view_create(host, | |||
| vst3->getInstancePointer(), | |||
| vst3->getSampleRate()); | |||
| vst3->getInstancePointer(), | |||
| vst3->getSampleRate()); | |||
| DISTRHO_SAFE_ASSERT_RETURN(view != nullptr, nullptr); | |||
| v3_connection_point** uiconn = nullptr; | |||
| @@ -91,7 +91,7 @@ public: | |||
| g_nextScaleFactor = 0.0; | |||
| g_nextBundlePath = nullptr; | |||
| #else | |||
| // Leave context called in the PluginWindow constructor, see DistrhoUIPrivateData.hpp | |||
| // enter context called in the PluginWindow constructor, see DistrhoUIPrivateData.hpp | |||
| uiData->window->leaveContext(); | |||
| #endif | |||
| UI::PrivateData::s_nextPrivateData = nullptr; | |||
| @@ -99,8 +99,6 @@ public: | |||
| DISTRHO_SAFE_ASSERT_RETURN(uiPtr != nullptr,); | |||
| ui = uiPtr; | |||
| uiData->initializing = false; | |||
| #if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
| // unused | |||
| (void)bundlePath; | |||
| @@ -285,7 +285,6 @@ struct UI::PrivateData { | |||
| void* dspPtr; | |||
| // UI | |||
| bool initializing; | |||
| uint bgColor; | |||
| uint fgColor; | |||
| double scaleFactor; | |||
| @@ -309,7 +308,6 @@ struct UI::PrivateData { | |||
| sampleRate(0), | |||
| parameterOffset(0), | |||
| dspPtr(nullptr), | |||
| initializing(true), | |||
| bgColor(0), | |||
| fgColor(0xffffffff), | |||
| scaleFactor(1.0), | |||
| @@ -360,40 +358,30 @@ struct UI::PrivateData { | |||
| void editParamCallback(const uint32_t rindex, const bool started) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(!initializing,); | |||
| if (editParamCallbackFunc != nullptr) | |||
| editParamCallbackFunc(callbacksPtr, rindex, started); | |||
| } | |||
| void setParamCallback(const uint32_t rindex, const float value) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(!initializing,); | |||
| if (setParamCallbackFunc != nullptr) | |||
| setParamCallbackFunc(callbacksPtr, rindex, value); | |||
| } | |||
| void setStateCallback(const char* const key, const char* const value) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(!initializing,); | |||
| if (setStateCallbackFunc != nullptr) | |||
| setStateCallbackFunc(callbacksPtr, key, value); | |||
| } | |||
| void sendNoteCallback(const uint8_t channel, const uint8_t note, const uint8_t velocity) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(!initializing,); | |||
| if (sendNoteCallbackFunc != nullptr) | |||
| sendNoteCallbackFunc(callbacksPtr, channel, note, velocity); | |||
| } | |||
| void setSizeCallback(const uint width, const uint height) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(!initializing,); | |||
| if (setSizeCallbackFunc != nullptr) | |||
| setSizeCallbackFunc(callbacksPtr, width, height); | |||
| } | |||
| @@ -97,11 +97,19 @@ class UIVst3 | |||
| public: | |||
| UIVst3(v3_plugin_view** const view, | |||
| v3_host_application** const host, | |||
| v3_connection_point** const connection, | |||
| v3_plugin_frame** const frame, | |||
| const intptr_t winId, | |||
| const float scaleFactor, | |||
| const double sampleRate, | |||
| void* const instancePointer) | |||
| : fUI(this, winId, sampleRate, | |||
| : fView(view), | |||
| fHostContext(host), | |||
| fConnection(connection), | |||
| fFrame(frame), | |||
| fReadyForPluginData(false), | |||
| fScaleFactor(scaleFactor), | |||
| fUI(this, winId, sampleRate, | |||
| editParameterCallback, | |||
| setParameterCallback, | |||
| setStateCallback, | |||
| @@ -110,13 +118,7 @@ public: | |||
| nullptr, // TODO file request | |||
| nullptr, // bundlePath | |||
| instancePointer, | |||
| scaleFactor), | |||
| fView(view), | |||
| fHostContext(host), | |||
| fConnection(nullptr), | |||
| fFrame(nullptr), | |||
| fReadyForPluginData(false), | |||
| fScaleFactor(scaleFactor) | |||
| scaleFactor) | |||
| { | |||
| #if defined(DISTRHO_OS_MAC) || defined(DISTRHO_OS_WINDOWS) | |||
| fUI.addIdleCallbackForVST3(this, DPF_VST3_TIMER_INTERVAL); | |||
| @@ -132,6 +134,12 @@ public: | |||
| disconnect(); | |||
| } | |||
| void reconnectIfNeeded() | |||
| { | |||
| if (fConnection != nullptr) | |||
| connect(fConnection); | |||
| } | |||
| // ---------------------------------------------------------------------------------------------------------------- | |||
| // v3_plugin_view interface calls | |||
| @@ -218,7 +226,6 @@ public: | |||
| v3_cpp_obj(attrlist)->set_int(attrlist, "__dpf_msg_target__", 1); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -238,7 +245,6 @@ public: | |||
| v3_cpp_obj(attrlist)->set_int(attrlist, "__dpf_msg_target__", 1); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| fConnection = nullptr; | |||
| @@ -382,9 +388,6 @@ public: | |||
| // ---------------------------------------------------------------------------------------------------------------- | |||
| private: | |||
| // Plugin UI | |||
| UIExporter fUI; | |||
| // VST3 stuff | |||
| v3_plugin_view** const fView; | |||
| v3_host_application** const fHostContext; | |||
| @@ -395,6 +398,9 @@ private: | |||
| bool fReadyForPluginData; | |||
| float fScaleFactor; | |||
| // Plugin UI (after VST3 stuff so the UI can call into us during its constructor) | |||
| UIExporter fUI; | |||
| // ---------------------------------------------------------------------------------------------------------------- | |||
| // helper functions called during message passing | |||
| @@ -426,7 +432,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_int(attrlist, "__dpf_msg_target__", 1); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -448,7 +453,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_int(attrlist, "started", started ? 1 : 0); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -472,7 +476,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_float(attrlist, "value", realValue); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -525,7 +528,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_binary(attrlist, "data", midiData, sizeof(midiData)); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -551,7 +553,6 @@ private: | |||
| v3_cpp_obj(attrlist)->set_string(attrlist, "value", ScopedUTF16String(value)); | |||
| v3_cpp_obj(fConnection)->notify(fConnection, message); | |||
| v3_cpp_obj_unref(attrlist); | |||
| v3_cpp_obj_unref(message); | |||
| } | |||
| @@ -982,16 +983,14 @@ struct dpf_plugin_view : v3_plugin_view_cpp { | |||
| const float scaleFactor = view->scale != nullptr ? view->scale->scaleFactor : 0.0f; | |||
| view->uivst3 = new UIVst3((v3_plugin_view**)self, | |||
| view->host, | |||
| view->connection != nullptr ? view->connection->other : nullptr, | |||
| view->frame, | |||
| (uintptr_t)parent, | |||
| scaleFactor, | |||
| view->sampleRate, | |||
| view->instancePointer); | |||
| if (dpf_ui_connection_point* const point = view->connection) | |||
| if (point->other != nullptr) | |||
| view->uivst3->connect(point->other); | |||
| view->uivst3->setFrame(view->frame); | |||
| view->uivst3->reconnectIfNeeded(); | |||
| #ifdef DPF_VST3_USING_HOST_RUN_LOOP | |||
| // register a timer host run loop stuff | |||
| @@ -39,3 +39,10 @@ | |||
| fun:XInitThreads | |||
| ... | |||
| } | |||
| { | |||
| ignore XrmGetStringDatabase | |||
| Memcheck:Leak | |||
| ... | |||
| fun:XrmGetStringDatabase | |||
| ... | |||
| } | |||