Browse Source

Fix CLAP MIDI output

Signed-off-by: falkTX <falktx@falktx.com>
pull/1689/head
falkTX 2 years ago
parent
commit
f86efd5096
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      source/backend/plugin/CarlaPluginCLAP.cpp

+ 14
- 4
source/backend/plugin/CarlaPluginCLAP.cpp View File

@@ -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<const clap_input_events_t*>(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<const clap_output_events_t*>(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);


Loading…
Cancel
Save