@@ -91,8 +91,7 @@ class SnapOutput : public AudioInfoSupport {
91
91
this ->out = &output; // final output
92
92
resample.setStream (output);
93
93
vol_stream.setStream (resample); // adjust volume
94
- timed_stream.setStream (vol_stream);
95
- decoder_stream.setStream (&timed_stream); // decode to pcm
94
+ decoder_stream.setStream (&vol_stream); // decode to pcm
96
95
}
97
96
98
97
AudioOutput &getOutput () { return *out; }
@@ -110,7 +109,6 @@ class SnapOutput : public AudioInfoSupport {
110
109
if (is_audio_begin_called) {
111
110
vol_stream.setAudioInfo (info);
112
111
out->setAudioInfo (info);
113
- timed_stream.setAudioInfo (info);
114
112
}
115
113
}
116
114
@@ -123,10 +121,6 @@ class SnapOutput : public AudioInfoSupport {
123
121
124
122
bool isStarted () { return is_audio_begin_called; }
125
123
126
- // / If set to true, the startup is using delay()
127
- void setSynchronizeStartWithDelay (bool flag){
128
- is_synchronize_with_delay = flag;
129
- }
130
124
131
125
protected:
132
126
const char *TAG = " SnapOutput" ;
@@ -135,7 +129,6 @@ class SnapOutput : public AudioInfoSupport {
135
129
EncodedAudioStream decoder_stream;
136
130
VolumeStream vol_stream;
137
131
ResampleStream resample;
138
- TimedStream timed_stream;
139
132
float vol = 1.0 ; // volume in the range 0.0 - 1.0
140
133
float vol_factor = 1.0 ; //
141
134
bool is_mute = false ;
@@ -145,7 +138,6 @@ class SnapOutput : public AudioInfoSupport {
145
138
SnapTimeSync *p_snap_time_sync = &time_sync_default;
146
139
bool is_sync_started = false ;
147
140
bool is_audio_begin_called = false ;
148
- bool is_synchronize_with_delay = false ;
149
141
150
142
// / setup of all audio objects
151
143
bool audioBegin () {
@@ -173,13 +165,10 @@ class SnapOutput : public AudioInfoSupport {
173
165
174
166
// open resampler
175
167
auto res_cfg = resample.defaultConfig ();
176
- res_cfg.step_size = p_snap_time_sync-;
168
+ res_cfg.step_size = p_snap_time_sync-> getFactor () ;
177
169
res_cfg.copyFrom (audio_info);
178
170
resample.begin (res_cfg);
179
171
180
- // set up timed stream
181
- timed_stream.begin (audio_info);
182
-
183
172
ESP_LOGD (TAG, " end" );
184
173
is_audio_begin_called = true ;
185
174
return true ;
@@ -254,17 +243,6 @@ class SnapOutput : public AudioInfoSupport {
254
243
// wait for the audio to become valid
255
244
ESP_LOGI (TAG, " starting after %d ms" , delay_ms);
256
245
setPlaybackFactor (p_snap_time_sync->getFactor ());
257
- // replaced delay(delay_ms); with timed_stream
258
- if (is_synchronize_with_delay){
259
- timed_stream.setStartMs (0 );
260
- timed_stream.begin ();
261
- // When we feed the data from a queue, delay is the best solution
262
- delay (delay_ms);
263
-
264
- } else {
265
- timed_stream.setStartMs (delay_ms);
266
- timed_stream.begin ();
267
- }
268
246
is_sync_started = true ;
269
247
result = true ;
270
248
}
0 commit comments