Skip to content

Commit 74df451

Browse files
authored
Apply playback factor on startup, pass Volume and recalculate ByteLimits (#11)
* read resample factor on startup * fix volume on startup * make timed_stream apply the start delay
1 parent e219af7 commit 74df451

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api/SnapOutput.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SnapOutput : public AudioInfoSupport {
7676
/// mute / unmute
7777
void setMute(bool mute) {
7878
is_mute = mute;
79-
vol_stream.setVolume(mute ? 0 : vol);
79+
vol_stream.setVolume(mute ? 0 : vol * vol_factor);
8080
audioWriteSilence();
8181
}
8282

@@ -153,6 +153,7 @@ class SnapOutput : public AudioInfoSupport {
153153
vol_cfg.copyFrom(audio_info);
154154
vol_cfg.allow_boost = true;
155155
vol_stream.begin(vol_cfg);
156+
vol_stream.setVolume(vol * vol_factor);
156157

157158
// open final output
158159
out->setAudioInfo(audio_info);
@@ -246,8 +247,10 @@ class SnapOutput : public AudioInfoSupport {
246247
} else {
247248
// wait for the audio to become valid
248249
ESP_LOGI(TAG, "starting after %d ms", delay_ms);
250+
setPlaybackFactor(p_snap_time_sync->getFactor());
249251
// replaced delay(delay_ms); with timed_stream
250252
timed_stream.setStartMs(delay_ms);
253+
timed_stream.begin();
251254
is_sync_started = true;
252255
result = true;
253256
}

0 commit comments

Comments
 (0)