| 786 | |
| 787 | #ifdef HAVE_LIBLO |
| 788 | bool Initializer::startRemoteServer(const char* const port) |
| 789 | { |
| 790 | #ifdef CARDINAL_INIT_OSC_THREAD |
| 791 | if (oscServerThread != nullptr) |
| 792 | return true; |
| 793 | |
| 794 | if ((oscServerThread = lo_server_thread_new_with_proto(port, LO_UDP, osc_error_handler)) == nullptr) |
| 795 | return false; |
| 796 | |
| 797 | oscServer = lo_server_thread_get_server(oscServerThread); |
| 798 | |
| 799 | lo_server_thread_add_method(oscServerThread, "/hello", "", osc_hello_handler, this); |
| 800 | lo_server_thread_add_method(oscServerThread, "/host-param", "if", osc_host_param_handler, this); |
| 801 | lo_server_thread_add_method(oscServerThread, "/load", "b", osc_load_handler, this); |
| 802 | lo_server_thread_add_method(oscServerThread, "/param", "hif", osc_param_handler, this); |
| 803 | lo_server_thread_add_method(oscServerThread, "/screenshot", "b", osc_screenshot_handler, this); |
| 804 | lo_server_thread_add_method(oscServerThread, nullptr, nullptr, osc_fallback_handler, nullptr); |
| 805 | lo_server_thread_start(oscServerThread); |
| 806 | #else |
| 807 | if (oscServer != nullptr) |
| 808 | return true; |
| 809 | |
| 810 | if ((oscServer = lo_server_new_with_proto(port, LO_UDP, osc_error_handler)) == nullptr) |
| 811 | return false; |
| 812 | |
| 813 | lo_server_add_method(oscServer, "/hello", "", osc_hello_handler, this); |
| 814 | lo_server_add_method(oscServer, "/host-param", "if", osc_host_param_handler, this); |
| 815 | lo_server_add_method(oscServer, "/load", "b", osc_load_handler, this); |
| 816 | lo_server_add_method(oscServer, "/param", "hif", osc_param_handler, this); |
| 817 | lo_server_add_method(oscServer, nullptr, nullptr, osc_fallback_handler, nullptr); |
| 818 | #endif |
| 819 | |
| 820 | return true; |
| 821 | } |
| 822 | |
| 823 | void Initializer::stopRemoteServer() |
| 824 | { |