From d34beee26378cf1fc1b3a604d6249326a9a492f6 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Thu, 29 Feb 2024 23:05:54 +0100 Subject: [PATCH 1/3] read resample factor on startup --- src/api/SnapOutput.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/SnapOutput.h b/src/api/SnapOutput.h index f67a2fa..8991675 100644 --- a/src/api/SnapOutput.h +++ b/src/api/SnapOutput.h @@ -246,6 +246,7 @@ class SnapOutput : public AudioInfoSupport { } else { // wait for the audio to become valid ESP_LOGI(TAG, "starting after %d ms", delay_ms); + setPlaybackFactor(p_snap_time_sync->getFactor()); // replaced delay(delay_ms); with timed_stream timed_stream.setStartMs(delay_ms); is_sync_started = true; From 75ded9b3e84b4edd60015416a060b2acd55e7121 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 1 Mar 2024 15:34:32 +0100 Subject: [PATCH 2/3] fix volume on startup --- src/api/SnapOutput.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/SnapOutput.h b/src/api/SnapOutput.h index 8991675..cedf3a5 100644 --- a/src/api/SnapOutput.h +++ b/src/api/SnapOutput.h @@ -76,7 +76,7 @@ class SnapOutput : public AudioInfoSupport { /// mute / unmute void setMute(bool mute) { is_mute = mute; - vol_stream.setVolume(mute ? 0 : vol); + vol_stream.setVolume(mute ? 0 : vol * vol_factor); audioWriteSilence(); } @@ -153,6 +153,7 @@ class SnapOutput : public AudioInfoSupport { vol_cfg.copyFrom(audio_info); vol_cfg.allow_boost = true; vol_stream.begin(vol_cfg); + vol_stream.setVolume(vol * vol_factor); // open final output out->setAudioInfo(audio_info); From 94319ac08aa4ce00669d6ac9cee198fadbae8864 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 1 Mar 2024 16:07:18 +0100 Subject: [PATCH 3/3] make timed_stream apply the start delay --- src/api/SnapOutput.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/SnapOutput.h b/src/api/SnapOutput.h index cedf3a5..32164c8 100644 --- a/src/api/SnapOutput.h +++ b/src/api/SnapOutput.h @@ -250,6 +250,7 @@ class SnapOutput : public AudioInfoSupport { setPlaybackFactor(p_snap_time_sync->getFactor()); // replaced delay(delay_ms); with timed_stream timed_stream.setStartMs(delay_ms); + timed_stream.begin(); is_sync_started = true; result = true; }