Browse Source

Fixed IO channels when selecting <<none>> as OS X audio device

tags/2021-05-28
tpoole 8 years ago
parent
commit
21aad5e20c
1 changed files with 21 additions and 27 deletions
  1. +21
    -27
      modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp

+ 21
- 27
modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp View File

@@ -163,20 +163,11 @@ class CoreAudioIODevice;
class CoreAudioInternal : private Timer class CoreAudioInternal : private Timer
{ {
public: public:
CoreAudioInternal (CoreAudioIODevice& d, AudioDeviceID id)
CoreAudioInternal (CoreAudioIODevice& d, AudioDeviceID id, bool input, bool output)
: owner (d), : owner (d),
inputLatency (0),
outputLatency (0),
bitDepth (32),
callback (nullptr),
audioProcID (0),
deviceID (id), deviceID (id),
started (false),
sampleRate (0),
bufferSize (512),
numInputChans (0),
numOutputChans (0),
callbacksAllowed (true)
isInputDevice (input),
isOutputDevice (output)
{ {
jassert (deviceID != 0); jassert (deviceID != 0);
@@ -443,11 +434,11 @@ public:
const int newOutputLatency = getLatencyFromDevice (kAudioDevicePropertyScopeOutput); const int newOutputLatency = getLatencyFromDevice (kAudioDevicePropertyScopeOutput);
Array<CallbackDetailsForChannel> newInChans, newOutChans; Array<CallbackDetailsForChannel> newInChans, newOutChans;
StringArray newInNames (getChannelInfo (true, newInChans));
StringArray newOutNames (getChannelInfo (false, newOutChans));
auto newInNames = isInputDevice ? getChannelInfo (true, newInChans) : StringArray();
auto newOutNames = isOutputDevice ? getChannelInfo (false, newOutChans) : StringArray();
const int newBitDepth = jmax (getBitDepthFromDevice (kAudioDevicePropertyScopeInput),
getBitDepthFromDevice (kAudioDevicePropertyScopeOutput));
const int newBitDepth = jmax (getBitDepthFromDevice (kAudioDevicePropertyScopeInput),
getBitDepthFromDevice (kAudioDevicePropertyScopeOutput));
{ {
const ScopedLock sl (callbackLock); const ScopedLock sl (callbackLock);
@@ -805,24 +796,27 @@ public:
//============================================================================== //==============================================================================
CoreAudioIODevice& owner; CoreAudioIODevice& owner;
int inputLatency, outputLatency;
int bitDepth;
int inputLatency = 0;
int outputLatency = 0;
int bitDepth = 32;
BigInteger activeInputChans, activeOutputChans; BigInteger activeInputChans, activeOutputChans;
StringArray inChanNames, outChanNames; StringArray inChanNames, outChanNames;
Array<double> sampleRates; Array<double> sampleRates;
Array<int> bufferSizes; Array<int> bufferSizes;
AudioIODeviceCallback* callback;
AudioDeviceIOProcID audioProcID;
AudioIODeviceCallback* callback = nullptr;
AudioDeviceIOProcID audioProcID = 0;
private: private:
CriticalSection callbackLock; CriticalSection callbackLock;
AudioDeviceID deviceID; AudioDeviceID deviceID;
bool started;
double sampleRate;
int bufferSize;
bool started = false;
double sampleRate = 0;
int bufferSize = 512;
HeapBlock<float> audioBuffer; HeapBlock<float> audioBuffer;
int numInputChans, numOutputChans;
bool callbacksAllowed;
int numInputChans = 0;
int numOutputChans = 0;
bool callbacksAllowed = true;
const bool isInputDevice, isOutputDevice;
Array<CallbackDetailsForChannel> inputChannelInfo, outputChannelInfo; Array<CallbackDetailsForChannel> inputChannelInfo, outputChannelInfo;
HeapBlock<float*> tempInputBuffers, tempOutputBuffers; HeapBlock<float*> tempInputBuffers, tempOutputBuffers;
@@ -931,11 +925,11 @@ public:
if (outputDeviceId == 0 || outputDeviceId == inputDeviceId) if (outputDeviceId == 0 || outputDeviceId == inputDeviceId)
{ {
jassert (inputDeviceId != 0); jassert (inputDeviceId != 0);
device = new CoreAudioInternal (*this, inputDeviceId);
device = new CoreAudioInternal (*this, inputDeviceId, true, outputDeviceId != 0);
} }
else else
{ {
device = new CoreAudioInternal (*this, outputDeviceId);
device = new CoreAudioInternal (*this, outputDeviceId, false, true);
} }
internal = device; internal = device;


Loading…
Cancel
Save