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 4
4
5
5
6
6
int main (int argc, char **argv) {
7
+ std::cout << " ReceiveDataInChunks" << std::endl;
8
+ std::cout << " ReceiveDataInChunks StreamName max_buflen" << std::endl;
9
+
7
10
try {
8
11
9
12
std::string name{argc > 1 ? argv[1 ] : " MyAudioStream" };
13
+ int32_t max_buflen = argc > 2 ? std::stol (argv[2 ]) : 360 ;
10
14
// 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 );
12
16
13
17
inlet.flush ();
14
18
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 ;
16
21
17
22
// and retrieve the chunks
18
23
uint64_t k = 0 , num_samples = 0 ;
@@ -29,7 +34,13 @@ int main(int argc, char **argv) {
29
34
std::cout << num_samples / (now - starttime) << " samples/sec" << std::endl;
30
35
next_display = now + 1 ;
31
36
}
37
+ if (now > next_reset) { std::cout << " Resetting counters..." << std::endl;
38
+ starttime = now;
39
+ next_reset = now + 10 ;
40
+ num_samples = 0 ;
41
+ }
32
42
}
43
+
33
44
}
34
45
35
46
} 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