Audio playback is sluggish when Mic (input device) is unplugged from the system


#1

I have observed a weird behaviour in our application (on Mac OS) which I was able to reproduce in JUCE Demo as well. If we select an audio input device for which appropriate hardware is not connected and then play audio, the playback becomes very sluggish and has noisy artefacts.
These are the steps to reproduce to this issue.

  1. Create Aggregate Device with Built-In Microphone through Audio MIDI Setup
  2. Plug headphone with Mic in your system
  3. Select Aggregate Device as input in Settings of JUCE Demo. You should be able to use headphone and Mic as output and input device respectively.
  4. Unplug headphone from the system
  5. Test audio playback by clicking on “Test” button in Settings.

JUCE Version: 5.2.0
Mac OS: 10.13.2
Headphone Used: Standard earphones available with iPhone


#2

I’m not an expert but could it be a Sample Rate issue?


#3

Are you using the latest version of juce (i.e. the develop brach)?

There was some work recently on CoreAudio devices that might make a difference.


#4

Hi Ian,

Thanks for taking time to respond. I investigated this issue and found that it has nothing to do with sample rate.

-Gautam


#5

Hi Jules,

Thanks for taking time to respond to this issue!

We are using develop branch. I tried Time Profiler instrument (on Debug config) to find the root cause. It seems that there is some issue in AudioIODeviceCombiner::DeviceWrapper::audioDeviceIOCallback function. There is a sleep of 1 ms when this situation occurs, which does not happen in normal playback.

This is the last commit that we are using.
https://github.com/WeAreROLI/JUCE/commit/7dd8fa993e5f1cdf1761d18bdf6f2376569baafa

-Gautam


#6

I can reproduce this - we’re looking at it now.


#7

Fixed:


#8

I will fetch these changes from develop branch and test the issue.

Thanks,
Gautam


#9

Wait a little while - I’ve uncovered some additional problems. Should have them sorted today.


#10

Use this commit:

https://github.com/WeAreROLI/JUCE/commit/438ab2b0f752f2eb20b1f770d72fc57ad47523a7