From 0b8415c61e321d032d62b5b1cbda65bab6f178d7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 19 Sep 2007 21:16:18 +0000 Subject: Tidy up OSC namespace to use OSC true/false instead of C style boolean integers. Fully separate concept of "polyphonic" (boolean node property) from "polyphony" (integer patch/node property). Ability to add "polyphonic" nodes to poly=1 patches (in case poly is changed later). git-svn-id: http://svn.drobilla.net/lad/ingen@732 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/OSCClientReceiver.cpp | 7 ++++--- src/libs/client/OSCEngineSender.cpp | 37 +++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 058bf006..d223e211 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -156,7 +156,8 @@ OSCClientReceiver::setup_callbacks() lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this); lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this); lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this); - lo_server_thread_add_method(_st, "/ingen/new_node", "ssii", new_node_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_node", "ssTi", new_node_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_node", "ssFi", new_node_cb, this); lo_server_thread_add_method(_st, "/ingen/new_port", "ssi", new_port_cb, this); lo_server_thread_add_method(_st, "/ingen/metadata_update", NULL, metadata_update_cb, this); lo_server_thread_add_method(_st, "/ingen/control_change", "sf", control_change_cb, this); @@ -256,10 +257,10 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar { const char* uri = &argv[0]->s; const char* node_path = &argv[1]->s; - const int32_t poly = argv[2]->i; + bool polyphonic = (types[2] == 'T'); const int32_t num_ports = argv[3]->i; - new_node(uri, node_path, poly, num_ports); + new_node(uri, node_path, polyphonic, num_ports); /*_receiving_node_model = new NodeModel(node_path); _receiving_node_model->polyphonic((poly == 1)); diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 89939b6b..e7b94e48 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -192,11 +192,17 @@ OSCEngineSender::create_node(const string& path, bool polyphonic) { assert(_engine_addr); - lo_send(_engine_addr, "/ingen/create_node", "issi", - next_id(), - path.c_str(), - plugin_uri.c_str(), - (polyphonic ? 1 : 0)); + + if (polyphonic) + lo_send(_engine_addr, "/ingen/create_node", "issT", + next_id(), + path.c_str(), + plugin_uri.c_str()); + else + lo_send(_engine_addr, "/ingen/create_node", "issF", + next_id(), + path.c_str(), + plugin_uri.c_str()); } @@ -212,13 +218,20 @@ OSCEngineSender::create_node(const string& path, bool polyphonic) { assert(_engine_addr); - lo_send(_engine_addr, "/ingen/create_node", "issssi", - next_id(), - path.c_str(), - plugin_type.c_str(), - library_name.c_str(), - plugin_label.c_str(), - (polyphonic ? 1 : 0)); + if (polyphonic) + lo_send(_engine_addr, "/ingen/create_node", "issssT", + next_id(), + path.c_str(), + plugin_type.c_str(), + library_name.c_str(), + plugin_label.c_str()); + else + lo_send(_engine_addr, "/ingen/create_node", "issssF", + next_id(), + path.c_str(), + plugin_type.c_str(), + library_name.c_str(), + plugin_label.c_str()); } -- cgit v1.2.1