summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-09-28 22:04:26 +0000
committerDavid Robillard <d@drobilla.net>2008-09-28 22:04:26 +0000
commit3593abd69807674d9949134f1ad2b7f5a9f69dc2 (patch)
treebe81356499f0835a0955deb690b966d6e1a1914b /src
parent97c3b4ba12052b47ec41dc6aded5f1fc84e67c8f (diff)
downloadingen-3593abd69807674d9949134f1ad2b7f5a9f69dc2.tar.gz
ingen-3593abd69807674d9949134f1ad2b7f5a9f69dc2.tar.bz2
ingen-3593abd69807674d9949134f1ad2b7f5a9f69dc2.zip
Merge weird split set_port_value / set_port_value_immediately API (whether a command is queued or 'immediate' is a property of the engine interface, really).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1532 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/bindings/Client.hpp10
-rw-r--r--src/common/interface/EngineInterface.hpp10
-rw-r--r--src/libs/client/HTTPEngineSender.cpp15
-rw-r--r--src/libs/client/HTTPEngineSender.hpp7
-rw-r--r--src/libs/client/OSCEngineSender.cpp30
-rw-r--r--src/libs/client/OSCEngineSender.hpp7
-rw-r--r--src/libs/client/PluginUI.cpp4
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp87
-rw-r--r--src/libs/engine/OSCEngineReceiver.hpp1
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp17
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp7
-rw-r--r--src/libs/gui/ControlPanel.cpp6
-rw-r--r--src/libs/gui/PatchCanvas.cpp3
-rw-r--r--src/libs/gui/Port.cpp12
14 files changed, 28 insertions, 188 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index eb772524..1d46437a 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -73,11 +73,11 @@ public:
uint32_t data_size,
const void* data) {}
- virtual void set_port_value(const std::string& port_path,
- const std::string& type_uri,
- uint32_t voice,
- uint32_t data_size,
- const void* data) {}
+ virtual void set_voice_value(const std::string& port_path,
+ const std::string& type_uri,
+ uint32_t voice,
+ uint32_t data_size,
+ const void* data) {}
virtual void program_add(const std::string& node_path,
uint32_t bank,
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index a9b2a0c1..9a835784 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -75,12 +75,12 @@ public:
virtual void disconnect_all(const std::string& parent_patch_path,
const std::string& path) = 0;
- virtual void set_port_value_immediate(const std::string& port_path,
- const Raul::Atom& value) = 0;
+ virtual void set_port_value(const std::string& port_path,
+ const Raul::Atom& value) = 0;
- virtual void set_voice_value_immediate(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value) = 0;
+ virtual void set_voice_value(const std::string& port_path,
+ uint32_t voice,
+ const Raul::Atom& value) = 0;
virtual void set_program(const std::string& node_path,
uint32_t bank,
diff --git a/src/libs/client/HTTPEngineSender.cpp b/src/libs/client/HTTPEngineSender.cpp
index 882a4bc4..733e0ac7 100644
--- a/src/libs/client/HTTPEngineSender.cpp
+++ b/src/libs/client/HTTPEngineSender.cpp
@@ -198,21 +198,6 @@ HTTPEngineSender::set_voice_value(const string& port_path,
void
-HTTPEngineSender::set_port_value_immediate(const string& port_path,
- const Raul::Atom& value)
-{
-}
-
-
-void
-HTTPEngineSender::set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
-{
-}
-
-
-void
HTTPEngineSender::set_program(const string& node_path,
uint32_t bank,
uint32_t program)
diff --git a/src/libs/client/HTTPEngineSender.hpp b/src/libs/client/HTTPEngineSender.hpp
index f753eea3..411ddfd5 100644
--- a/src/libs/client/HTTPEngineSender.hpp
+++ b/src/libs/client/HTTPEngineSender.hpp
@@ -115,13 +115,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- void set_port_value_immediate(const string& port_path,
- const Raul::Atom& value);
-
- void set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
-
void set_program(const string& node_path,
uint32_t bank,
uint32_t program);
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index e274f72b..c21d16ce 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -287,36 +287,6 @@ OSCEngineSender::set_voice_value(const string& port_path,
void
-OSCEngineSender::set_port_value_immediate(const string& port_path,
- const Raul::Atom& value)
-{
- lo_message m = lo_message_new();
- lo_message_add_int32(m, next_id());
- lo_message_add_string(m, port_path.c_str());
- if (value.type() == Atom::BLOB)
- lo_message_add_string(m, value.get_blob_type());
- Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/ingen/set_port_value_immediate", m);
-}
-
-
-void
-OSCEngineSender::set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
-{
- lo_message m = lo_message_new();
- lo_message_add_int32(m, next_id());
- lo_message_add_string(m, port_path.c_str());
- lo_message_add_int32(m, voice);
- if (value.type() == Atom::BLOB)
- lo_message_add_string(m, value.get_blob_type());
- Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/ingen/set_port_value_immediate", m);
-}
-
-
-void
OSCEngineSender::set_program(const string& node_path,
uint32_t bank,
uint32_t program)
diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp
index 4c92afdb..ef4a2fa3 100644
--- a/src/libs/client/OSCEngineSender.hpp
+++ b/src/libs/client/OSCEngineSender.hpp
@@ -116,13 +116,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- void set_port_value_immediate(const string& port_path,
- const Raul::Atom& value);
-
- void set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
-
void set_program(const string& node_path,
uint32_t bank,
uint32_t program);
diff --git a/src/libs/client/PluginUI.cpp b/src/libs/client/PluginUI.cpp
index df958f06..9c562135 100644
--- a/src/libs/client/PluginUI.cpp
+++ b/src/libs/client/PluginUI.cpp
@@ -64,7 +64,7 @@ lv2_ui_write(LV2UI_Controller controller,
if (*(float*)buffer == port->value().get_float())
return; // do nothing (handle stupid plugin UIs that feed back)
- ui->world()->engine->set_port_value_immediate(port->path(), Atom(*(float*)buffer));
+ ui->world()->engine->set_port_value(port->path(), Atom(*(float*)buffer));
// FIXME: slow, need to cache ID
} else if (format == map->uri_to_id(NULL, "http://lv2plug.in/ns/extensions/ui#Events")) {
@@ -77,7 +77,7 @@ lv2_ui_write(LV2UI_Controller controller,
LV2_Event* const ev = lv2_event_get(&iter, &data);
if (ev->type == midi_event_type) {
// FIXME: bundle multiple events by writing an entire buffer here
- ui->world()->engine->set_port_value_immediate(port->path(),
+ ui->world()->engine->set_port_value(port->path(),
Atom("lv2_midi:MidiEvent", ev->size, data));
} else {
cerr << "WARNING: Unable to send event type " << ev->type <<
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index f71bdb83..dbdb388d 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -70,7 +70,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
}
// For debugging, print all incoming OSC messages
- //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL);
+ lo_server_add_method(_server, NULL, NULL, generic_cb, NULL);
// Set response address for this message.
// It's important this is first and returns nonzero.
@@ -102,7 +102,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/disconnect", "iss", disconnect_cb, this);
lo_server_add_method(_server, "/ingen/disconnect_all", "iss", disconnect_all_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);
@@ -580,84 +579,10 @@ OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_ar
/** \page engine_osc_namespace
- * <p> \b /ingen/set_port_value_immediate - Sets the value of a port for all voices (both AR and CR)
- * \arg \b response-id (integer)
- * \arg \b port-path (string) - Name of port
- * \arg \b type (string (URI or QName)) - Type of value being set (ingen:Float or ingen:EventBuffer)
- * \arg \b value (float or blob) - Value to set port to </p> \n \n
- */
-/** \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)
- * \arg \b port-path (string) - Name of port
- * \arg \b type (string (URI or QName)) - Type of value being set (ingen:Float or ingen:Event)
- * \arg \b voice (integer) - Voice to set port value for
- * \arg \b value (float or blob) - Value to set port to </p> \n \n
- *
- * See documentation for set_port_value for the distinction between these two messages.
- */
-int
-OSCEngineReceiver::_set_port_value_immediate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- if (argc < 3 || argc > 5 || strncmp(types, "is", 2))
- return 1;
-
- const char* port_path = &argv[1]->s;
- using Raul::Atom;
-
- if (!strcmp(types, "isf")) { // float, all voices
- const float value = argv[2]->f;
- set_port_value_immediate(port_path, Atom(value));
- } else if (!strcmp(types, "isif")) { // float, specific voice
- const float value = argv[3]->f;
- set_voice_value_immediate(port_path, argv[2]->i, Atom(value));
- } else if (!strcmp(types, "issb")) { // blob (event), all voices
- const char* type = &argv[2]->s;
- 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, Atom(type, data_size, data));
- } else if (!strcmp(types, "isisb")) { // blob (event), specific voice
- const char* type = &argv[3]->s;
- lo_blob b = argv[4];
- size_t data_size = lo_blob_datasize(b);
- void* data = lo_blob_dataptr(b);
- set_voice_value_immediate(port_path, argv[2]->i, Atom(type, data_size, data));
- } else {
- return 1;
- }
-
- 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)
- * \arg \b port-path (string) - Name of port
- * \arg \b value (float) - Value to set port to
- *
- * \li This is the queued way to set a port value (it is in the same threading class as e.g.
- * node creation). This way the client can stream a sequence of events which depend on each
- * other (e.g. a node creation followed by several set_port_value messages to set the node's
- * controls) without needing to wait on a response to the first (node creation) message.
- *
- * There is also a fast "immediate" version of this message, set_port_value_immediate, which
- * does not have this ordering guarantee.</p> \n \n
- */
-/** \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)
* \arg \b port-path (string) - Name of port
- * \arg \b value (float) - Value to set port to
- *
- * \li This is the queued way to set a port value (it is in the same threading class as e.g.
- * node creation). This way the client can stream a sequence of events which depend on each
- * other (e.g. a node creation followed by several set_port_value messages to set the node's
- * controls) without needing to wait on a response to the first (node creation) message.
- *
- * There is also a fast "immediate" version of this message, set_port_value_immediate, which
- * does not have this ordering guarantee.</p> \n \n
+ * \arg \b value (float) - Value to set port to.</p> \n \n
*/
int
OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
@@ -671,22 +596,22 @@ OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
if (!strcmp(types, "isf")) { // float, all voices
const float value = argv[2]->f;
- set_port_value_immediate(port_path, Atom(value));
+ set_port_value(port_path, Atom(value));
} else if (!strcmp(types, "isif")) { // float, specific voice
const float value = argv[3]->f;
- set_voice_value_immediate(port_path, argv[2]->i, Atom(value));
+ set_voice_value(port_path, argv[2]->i, Atom(value));
} else if (!strcmp(types, "issb")) { // blob (event), all voices
const char* type = &argv[2]->s;
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, Atom(type, data_size, data));
+ set_port_value(port_path, Atom(type, data_size, data));
} else if (!strcmp(types, "isisb")) { // blob (event), specific voice
const char* type = &argv[3]->s;
lo_blob b = argv[4];
size_t data_size = lo_blob_datasize(b);
void* data = lo_blob_dataptr(b);
- set_voice_value_immediate(port_path, argv[2]->i, Atom(type, data_size, data));
+ set_voice_value(port_path, argv[2]->i, Atom(type, data_size, data));
} else {
return 1;
}
diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp
index 5c54ac7f..c6e0bf59 100644
--- a/src/libs/engine/OSCEngineReceiver.hpp
+++ b/src/libs/engine/OSCEngineReceiver.hpp
@@ -106,7 +106,6 @@ private:
LO_HANDLER(disconnect);
LO_HANDLER(disconnect_all);
LO_HANDLER(set_port_value);
- LO_HANDLER(set_port_value_immediate);
LO_HANDLER(note_on);
LO_HANDLER(note_off);
LO_HANDLER(all_notes_off);
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 6be0bf96..962410b2 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -253,23 +253,6 @@ QueuedEngineInterface::set_voice_value(const string& port_path,
void
-QueuedEngineInterface::set_port_value_immediate(const string& port_path,
- const Raul::Atom& value)
-{
- push_stamped(new SetPortValueEvent(_engine, _responder, false, now(), port_path, value));
-}
-
-
-void
-QueuedEngineInterface::set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value)
-{
- push_stamped(new SetPortValueEvent(_engine, _responder, false, now(), voice, port_path, value));
-}
-
-
-void
QueuedEngineInterface::set_program(const string& node_path,
uint32_t bank,
uint32_t program)
diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp
index 3aba9c7e..73c790c8 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -126,13 +126,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- virtual void set_port_value_immediate(const string& port_path,
- const Raul::Atom& value);
-
- virtual void set_voice_value_immediate(const string& port_path,
- uint32_t voice,
- const Raul::Atom& value);
-
virtual void set_program(const string& node_path,
uint32_t bank,
uint32_t program);
diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp
index 0e637721..7da07dbb 100644
--- a/src/libs/gui/ControlPanel.cpp
+++ b/src/libs/gui/ControlPanel.cpp
@@ -226,16 +226,14 @@ void
ControlPanel::value_changed(SharedPtr<PortModel> port, float val)
{
if (_callback_enabled) {
-
if (_all_voices_radio->get_active()) {
- App::instance().engine()->set_port_value_immediate(port->path(), Atom(val));
+ App::instance().engine()->set_port_value(port->path(), Atom(val));
port->value(val);
} else {
int voice = _voice_spinbutton->get_value_as_int() - 1;
- App::instance().engine()->set_voice_value_immediate(port->path(), voice, Atom(val));
+ App::instance().engine()->set_voice_value(port->path(), voice, Atom(val));
port->value(val);
}
-
}
}
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index f96a9f57..4f01a7f7 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -445,8 +445,7 @@ PatchCanvas::connect(boost::shared_ptr<FlowCanvas::Connectable> src_port,
return;
// Midi binding/learn shortcut
- if (src->model()->type().is_event() && dst->model()->type().is_control())
- {
+ if (src->model()->type().is_event() && dst->model()->type().is_control()) {
cerr << "[PatchCanvas] FIXME: MIDI binding shortcut" << endl;
#if 0
SharedPtr<PluginModel> pm(new PluginModel(PluginModel::Internal, "", "midi_control_in", ""));
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index ab574f88..fd35ff90 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -122,11 +122,13 @@ Port::activity()
void
Port::set_control(float value, bool signal)
{
- if (_port_model->type() != DataType::CONTROL && _port_model->type() != DataType::AUDIO)
- return;
-
- if (signal)
- App::instance().engine()->set_port_value_immediate(_port_model->path(), Atom(value));
+ if (signal) {
+ if (_port_model->type() == DataType::CONTROL) {
+ App::instance().engine()->set_port_value(_port_model->path(), Atom(value));
+ } else if (_port_model->type() == DataType::EVENT) {
+ cout << "EVENT CONTROL" << endl;
+ }
+ }
FlowCanvas::Port::set_control(value);
}