summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-19 00:56:05 +0000
committerDavid Robillard <d@drobilla.net>2008-08-19 00:56:05 +0000
commit5609c1ce452f8122b5ed12144dd4c1941bd07bc2 (patch)
treee0984409aaeee38599e32c9364636962586b7739 /src/libs
parentf63dcf61bc04cc276ed5ae63266bfb91e3b84d94 (diff)
downloadingen-5609c1ce452f8122b5ed12144dd4c1941bd07bc2.tar.gz
ingen-5609c1ce452f8122b5ed12144dd4c1941bd07bc2.tar.bz2
ingen-5609c1ce452f8122b5ed12144dd4c1941bd07bc2.zip
Kill more API/code - replace enable_port_broadcast and disable_port_broadcast functions/events
with property ingen:broadcast. git-svn-id: http://svn.drobilla.net/lad/ingen@1441 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/OSCEngineSender.cpp20
-rw-r--r--src/libs/client/OSCEngineSender.hpp4
-rw-r--r--src/libs/engine/Makefile.am2
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp30
-rw-r--r--src/libs/engine/OSCEngineReceiver.hpp2
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp14
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp4
-rw-r--r--src/libs/engine/events.hpp1
-rw-r--r--src/libs/engine/events/EnablePortBroadcastingEvent.cpp76
-rw-r--r--src/libs/engine/events/EnablePortBroadcastingEvent.hpp60
-rw-r--r--src/libs/engine/events/Makefile.am2
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp13
-rw-r--r--src/libs/engine/events/SetMetadataEvent.hpp1
-rw-r--r--src/libs/gui/NodeModule.cpp4
14 files changed, 16 insertions, 217 deletions
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index 4f8fcbe5..83852969 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -304,26 +304,6 @@ OSCEngineSender::set_voice_value_immediate(const string& port_path,
void
-OSCEngineSender::enable_port_broadcasting(const string& port_path)
-{
- send("/ingen/enable_port_broadcasting", "is",
- next_id(),
- port_path.c_str(),
- LO_ARGS_END);
-}
-
-
-void
-OSCEngineSender::disable_port_broadcasting(const string& port_path)
-{
- send("/ingen/disable_port_broadcasting", "is",
- next_id(),
- port_path.c_str(),
- LO_ARGS_END);
-}
-
-
-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 f94b86d5..dbb7e8f5 100644
--- a/src/libs/client/OSCEngineSender.hpp
+++ b/src/libs/client/OSCEngineSender.hpp
@@ -123,10 +123,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- void enable_port_broadcasting(const string& port_path);
-
- void disable_port_broadcasting(const string& port_path);
-
void set_program(const string& node_path,
uint32_t bank,
uint32_t program);
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 5d7cb10f..4e0ac130 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -143,8 +143,6 @@ libingen_engine_la_SOURCES = \
events/DisconnectionEvent.hpp \
events/EnablePatchEvent.cpp \
events/EnablePatchEvent.hpp \
- events/EnablePortBroadcastingEvent.cpp \
- events/EnablePortBroadcastingEvent.hpp \
events/LoadPluginsEvent.cpp \
events/LoadPluginsEvent.hpp \
events/MidiLearnEvent.cpp \
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 1078a86a..a63c826b 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -103,8 +103,6 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
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/enable_port_broadcasting", NULL, enable_port_broadcasting_cb, this);
- lo_server_add_method(_server, "/ingen/disable_port_broadcasting", NULL, disable_port_broadcasting_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);
@@ -698,34 +696,6 @@ OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
/** \page engine_osc_namespace
- * <p> \b /ingen/enable_port_broadcasting - Enable broadcasting of changing port values
- * \arg \b response-id (integer)
- * \arg \b port-path (string) - Name of port </p> \n \n
- */
-int
-OSCEngineReceiver::_enable_port_broadcasting_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* port_path = &argv[1]->s;
- enable_port_broadcasting(port_path);
- return 0;
-}
-
-
-/** \page engine_osc_namespace
- * <p> \b /ingen/disable_port_broadcasting - Enable broadcasting of changing port values
- * \arg \b response-id (integer)
- * \arg \b port-path (string) - Name of port </p> \n \n
- */
-int
-OSCEngineReceiver::_disable_port_broadcasting_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* port_path = &argv[1]->s;
- disable_port_broadcasting(port_path);
- return 0;
-}
-
-
-/** \page engine_osc_namespace
* <p> \b /ingen/note_on - Triggers a note-on, just as if it came from MIDI
* \arg \b response-id (integer)
* \arg \b node-path (string) - Patch of Node to trigger (must be a trigger or note node)
diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp
index 980e2f78..5c54ac7f 100644
--- a/src/libs/engine/OSCEngineReceiver.hpp
+++ b/src/libs/engine/OSCEngineReceiver.hpp
@@ -107,8 +107,6 @@ private:
LO_HANDLER(disconnect_all);
LO_HANDLER(set_port_value);
LO_HANDLER(set_port_value_immediate);
- LO_HANDLER(enable_port_broadcasting);
- LO_HANDLER(disable_port_broadcasting);
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 1abaf2c2..6be0bf96 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -270,20 +270,6 @@ QueuedEngineInterface::set_voice_value_immediate(const string& port_path,
void
-QueuedEngineInterface::enable_port_broadcasting(const string& port_path)
-{
- push_queued(new EnablePortBroadcastingEvent(_engine, _responder, now(), port_path, true));
-}
-
-
-void
-QueuedEngineInterface::disable_port_broadcasting(const string& port_path)
-{
- push_queued(new EnablePortBroadcastingEvent(_engine, _responder, now(), port_path, false));
-}
-
-
-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 6fea3708..17f8c75a 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -132,10 +132,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- virtual void enable_port_broadcasting(const string& port_path);
-
- virtual void disable_port_broadcasting(const string& port_path);
-
virtual void set_program(const string& node_path,
uint32_t bank,
uint32_t program);
diff --git a/src/libs/engine/events.hpp b/src/libs/engine/events.hpp
index 608bbeaa..14f5230c 100644
--- a/src/libs/engine/events.hpp
+++ b/src/libs/engine/events.hpp
@@ -31,7 +31,6 @@
#include "DisconnectAllEvent.hpp"
#include "DisconnectionEvent.hpp"
#include "EnablePatchEvent.hpp"
-#include "EnablePortBroadcastingEvent.hpp"
#include "LoadPluginsEvent.hpp"
#include "MidiLearnEvent.hpp"
#include "NoteEvent.hpp"
diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
deleted file mode 100644
index 1d3d2c9e..00000000
--- a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string>
-#include "interface/ClientInterface.hpp"
-#include "events/EnablePortBroadcastingEvent.hpp"
-#include "Responder.hpp"
-#include "Engine.hpp"
-#include "PortImpl.hpp"
-#include "EngineStore.hpp"
-#include "ClientBroadcaster.hpp"
-#include "AudioBuffer.hpp"
-
-using std::string;
-
-namespace Ingen {
-
-
-EnablePortBroadcastingEvent::EnablePortBroadcastingEvent(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const std::string& port_path,
- bool enable)
-: QueuedEvent(engine, responder, timestamp),
- _port_path(port_path),
- _port(NULL),
- _enable(enable)
-{
-}
-
-
-void
-EnablePortBroadcastingEvent::pre_process()
-{
- _port = _engine.engine_store()->find_port(_port_path);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-EnablePortBroadcastingEvent::execute(ProcessContext& context)
-{
- QueuedEvent::execute(context);
-
- if (_port)
- _port->broadcast(_enable);
-}
-
-
-void
-EnablePortBroadcastingEvent::post_process()
-{
- if (_port)
- _responder->respond_ok();
- else
- _responder->respond_error("Unable to find port for get_value responder.");
-}
-
-
-} // namespace Ingen
-
diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp b/src/libs/engine/events/EnablePortBroadcastingEvent.hpp
deleted file mode 100644
index f9bc4e98..00000000
--- a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef ENABLEPORTBROADCASTINGEVENT_H
-#define ENABLEPORTBROADCASTINGEVENT_H
-
-#include <string>
-#include "QueuedEvent.hpp"
-#include "types.hpp"
-
-using std::string;
-
-namespace Ingen {
-
-class PortImpl;
-namespace Shared { class ClientInterface; }
-using Shared::ClientInterface;
-
-
-/** Enable sending of dynamic value change notifications for a port.
- *
- * \ingroup engine
- */
-class EnablePortBroadcastingEvent : public QueuedEvent
-{
-public:
- EnablePortBroadcastingEvent(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- const std::string& port_path,
- bool enable);
-
- void pre_process();
- void execute(ProcessContext& context);
- void post_process();
-
-private:
- const std::string _port_path;
- PortImpl* _port;
- bool _enable;
-};
-
-
-} // namespace Ingen
-
-#endif // ENABLEPORTBROADCASTINGEVENT_H
diff --git a/src/libs/engine/events/Makefile.am b/src/libs/engine/events/Makefile.am
index ccb9e6db..9a8cfbd5 100644
--- a/src/libs/engine/events/Makefile.am
+++ b/src/libs/engine/events/Makefile.am
@@ -23,8 +23,6 @@ EXTRA_DIST = \
DisconnectionEvent.hpp \
EnablePatchEvent.cpp \
EnablePatchEvent.hpp \
- EnablePortBroadcastingEvent.cpp \
- EnablePortBroadcastingEvent.hpp \
LoadPluginsEvent.cpp \
LoadPluginsEvent.hpp \
MidiLearnEvent.cpp \
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index 341fa06c..6e72d57b 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -20,6 +20,7 @@
#include <boost/format.hpp>
#include "Responder.hpp"
#include "Engine.hpp"
+#include "PortImpl.hpp"
#include "ClientBroadcaster.hpp"
#include "GraphObjectImpl.hpp"
#include "EngineStore.hpp"
@@ -39,6 +40,7 @@ SetMetadataEvent::SetMetadataEvent(
const Atom& value)
: QueuedEvent(engine, responder, timestamp)
, _error(NO_ERROR)
+ , _special_type(NONE)
, _property(property)
, _path(path)
, _key(key)
@@ -67,6 +69,11 @@ SetMetadataEvent::pre_process()
_object->set_property(_key, _value);
else
_object->set_variable(_key, _value);
+
+ if (_key == "ingen:broadcast") {
+ std::cout << "BROADCAST" << std::endl;
+ _special_type = ENABLE_BROADCAST;
+ }
QueuedEvent::pre_process();
}
@@ -75,6 +82,12 @@ SetMetadataEvent::pre_process()
void
SetMetadataEvent::execute(ProcessContext& context)
{
+ if (_special_type == ENABLE_BROADCAST) {
+ PortImpl* port = dynamic_cast<PortImpl*>(_object);
+ if (port)
+ port->broadcast(_value.get_bool());
+ }
+
QueuedEvent::execute(context);
// Do nothing
}
diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp
index f6f8d3c3..6b9be81c 100644
--- a/src/libs/engine/events/SetMetadataEvent.hpp
+++ b/src/libs/engine/events/SetMetadataEvent.hpp
@@ -50,6 +50,7 @@ public:
private:
enum { NO_ERROR, INVALID_PATH } _error;
+ enum { NONE, ENABLE_BROADCAST } _special_type;
bool _property;
string _path;
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 207bdd18..21415be9 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -154,7 +154,7 @@ NodeModule::embed_gui(bool embed)
for (PortModelList::const_iterator p = _node->ports().begin();
p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
- App::instance().engine()->enable_port_broadcasting((*p)->path());
+ App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", true);
}
} else { // un-embed
@@ -164,7 +164,7 @@ NodeModule::embed_gui(bool embed)
for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
- App::instance().engine()->disable_port_broadcasting((*p)->path());
+ App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false);
}
if (embed && _embed_item) {