diff --git a/source/backend/plugin/CarlaPluginCLAP.cpp b/source/backend/plugin/CarlaPluginCLAP.cpp index 3cb85dbce..458aca051 100644 --- a/source/backend/plugin/CarlaPluginCLAP.cpp +++ b/source/backend/plugin/CarlaPluginCLAP.cpp @@ -392,7 +392,7 @@ struct carla_clap_input_events : clap_input_events_t, CarlaPluginClapEventData { delete[] events; delete[] updatedParams; - if (paramCount != 0) + if (portCount != 0 || paramCount != 0) { static_assert(kPluginMaxMidiEvents > MAX_MIDI_NOTE, "Enough space for input events"); @@ -413,6 +413,11 @@ struct carla_clap_input_events : clap_input_events_t, CarlaPluginClapEventData { CarlaPluginClapEventData::createNew(portCount); } + const clap_input_events_t* cast() const noexcept + { + return static_cast(this); + } + // called just before plugin processing void handleScheduledParameterUpdates() { @@ -519,7 +524,7 @@ struct carla_clap_output_events : clap_output_events_t, CarlaPluginClapEventData numEventsUsed = 0; delete[] events; - if (paramCount != 0) + if (portCount != 0 || paramCount != 0) { numEventsAllocated = paramCount + kPluginMaxMidiEvents * std::max(1u, portCount); events = new Event[numEventsAllocated]; @@ -536,6 +541,11 @@ struct carla_clap_output_events : clap_output_events_t, CarlaPluginClapEventData CarlaPluginClapEventData::createNew(portCount); } + const clap_output_events_t* cast() const noexcept + { + return static_cast(this); + } + bool tryPush(const clap_event_header_t* const event) { if (numEventsUsed == numEventsAllocated) @@ -2098,8 +2108,8 @@ public: fOutputAudioBuffers.cast(), // audio_outputs fInputAudioBuffers.count, // audio_inputs_count fOutputAudioBuffers.count, // audio_outputs_count - &fInputEvents, // in_events - &fOutputEvents // out_events + fInputEvents.cast(), + fOutputEvents.cast() }; fPlugin->process(fPlugin, &process);