Skip to content

Commit

Permalink
Fix Issue 887 with AU having same pointer for I and O
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Piolat committed Dec 14, 2024
1 parent 15b6faa commit 1627187
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions au/dplug/au/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,25 @@ private:
if (_client.sendsMIDI)
_client.clearAccumulatedOutputMidiMessages();

// Welcome to Issue #887 workaround.
// Here is our last chance to avoid have same pointer for input and output (Studio One 7).
// If we detect the same buffer here, copy to scratch input buffer and point there.
{
int minIO = newUsedInputs;
if (minIO > newUsedOutputs) minIO = newUsedOutputs;
for (int b = 0; b < minIO; ++b)
{
if (_inputPointersNoGap[b] == _outputPointersNoGap[b])
{
// Assuming here that the scratch buffer couldn't be in input AND output, though
// I'm not 100% certain to be fair.
float* buffer = _inputScratchBuffer[b].ptr;
buffer[0..nFrames] = _inputPointersNoGap[b][0..nFrames]; // copy
_inputPointersNoGap[b] = buffer;
}
}
}

_client.processAudioFromHost(_inputPointersNoGap[0..newUsedInputs],
_outputPointersNoGap[0..newUsedOutputs],
nFrames,
Expand Down

1 comment on commit 1627187

@p0nce
Copy link
Collaborator

@p0nce p0nce commented on 1627187 Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue 890 not 887

Please sign in to comment.