Skip to content

Commit

Permalink
added command line argument for specifying participant id
Browse files Browse the repository at this point in the history
  • Loading branch information
Marios Fanourakis committed Sep 3, 2020
1 parent 37ec0e7 commit d85b5ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion win_keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ int main(int argc, char *argv[]) {
"permission to grab the Windows keyboard events.");
std::cout << "Keyboard successfully hooked" << std::endl;
// create streaminfo and outlet
lsl::stream_info info("Keyboard", "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string);
std::string streamname = "Keyboard";
if (argc > 1){
streamname = streamname + "-" + argv[1];
}
lsl::stream_info info(streamname, "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string);
outlet = new lsl::stream_outlet(info);
std::cout << "Outlet created. Close this window to stop streaming." << std::endl;
} catch (std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; }
Expand Down
10 changes: 8 additions & 2 deletions win_mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ int main(int argc, char *argv[]) {
"to grab the Windows mouse events.");
std::cout << "Mouse successfully hooked" << std::endl;
// create streaminfo and outlet for buttons
std::string streamnameButtons = "MouseButtons";
std::string streamnamePosition = "MousePosition";
if (argc > 1) {
streamnameButtons = streamnameButtons + "-" + argv[1];
streamnamePosition = streamnamePosition + "-" + argv[1];
}
lsl::stream_info infoButtons(
"MouseButtons", "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string);
streamnameButtons, "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string);
outletButtons = new lsl::stream_outlet(infoButtons);
// create streaminfo and outlet for the position
lsl::stream_info infoPosition(
"MousePosition", "Position", 2, lsl::IRREGULAR_RATE, lsl::cf_int32);
streamnamePosition, "Position", 2, lsl::IRREGULAR_RATE, lsl::cf_int32);
lsl::xml_element setup = infoPosition.desc().append_child("setup");
lsl::xml_element display = setup.append_child("display");
display.append_child_value("monitors", std::to_string(GetSystemMetrics(SM_CMONITORS)));
Expand Down

0 comments on commit d85b5ad

Please sign in to comment.