| @@ -334,7 +334,6 @@ public: | |||||
| deviceIsOpen (false), | deviceIsOpen (false), | ||||
| isStarted (false), | isStarted (false), | ||||
| buffersCreated (false), | buffersCreated (false), | ||||
| isASIOOpen (false), | |||||
| calledback (false), | calledback (false), | ||||
| littleEndian (false), | littleEndian (false), | ||||
| postOutput (true), | postOutput (true), | ||||
| @@ -348,6 +347,8 @@ public: | |||||
| jassert (currentASIODev [slotNumber] == nullptr); | jassert (currentASIODev [slotNumber] == nullptr); | ||||
| currentASIODev [slotNumber] = this; | currentASIODev [slotNumber] = this; | ||||
| openDevice(); | |||||
| } | } | ||||
| ~ASIOAudioIODevice() | ~ASIOAudioIODevice() | ||||
| @@ -413,16 +414,19 @@ public: | |||||
| const BigInteger& outputChannels, | const BigInteger& outputChannels, | ||||
| double sr, int bufferSizeSamples) | double sr, int bufferSizeSamples) | ||||
| { | { | ||||
| close(); | |||||
| if (isOpen()) | |||||
| close(); | |||||
| jassert (currentCallback == nullptr); | jassert (currentCallback == nullptr); | ||||
| if (bufferSizeSamples < 8 || bufferSizeSamples > 16384) | if (bufferSizeSamples < 8 || bufferSizeSamples > 16384) | ||||
| shouldUsePreferredSize = true; | shouldUsePreferredSize = true; | ||||
| if (asioObject == nullptr) | |||||
| { | { | ||||
| const String openingError (openDevice()); | const String openingError (openDevice()); | ||||
| if (asioObject == nullptr || ! isASIOOpen) | |||||
| if (asioObject == nullptr) | |||||
| return openingError; | return openingError; | ||||
| } | } | ||||
| @@ -716,7 +720,7 @@ public: | |||||
| stopTimer(); | stopTimer(); | ||||
| stop(); | stop(); | ||||
| if (isASIOOpen && deviceIsOpen) | |||||
| if (asioObject != nullptr && deviceIsOpen) | |||||
| { | { | ||||
| const ScopedLock sl (callbackLock); | const ScopedLock sl (callbackLock); | ||||
| @@ -739,7 +743,7 @@ public: | |||||
| } | } | ||||
| bool isOpen() { return deviceIsOpen || insideControlPanelModalLoop; } | bool isOpen() { return deviceIsOpen || insideControlPanelModalLoop; } | ||||
| bool isPlaying() { return isASIOOpen && (currentCallback != nullptr); } | |||||
| bool isPlaying() { return asioObject != nullptr && currentCallback != nullptr; } | |||||
| int getCurrentBufferSizeSamples() { return currentBlockSizeSamples; } | int getCurrentBufferSizeSamples() { return currentBlockSizeSamples; } | ||||
| double getCurrentSampleRate() { return currentSampleRate; } | double getCurrentSampleRate() { return currentSampleRate; } | ||||
| @@ -879,7 +883,6 @@ private: | |||||
| int volatile bufferIndex, numActiveInputChans, numActiveOutputChans; | int volatile bufferIndex, numActiveInputChans, numActiveOutputChans; | ||||
| bool deviceIsOpen, isStarted, buffersCreated; | bool deviceIsOpen, isStarted, buffersCreated; | ||||
| bool volatile isASIOOpen; | |||||
| bool volatile calledback; | bool volatile calledback; | ||||
| bool volatile littleEndian, postOutput, needToReset; | bool volatile littleEndian, postOutput, needToReset; | ||||
| bool volatile insideControlPanelModalLoop; | bool volatile insideControlPanelModalLoop; | ||||
| @@ -1073,7 +1076,6 @@ private: | |||||
| inputChannelNames.clear(); | inputChannelNames.clear(); | ||||
| bufferSizes.clear(); | bufferSizes.clear(); | ||||
| sampleRates.clear(); | sampleRates.clear(); | ||||
| isASIOOpen = false; | |||||
| deviceIsOpen = false; | deviceIsOpen = false; | ||||
| totalNumInputChans = 0; | totalNumInputChans = 0; | ||||
| totalNumOutputChans = 0; | totalNumOutputChans = 0; | ||||
| @@ -1240,11 +1242,9 @@ private: | |||||
| JUCE_ASIO_LOG_ERROR (error, err); | JUCE_ASIO_LOG_ERROR (error, err); | ||||
| disposeBuffers(); | disposeBuffers(); | ||||
| removeCurrentDriver(); | removeCurrentDriver(); | ||||
| isASIOOpen = false; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| isASIOOpen = true; | |||||
| JUCE_ASIO_LOG ("device open"); | JUCE_ASIO_LOG ("device open"); | ||||
| } | } | ||||