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.
Create Aggregate Device with Built-In Microphone through Audio MIDI Setup
Plug headphone with Mic in your system
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.
Unplug headphone from the system
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
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.