From df4e055d02b7b8bc624ac7fbb220b34196362c36 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 27 Jan 2015 10:32:34 +0000 Subject: [PATCH] Tweaked ASIO device creation sequence to try to avoid breaking some flaky drivers. --- modules/juce_audio_devices/juce_audio_devices.cpp | 2 +- modules/juce_audio_devices/native/juce_win32_ASIO.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/juce_audio_devices/juce_audio_devices.cpp b/modules/juce_audio_devices/juce_audio_devices.cpp index a9733db06c..d35e6608e0 100644 --- a/modules/juce_audio_devices/juce_audio_devices.cpp +++ b/modules/juce_audio_devices/juce_audio_devices.cpp @@ -72,7 +72,7 @@ This means that anyone who wants to use JUCE's ASIO abilities will have to: 1) Agree to Steinberg's licensing terms and download the ASIO SDK - (see www.steinberg.net/Steinberg/Developers.asp). + (see http://www.steinberg.net/en/company/developers.html). 2) Enable this code with a global definition #define JUCE_ASIO 1. diff --git a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp index 870fcd116e..99e3cfbde5 100644 --- a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp +++ b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp @@ -438,8 +438,6 @@ public: currentBlockSizeSamples = bufferSizeSamples; currentChansOut.clear(); currentChansIn.clear(); - inBuffers.clear (totalNumInputChans + 1); - outBuffers.clear (totalNumOutputChans + 1); updateSampleRates(); @@ -458,6 +456,13 @@ public: setSampleRate (sampleRate); + // (need to get this again in case a sample rate change affected the channel count) + err = asioObject->getChannels (&totalNumInputChans, &totalNumOutputChans); + jassert (err == ASE_OK); + + inBuffers.calloc (totalNumInputChans + 8); + outBuffers.calloc (totalNumOutputChans + 8); + if (needToReset) { JUCE_ASIO_LOG (" Resetting");