Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions modules/juce_audio_devices/native/juce_ALSA_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ class ALSAThread final : public Thread
sampleRate = newSampleRate;
bufferSize = newBufferSize;

// Widened before the loop below fills currentInputChans and
// inputChannelDataForCallback, which have to agree: getActiveInputChannels()
// must not report more channels than the callback is given pointers for.
// A request for no inputs at all stays empty rather than being widened.
if (inputChannels.getHighestBit() >= 0)
ensureMinimumNumBitsSet (inputChannels, (int) minChansIn);

int maxInputsRequested = inputChannels.getHighestBit() + 1;
maxInputsRequested = jmax ((int) minChansIn, jmin ((int) maxChansIn, maxInputsRequested));

Expand Down Expand Up @@ -565,8 +572,6 @@ class ALSAThread final : public Thread
return;
}

ensureMinimumNumBitsSet (currentInputChans, (int) minChansIn);

if (! inputDevice->setParameters ((unsigned int) sampleRate,
jlimit ((int) minChansIn, (int) maxChansIn, currentInputChans.getHighestBit() + 1),
bufferSize))
Expand Down