| @@ -547,7 +547,7 @@ public: | |||||
| if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, ¤tSourceID))) | if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, ¤tSourceID))) | ||||
| { | { | ||||
| HeapBlock<OSType> types; | HeapBlock<OSType> types; | ||||
| const int num = getAllDataSourcesForDevice (deviceID, types); | |||||
| auto num = getAllDataSourcesForDevice (deviceID, types); | |||||
| for (int i = 0; i < num; ++i) | for (int i = 0; i < num; ++i) | ||||
| { | { | ||||
| @@ -568,7 +568,7 @@ public: | |||||
| if (deviceID != 0) | if (deviceID != 0) | ||||
| { | { | ||||
| HeapBlock<OSType> types; | HeapBlock<OSType> types; | ||||
| const int num = getAllDataSourcesForDevice (deviceID, types); | |||||
| auto num = getAllDataSourcesForDevice (deviceID, types); | |||||
| if (isPositiveAndBelow (index, num)) | if (isPositiveAndBelow (index, num)) | ||||
| { | { | ||||
| @@ -816,8 +816,8 @@ public: | |||||
| JUCE_COREAUDIOLOG ("Device changed"); | JUCE_COREAUDIOLOG ("Device changed"); | ||||
| stopTimer(); | stopTimer(); | ||||
| const double oldSampleRate = sampleRate; | |||||
| const int oldBufferSize = bufferSize; | |||||
| auto oldSampleRate = sampleRate; | |||||
| auto oldBufferSize = bufferSize; | |||||
| if (! updateDetailsFromDevice()) | if (! updateDetailsFromDevice()) | ||||
| owner.stopInternal(); | owner.stopInternal(); | ||||
| @@ -866,15 +866,17 @@ private: | |||||
| return noErr; | return noErr; | ||||
| } | } | ||||
| static OSStatus deviceListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData) | |||||
| static OSStatus deviceListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, | |||||
| const AudioObjectPropertyAddress* pa, void* inClientData) | |||||
| { | { | ||||
| CoreAudioInternal* const intern = static_cast<CoreAudioInternal*> (inClientData); | |||||
| auto intern = static_cast<CoreAudioInternal*> (inClientData); | |||||
| switch (pa->mSelector) | switch (pa->mSelector) | ||||
| { | { | ||||
| case kAudioDeviceProcessorOverload: | case kAudioDeviceProcessorOverload: | ||||
| intern->xruns++; | intern->xruns++; | ||||
| break; | break; | ||||
| case kAudioDevicePropertyBufferSize: | case kAudioDevicePropertyBufferSize: | ||||
| case kAudioDevicePropertyBufferFrameSize: | case kAudioDevicePropertyBufferFrameSize: | ||||
| case kAudioDevicePropertyNominalSampleRate: | case kAudioDevicePropertyNominalSampleRate: | ||||
| @@ -950,8 +952,8 @@ class CoreAudioIODevice : public AudioIODevice, | |||||
| public: | public: | ||||
| CoreAudioIODevice (CoreAudioIODeviceType* dt, | CoreAudioIODevice (CoreAudioIODeviceType* dt, | ||||
| const String& deviceName, | const String& deviceName, | ||||
| AudioDeviceID inputDeviceId, const int inputIndex_, | |||||
| AudioDeviceID outputDeviceId, const int outputIndex_) | |||||
| AudioDeviceID inputDeviceId, int inputIndex_, | |||||
| AudioDeviceID outputDeviceId, int outputIndex_) | |||||
| : AudioIODevice (deviceName, "CoreAudio"), | : AudioIODevice (deviceName, "CoreAudio"), | ||||
| deviceType (dt), | deviceType (dt), | ||||
| inputIndex (inputIndex_), | inputIndex (inputIndex_), | ||||
| @@ -1027,12 +1029,13 @@ public: | |||||
| inputChannelsRequested = inputChannels; | inputChannelsRequested = inputChannels; | ||||
| outputChannelsRequested = outputChannels; | outputChannelsRequested = outputChannels; | ||||
| sampleRateRequested = sampleRate; | |||||
| bufferSizeSamplesRequested = bufferSizeSamples; | |||||
| if (bufferSizeSamples <= 0) | if (bufferSizeSamples <= 0) | ||||
| bufferSizeSamples = getDefaultBufferSize(); | bufferSizeSamples = getDefaultBufferSize(); | ||||
| if (sampleRate <= 0) | |||||
| sampleRate = internal->getNominalSampleRate(); | |||||
| lastError = internal->reopen (inputChannels, outputChannels, sampleRate, bufferSizeSamples); | lastError = internal->reopen (inputChannels, outputChannels, sampleRate, bufferSizeSamples); | ||||
| JUCE_COREAUDIOLOG ("Opened: " << getName()); | JUCE_COREAUDIOLOG ("Opened: " << getName()); | ||||
| @@ -1086,7 +1089,7 @@ public: | |||||
| if (isStarted) | if (isStarted) | ||||
| { | { | ||||
| AudioIODeviceCallback* const lastCallback = internal->callback; | |||||
| auto lastCallback = internal->callback; | |||||
| isStarted = false; | isStarted = false; | ||||
| internal->stop (true); | internal->stop (true); | ||||
| @@ -1167,8 +1170,6 @@ private: | |||||
| AudioIODeviceCallback* previousCallback = nullptr; | AudioIODeviceCallback* previousCallback = nullptr; | ||||
| std::function<void()> deviceWrapperRestartCallback = nullptr; | std::function<void()> deviceWrapperRestartCallback = nullptr; | ||||
| BigInteger inputChannelsRequested, outputChannelsRequested; | BigInteger inputChannelsRequested, outputChannelsRequested; | ||||
| double sampleRateRequested; | |||||
| int bufferSizeSamplesRequested; | |||||
| CriticalSection closeLock; | CriticalSection closeLock; | ||||
| void timerCallback() override | void timerCallback() override | ||||