Skip to content

Commit

Permalink
Attempting audio ports fix for in_place_pair (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 authored Jun 28, 2022
1 parent ff12b48 commit 87cc6e4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/wrapper/clap-juce-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,11 @@ class ClapJuceWrapper : public clap::helpers::Plugin<
jassert(busDefaultLayout == juce::AudioChannelSet::mono() ||
busDefaultLayout == juce::AudioChannelSet::stereo());

info->id = (isInput ? 1 << 15 : 1) + index;
auto getPortID = [](bool isPortInput, uint32_t portIndex) {
return (isPortInput ? 1 << 15 : 1) + portIndex;
};

info->id = getPortID(isInput, index);
strncpy(info->name, bus->getName().toRawUTF8(), sizeof(info->name));

bool couldBeMain = true;
Expand All @@ -544,7 +548,17 @@ class ClapJuceWrapper : public clap::helpers::Plugin<
info->flags = 0;
}

info->in_place_pair = info->id;
if (processor->getBus(!isInput, (int)index) != nullptr)
{
// this bus has a corresponding bus on the other side, so it can do in-place processing
info->in_place_pair = getPortID(!isInput, index);
}
else
{
// this bus has no corresponding bus, so it can't do in-place processing
info->in_place_pair = CLAP_INVALID_ID;
}

info->channel_count = (uint32_t)busDefaultLayout.size();

if (busDefaultLayout == juce::AudioChannelSet::mono())
Expand Down

0 comments on commit 87cc6e4

Please sign in to comment.