File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 44
55
66int main (int argc, char **argv) {
7+ std::cout << " ReceiveDataInChunks" << std::endl;
8+ std::cout << " ReceiveDataInChunks StreamName max_buflen" << std::endl;
9+
710 try {
811
912 std::string name{argc > 1 ? argv[1 ] : " MyAudioStream" };
13+ int32_t max_buflen = argc > 2 ? std::stol (argv[2 ]) : 360 ;
1014 // resolve the stream of interest & make an inlet
11- lsl::stream_inlet inlet (lsl::resolve_stream (" name" , name).at (0 ));
15+ lsl::stream_inlet inlet (lsl::resolve_stream (" name" , name).at (0 ), max_buflen );
1216
1317 inlet.flush ();
1418
15- double starttime = lsl::local_clock (), next_display = starttime + 1 ;
19+ double starttime = lsl::local_clock (), next_display = starttime + 1 ,
20+ next_reset = starttime + 10 ;
1621
1722 // and retrieve the chunks
1823 uint64_t k = 0 , num_samples = 0 ;
@@ -29,7 +34,13 @@ int main(int argc, char **argv) {
2934 std::cout << num_samples / (now - starttime) << " samples/sec" << std::endl;
3035 next_display = now + 1 ;
3136 }
37+ if (now > next_reset) { std::cout << " Resetting counters..." << std::endl;
38+ starttime = now;
39+ next_reset = now + 10 ;
40+ num_samples = 0 ;
41+ }
3242 }
43+
3344 }
3445
3546 } catch (std::exception &e) { std::cerr << " Got an exception: " << e.what () << std::endl; }
You can’t perform that action at this time.
0 commit comments