Advertisement
Guest User

strim1234

a guest
Jan 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <lsl_cpp.h>
  2. #include <vector>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. /**
  8. * This is a minimal example that demonstrates how a multi-channel stream (here 128ch) of a
  9. * particular name (here: SimpleStream) can be resolved into an inlet, and how the raw sample data &
  10. * time stamps are pulled from the inlet. This example does not display the obtained data.
  11. */
  12.  
  13. int main(int argc, char **argv) {
  14. using namespace lsl;
  15.  
  16. // resolve the stream of interest & make an inlet to get data from the first result
  17. std::vector<stream_info> results = resolve_stream("name", argc > 1 ? argv[1] : "Strim");
  18. stream_inlet inlet(results[0]);
  19.  
  20. // receive data & time stamps forever (not displaying them here)
  21. std::vector<float> sample;
  22. while (true) {
  23. inlet.pull_sample(sample);
  24.  
  25. for (std::vector<float>::const_iterator i = sample.begin(); i != sample.end(); ++i)
  26. std::cout << *i << ' ';
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement