summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/OSCEngineReceiver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-23 02:03:41 +0000
committerDavid Robillard <d@drobilla.net>2007-09-23 02:03:41 +0000
commitd1ba04724f0bfbed18690316dbe5eb977a131733 (patch)
tree76ce5146a916ff4a497f88a7c4c3e99c64f4fca6 /src/libs/engine/OSCEngineReceiver.cpp
parentc1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9 (diff)
downloadingen-d1ba04724f0bfbed18690316dbe5eb977a131733.tar.gz
ingen-d1ba04724f0bfbed18690316dbe5eb977a131733.tar.bz2
ingen-d1ba04724f0bfbed18690316dbe5eb977a131733.zip
Working LV2 UI control setting (including MIDI).
Klaviatur (ll-plugins virtual keyboard) is now fully functional inside Ingen. git-svn-id: http://svn.drobilla.net/lad/ingen@766 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/OSCEngineReceiver.cpp')
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp110
1 files changed, 73 insertions, 37 deletions
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index caaf0d73..d2d7a4a0 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -96,10 +96,8 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/connect", "iss", connect_cb, this);
lo_server_add_method(_server, "/ingen/disconnect", "iss", disconnect_cb, this);
lo_server_add_method(_server, "/ingen/disconnect_all", "is", disconnect_all_cb, this);
- lo_server_add_method(_server, "/ingen/set_port_value", "isf", set_port_value_cb, this);
- lo_server_add_method(_server, "/ingen/set_port_value", "isif", set_port_value_voice_cb, this);
- lo_server_add_method(_server, "/ingen/set_port_value_immediate", "isf", set_port_value_immediate_cb, this);
- lo_server_add_method(_server, "/ingen/set_port_value_immediate", "isif", set_port_value_immediate_voice_cb, this);
+ lo_server_add_method(_server, "/ingen/set_port_value", NULL, set_port_value_cb, this);
+ lo_server_add_method(_server, "/ingen/set_port_value_immediate", NULL, set_port_value_immediate_cb, this);
lo_server_add_method(_server, "/ingen/note_on", "isii", note_on_cb, this);
lo_server_add_method(_server, "/ingen/note_off", "isi", note_off_cb, this);
lo_server_add_method(_server, "/ingen/all_notes_off", "isi", all_notes_off_cb, this);
@@ -598,7 +596,7 @@ OSCEngineReceiver::_disconnect_cb(const char* path, const char* types, lo_arg**
int
OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* node_path = &argv[1]->s;
+ const char* node_path = &argv[1]->s;
disconnect_all(node_path);
return 0;
@@ -611,17 +609,6 @@ OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_ar
* \arg \b port-path (string) - Name of port
* \arg \b value (float) - Value to set port to </p> \n \n
*/
-int
-OSCEngineReceiver::_set_port_value_immediate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* port_path = &argv[1]->s;
- const float value = argv[2]->f;
-
- set_port_value_immediate(port_path, sizeof(float), &value);
- return 0;
-}
-
-
/** \page engine_osc_namespace
* <p> \b /ingen/set_port_value_immediate - Sets the value of a port for a specific voice (both AR and CR)
* \arg \b response-id (integer)
@@ -632,13 +619,43 @@ OSCEngineReceiver::_set_port_value_immediate_cb(const char* path, const char* ty
* See documentation for set_port_value for the distinction between these two messages.
*/
int
-OSCEngineReceiver::_set_port_value_immediate_voice_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::_set_port_value_immediate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* port_path = &argv[1]->s;
- const int32_t voice = argv[2]->i;
- const float value = argv[3]->f;
+ if (argc < 3 || argc > 4 || strncmp(types, "is", 2))
+ return 1;
+
+ const char* port_path = &argv[1]->s;
+
+ if (argc == 3) {
+ if (types[2] == 'f') {
+ const float value = argv[2]->f;
+ set_port_value_immediate(port_path, "who cares", sizeof(float), &value);
+ return 0;
+ } else if (types[2] == 'b') {
+ lo_blob b = argv[2];
+ size_t data_size = lo_blob_datasize(b);
+ void* data = lo_blob_dataptr(b);
+ set_port_value_immediate(port_path, "who cares", data_size, data);
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ if (types[3] == 'f') {
+ const float value = argv[3]->f;
+ set_port_value_immediate(port_path, "who cares", argv[2]->i, sizeof(float), &value);
+ return 0;
+ } else if (types[3] == 'b') {
+ lo_blob b = argv[3];
+ size_t data_size = lo_blob_datasize(b);
+ void* data = lo_blob_dataptr(b);
+ set_port_value_immediate(port_path, "who cares", argv[2]->i, data_size, data);
+ return 0;
+ } else {
+ return 1;
+ }
+ }
- set_port_value_immediate(port_path, voice, sizeof(float), &value);
return 0;
}
@@ -657,17 +674,6 @@ OSCEngineReceiver::_set_port_value_immediate_voice_cb(const char* path, const ch
* There is also a fast "immediate" version of this message, set_port_value_immediate, which
* does not have this ordering guarantee.</p> \n \n
*/
-int
-OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* port_path = &argv[1]->s;
- const float value = argv[2]->f;
-
- set_port_value(port_path, sizeof(float), &value);
- return 0;
-}
-
-
/** \page engine_osc_namespace
* <p> \b /ingen/set_port_value - Sets the value of a port for all voices (as a QueuedEvent)
* \arg \b response-id (integer)
@@ -683,13 +689,43 @@ OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
* does not have this ordering guarantee.</p> \n \n
*/
int
-OSCEngineReceiver::_set_port_value_voice_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* port_path = &argv[1]->s;
- const int32_t voice = argv[2]->i;
- const float value = argv[3]->f;
+ if (argc < 3 || argc > 4 || strncmp(types, "is", 2))
+ return 1;
+
+ const char* port_path = &argv[1]->s;
+
+ if (argc == 3) {
+ if (types[2] == 'f') {
+ const float value = argv[2]->f;
+ set_port_value(port_path, "who cares", sizeof(float), &value);
+ return 0;
+ } else if (types[2] == 'b') {
+ lo_blob b = argv[2];
+ size_t data_size = lo_blob_datasize(b);
+ void* data = lo_blob_dataptr(b);
+ set_port_value(port_path, "who cares", data_size, data);
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ if (types[3] == 'f') {
+ const float value = argv[3]->f;
+ set_port_value(port_path, "who cares", argv[2]->i, sizeof(float), &value);
+ return 0;
+ } else if (types[3] == 'b') {
+ lo_blob b = argv[3];
+ size_t data_size = lo_blob_datasize(b);
+ void* data = lo_blob_dataptr(b);
+ set_port_value(port_path, "who cares", argv[2]->i, data_size, data);
+ return 0;
+ } else {
+ return 1;
+ }
+ }
- set_port_value(port_path, voice, sizeof(float), &value);
return 0;
}