@@ -166,7 +166,6 @@ void recording::record_from_streaminfo(const lsl::stream_info &src, bool phase_l
166166 streamid_t streamid = fresh_streamid ();
167167
168168 inlet_p in;
169- lsl::stream_info info;
170169
171170 // --- headers phase
172171 try {
@@ -188,8 +187,7 @@ void recording::record_from_streaminfo(const lsl::stream_info &src, bool phase_l
188187 }
189188
190189 // retrieve the stream header & get its XML version
191- info = in->info ();
192- file_.write_stream_header (streamid, info.as_xml ());
190+ file_.write_stream_header (streamid, in->info ().as_xml ());
193191 std::cout << " Received header for stream " << src.name () << " ." << std::endl;
194192
195193 leave_headers_phase (phase_locked);
@@ -209,30 +207,32 @@ void recording::record_from_streaminfo(const lsl::stream_info &src, bool phase_l
209207 enter_streaming_phase (phase_locked);
210208 std::cout << " Started data collection for stream " << src.name () << " ." << std::endl;
211209
210+ const double nominal_srate = in->info ().nominal_srate ();
211+
212212 // now write the actual sample chunks...
213213 switch (src.channel_format ()) {
214214 case lsl::cf_int8:
215- typed_transfer_loop<char >(streamid, info. nominal_srate () , in, first_timestamp,
215+ typed_transfer_loop<char >(streamid, nominal_srate, in, first_timestamp,
216216 last_timestamp, sample_count);
217217 break ;
218218 case lsl::cf_int16:
219- typed_transfer_loop<int16_t >(streamid, info. nominal_srate () , in, first_timestamp,
219+ typed_transfer_loop<int16_t >(streamid, nominal_srate, in, first_timestamp,
220220 last_timestamp, sample_count);
221221 break ;
222222 case lsl::cf_int32:
223- typed_transfer_loop<int32_t >(streamid, info. nominal_srate () , in, first_timestamp,
223+ typed_transfer_loop<int32_t >(streamid, nominal_srate, in, first_timestamp,
224224 last_timestamp, sample_count);
225225 break ;
226226 case lsl::cf_float32:
227- typed_transfer_loop<float >(streamid, info. nominal_srate () , in, first_timestamp,
227+ typed_transfer_loop<float >(streamid, nominal_srate, in, first_timestamp,
228228 last_timestamp, sample_count);
229229 break ;
230230 case lsl::cf_double64:
231- typed_transfer_loop<double >(streamid, info. nominal_srate () , in, first_timestamp,
231+ typed_transfer_loop<double >(streamid, nominal_srate, in, first_timestamp,
232232 last_timestamp, sample_count);
233233 break ;
234234 case lsl::cf_string:
235- typed_transfer_loop<std::string>(streamid, info. nominal_srate () , in,
235+ typed_transfer_loop<std::string>(streamid, nominal_srate, in,
236236 first_timestamp, last_timestamp, sample_count);
237237 break ;
238238 default :
0 commit comments