From 4034f1b55bdcb6ed1a115bd07bb638ab5a20e3ba Mon Sep 17 00:00:00 2001 From: Andrey Bezpalenko Date: Tue, 2 Jun 2020 23:02:33 +0300 Subject: [PATCH] Added a delay to processing listener statement on Sample Rate changes, since it's cleared listeners after re-subscribing --- native/app/Source/Application.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/native/app/Source/Application.swift b/native/app/Source/Application.swift index 1b80b80..8c718b4 100644 --- a/native/app/Source/Application.swift +++ b/native/app/Source/Application.swift @@ -325,10 +325,13 @@ class Application { retain: false ) { // selectOutput(device: selectedDevice) - stopListeners() - stopEngines() - self.matchDriverSampleRateToOutput() - createAudioPipeline() + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + // need a delay, because emitter should finish it's work at first + stopListeners() + stopEngines() + self.matchDriverSampleRateToOutput() + createAudioPipeline() + } } selectedDeviceVolumeChangedListener = AudioDeviceEvents.on(