mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CoreAudioIODevice: Fix stale channel information after device information change
Until this commit CoreAudioIODevice could report inconsistent information in its getActiveOutputChannels() and getOutputChannelNames() functions, and for inputs as well. The reason for this was that a sudden configuration change would immediately be reflected by the CoreAudioInternal::Stream::chanNames member because those are read in the Stream's constructor. The activeChan member would however just store stale values, until the Stream was recreated later during device reopen. This issue could lead to the AudioPluginHost crashing when opening a Bluetooth headset.
This commit is contained in:
parent
8d4f176b30
commit
9f99f02eb2
1 changed files with 7 additions and 10 deletions
|
|
@ -622,12 +622,9 @@ public:
|
|||
|
||||
stop (false);
|
||||
|
||||
const auto activeIns = BigInteger().setRange (0, jmin (ins .getHighestBit() + 1, getNumChannelNames (inStream)), true);
|
||||
const auto activeOuts = BigInteger().setRange (0, jmin (outs.getHighestBit() + 1, getNumChannelNames (outStream)), true);
|
||||
|
||||
if (! setNominalSampleRate (newSampleRate))
|
||||
{
|
||||
updateDetailsFromDevice (activeIns, activeOuts);
|
||||
updateDetailsFromDevice (ins, outs);
|
||||
error = "Couldn't change sample rate";
|
||||
}
|
||||
else
|
||||
|
|
@ -637,7 +634,7 @@ public:
|
|||
juceAudioObjectPropertyElementMain },
|
||||
static_cast<UInt32> (bufferSizeSamples), err2log()))
|
||||
{
|
||||
updateDetailsFromDevice (activeIns, activeOuts);
|
||||
updateDetailsFromDevice (ins, outs);
|
||||
error = "Couldn't change buffer size";
|
||||
}
|
||||
else
|
||||
|
|
@ -646,7 +643,7 @@ public:
|
|||
// correctly report their new settings until some random time in the future, so
|
||||
// after calling updateDetailsFromDevice, we need to manually bodge these values
|
||||
// to make sure we're using the correct numbers..
|
||||
updateDetailsFromDevice (activeIns, activeOuts);
|
||||
updateDetailsFromDevice (ins, outs);
|
||||
sampleRate = newSampleRate;
|
||||
bufferSize = bufferSizeSamples;
|
||||
|
||||
|
|
@ -837,13 +834,13 @@ public:
|
|||
//==============================================================================
|
||||
struct Stream
|
||||
{
|
||||
Stream (bool isInput, CoreAudioInternal& parent, const BigInteger& active)
|
||||
Stream (bool isInput, CoreAudioInternal& parent, const BigInteger& activeRequested)
|
||||
: input (isInput),
|
||||
latency (getLatencyFromDevice (isInput, parent)),
|
||||
bitDepth (getBitDepthFromDevice (isInput, parent)),
|
||||
activeChans (active),
|
||||
chanNames (getChannelNames (isInput, parent)),
|
||||
channelInfo (getChannelInfos (isInput, parent, active)),
|
||||
activeChans (BigInteger().setRange (0, jmin (activeRequested.getHighestBit() + 1, chanNames.size()), true)),
|
||||
channelInfo (getChannelInfos (isInput, parent, activeChans)),
|
||||
channels (static_cast<int> (channelInfo.size()))
|
||||
{}
|
||||
|
||||
|
|
@ -984,8 +981,8 @@ public:
|
|||
const bool input;
|
||||
const int latency;
|
||||
const int bitDepth;
|
||||
const BigInteger activeChans;
|
||||
const StringArray chanNames;
|
||||
const BigInteger activeChans;
|
||||
const Array<CallbackDetailsForChannel> channelInfo;
|
||||
const int channels = 0;
|
||||
Float64 previousSampleTime;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue