summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/Makefile.am8
-rw-r--r--src/libs/client/ModelEngineInterface.h1
-rw-r--r--src/libs/client/OSCClientReceiver.cpp (renamed from src/libs/client/OSCListener.cpp)62
-rw-r--r--src/libs/client/OSCClientReceiver.h (renamed from src/libs/client/OSCListener.h)19
-rw-r--r--src/libs/client/OSCEngineSender.cpp (renamed from src/libs/client/OSCEngineInterface.cpp)60
-rw-r--r--src/libs/client/OSCEngineSender.h (renamed from src/libs/client/OSCEngineInterface.h)12
-rw-r--r--src/libs/client/OSCModelEngineInterface.cpp4
-rw-r--r--src/libs/client/OSCModelEngineInterface.h13
-rw-r--r--src/libs/client/Store.cpp2
-rw-r--r--src/libs/engine/ClientBroadcaster.cpp12
-rw-r--r--src/libs/engine/Engine.cpp10
-rw-r--r--src/libs/engine/Engine.h9
-rw-r--r--src/libs/engine/EventSource.h7
-rw-r--r--src/libs/engine/JackAudioDriver.cpp50
-rw-r--r--src/libs/engine/JackAudioDriver.h2
-rw-r--r--src/libs/engine/Makefile.am8
-rw-r--r--src/libs/engine/OSCClientSender.cpp (renamed from src/libs/engine/OSCClient.cpp)51
-rw-r--r--src/libs/engine/OSCClientSender.h (renamed from src/libs/engine/OSCClient.h)16
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp (renamed from src/libs/engine/OSCReceiver.cpp)100
-rw-r--r--src/libs/engine/OSCEngineReceiver.h (renamed from src/libs/engine/OSCReceiver.h)26
-rw-r--r--src/libs/engine/QueuedEventSource.cpp36
-rw-r--r--src/libs/engine/QueuedEventSource.h9
22 files changed, 243 insertions, 274 deletions
diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am
index 01cff357..f8a9a1cf 100644
--- a/src/libs/client/Makefile.am
+++ b/src/libs/client/Makefile.am
@@ -7,12 +7,12 @@ libomclient_la_CXXFLAGS = -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir
libomclient_la_SOURCES = \
ClientInterface.h \
- OSCEngineInterface.h \
- OSCEngineInterface.cpp \
+ OSCEngineSender.h \
+ OSCEngineSender.cpp \
OSCModelEngineInterface.h \
OSCModelEngineInterface.cpp \
- OSCListener.h \
- OSCListener.cpp \
+ OSCClientReceiver.h \
+ OSCClientReceiver.cpp \
SigClientInterface.h \
DirectSigClientInterface.h \
ThreadedSigClientInterface.h \
diff --git a/src/libs/client/ModelEngineInterface.h b/src/libs/client/ModelEngineInterface.h
index 763cdc69..2bc5db14 100644
--- a/src/libs/client/ModelEngineInterface.h
+++ b/src/libs/client/ModelEngineInterface.h
@@ -31,7 +31,6 @@ namespace Client {
class NodeModel;
class PresetModel;
class PatchModel;
-class OSCListener;
class ModelClientInterface;
diff --git a/src/libs/client/OSCListener.cpp b/src/libs/client/OSCClientReceiver.cpp
index c63ffd85..56d8ea14 100644
--- a/src/libs/client/OSCListener.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -14,7 +14,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "OSCListener.h"
+#include "OSCClientReceiver.h"
//#include "NodeModel.h"
//#include "PluginModel.h"
#include <list>
@@ -27,10 +27,10 @@ namespace Ingen {
namespace Client {
-/** Construct a OSCListener with a user-provided ModelClientInterface object for notification
+/** Construct a OSCClientReceiver with a user-provided ModelClientInterface object for notification
* of engine events.
*/
-OSCListener::OSCListener(int listen_port)
+OSCClientReceiver::OSCClientReceiver(int listen_port)
: _listen_port(listen_port),
_st(NULL)//,
// _receiving_node(false),
@@ -42,14 +42,14 @@ OSCListener::OSCListener(int listen_port)
}
-OSCListener::~OSCListener()
+OSCClientReceiver::~OSCClientReceiver()
{
stop();
}
void
-OSCListener::start()
+OSCClientReceiver::start()
{
if (_st != NULL)
return;
@@ -64,10 +64,10 @@ OSCListener::start()
}
if (_st == NULL) {
- cerr << "[OSCListener] Could not start OSC listener. Aborting." << endl;
+ cerr << "[OSCClientReceiver] Could not start OSC listener. Aborting." << endl;
exit(EXIT_FAILURE);
} else {
- cout << "[OSCListener] Started OSC listener on port " << lo_server_thread_get_port(_st) << endl;
+ cout << "[OSCClientReceiver] Started OSC listener on port " << lo_server_thread_get_port(_st) << endl;
}
// FIXME
@@ -86,7 +86,7 @@ OSCListener::start()
void
-OSCListener::stop()
+OSCClientReceiver::stop()
{
if (_st != NULL) {
//unregister_client();
@@ -97,7 +97,7 @@ OSCListener::stop()
int
-OSCListener::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
+OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
{
printf("[OSCMsg] %s (%s)\t", path, types);
@@ -119,7 +119,7 @@ OSCListener::generic_cb(const char* path, const char* types, lo_arg** argv, int
void
-OSCListener::error_cb(int num, const char* msg, const char* path)
+OSCClientReceiver::error_cb(int num, const char* msg, const char* path)
{
cerr << "Got error from server: " << msg << endl;
}
@@ -127,7 +127,7 @@ OSCListener::error_cb(int num, const char* msg, const char* path)
int
-OSCListener::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
+OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
{
string msg = "Received unknown OSC message: ";
msg += path;
@@ -139,7 +139,7 @@ OSCListener::unknown_cb(const char* path, const char* types, lo_arg** argv, int
void
-OSCListener::setup_callbacks()
+OSCClientReceiver::setup_callbacks()
{
lo_server_thread_add_method(_st, "/om/num_plugins", "i", num_plugins_cb, this);
lo_server_thread_add_method(_st, "/om/plugin", "sss", plugin_cb, this);
@@ -163,7 +163,7 @@ OSCListener::setup_callbacks()
/** Catches errors that aren't a direct result of a client request.
*/
int
-OSCListener::m_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
cerr << "ERROR: " << argv[0]->s << endl;
// FIXME
@@ -173,7 +173,7 @@ OSCListener::m_error_cb(const char* path, const char* types, lo_arg** argv, int
int
-OSCListener::m_new_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_new_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
new_patch(&argv[0]->s, argv[1]->i); // path, poly
return 0;
@@ -181,7 +181,7 @@ OSCListener::m_new_patch_cb(const char* path, const char* types, lo_arg** argv,
int
-OSCListener::m_destroyed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_destroyed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
object_destroyed((const char*)&argv[0]->s);
return 0;
@@ -189,7 +189,7 @@ OSCListener::m_destroyed_cb(const char* path, const char* types, lo_arg** argv,
int
-OSCListener::m_patch_enabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_patch_enabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
patch_enabled((const char*)&argv[0]->s);
return 0;
@@ -197,7 +197,7 @@ OSCListener::m_patch_enabled_cb(const char* path, const char* types, lo_arg** ar
int
-OSCListener::m_patch_disabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_patch_disabled_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
patch_disabled((const char*)&argv[0]->s);
return 0;
@@ -205,7 +205,7 @@ OSCListener::m_patch_disabled_cb(const char* path, const char* types, lo_arg** a
int
-OSCListener::m_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
patch_cleared((const char*)&argv[0]->s);
return 0;
@@ -213,7 +213,7 @@ OSCListener::m_patch_cleared_cb(const char* path, const char* types, lo_arg** ar
int
-OSCListener::m_object_renamed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_object_renamed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
object_renamed((const char*)&argv[0]->s, (const char*)&argv[1]->s);
return 0;
@@ -221,7 +221,7 @@ OSCListener::m_object_renamed_cb(const char* path, const char* types, lo_arg** a
int
-OSCListener::m_connection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_connection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* const src_port_path = &argv[0]->s;
const char* const dst_port_path = &argv[1]->s;
@@ -233,7 +233,7 @@ OSCListener::m_connection_cb(const char* path, const char* types, lo_arg** argv,
int
-OSCListener::m_disconnection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_disconnection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* src_port_path = &argv[0]->s;
const char* dst_port_path = &argv[1]->s;
@@ -247,7 +247,7 @@ OSCListener::m_disconnection_cb(const char* path, const char* types, lo_arg** ar
/** Notification of a new node creation.
*/
int
-OSCListener::m_new_node_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_new_node_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* type = &argv[0]->s;
const char* uri = &argv[1]->s;
@@ -274,7 +274,7 @@ OSCListener::m_new_node_cb(const char* path, const char* types, lo_arg** argv, i
/** Notification of a new port creation.
*/
int
-OSCListener::m_new_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_new_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* port_path = &argv[0]->s;
const char* type = &argv[1]->s;
@@ -291,13 +291,13 @@ OSCListener::m_new_port_cb(const char* path, const char* types, lo_arg** argv, i
if (!strcmp(type, "AUDIO")) ptype = PortModel::AUDIO;
else if (!strcmp(type, "CONTROL")) ptype = PortModel::CONTROL;
else if (!strcmp(type, "MIDI")) ptype = PortModel::MIDI;
- else cerr << "[OSCListener] WARNING: Unknown port type received (" << type << ")" << endl;
+ else cerr << "[OSCClientReceiver] WARNING: Unknown port type received (" << type << ")" << endl;
#if 0
PortModel::Direction pdir = PortModel::INPUT;
if (!strcmp(direction, "INPUT")) pdir = PortModel::INPUT;
else if (!strcmp(direction, "OUTPUT")) pdir = PortModel::OUTPUT;
- else cerr << "[OSCListener] WARNING: Unknown port direction received (" << direction << ")" << endl;
+ else cerr << "[OSCClientReceiver] WARNING: Unknown port direction received (" << direction << ")" << endl;
#endif
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
@@ -334,7 +334,7 @@ OSCListener::m_new_port_cb(const char* path, const char* types, lo_arg** argv, i
/** Notification of a new or updated piece of metadata.
*/
int
-OSCListener::m_metadata_update_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_metadata_update_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* obj_path = &argv[0]->s;
const char* key = &argv[1]->s;
@@ -347,7 +347,7 @@ OSCListener::m_metadata_update_cb(const char* path, const char* types, lo_arg**
int
-OSCListener::m_control_change_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_control_change_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* const port_path = &argv[0]->s;
const float value = argv[1]->f;
@@ -362,7 +362,7 @@ OSCListener::m_control_change_cb(const char* path, const char* types, lo_arg** a
* to a /om/send_plugins
*/
int
-OSCListener::m_num_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_num_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
/** Not worth it implementing a ModelClientInterface callback for this (?)
* Or I'm just lazy. FIXME? */
@@ -375,7 +375,7 @@ OSCListener::m_num_plugins_cb(const char* path, const char* types, lo_arg** argv
/** A plugin info response from the server, in response to a /send_plugins
*/
int
-OSCListener::m_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
assert(argc == 3 && !strcmp(types, "sss"));
new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s); // type, uri
@@ -385,7 +385,7 @@ OSCListener::m_plugin_cb(const char* path, const char* types, lo_arg** argv, int
int
-OSCListener::m_program_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_program_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[0]->s;
int32_t bank = argv[1]->i;
@@ -399,7 +399,7 @@ OSCListener::m_program_add_cb(const char* path, const char* types, lo_arg** argv
int
-OSCListener::m_program_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::m_program_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[0]->s;
int32_t bank = argv[1]->i;
diff --git a/src/libs/client/OSCListener.h b/src/libs/client/OSCClientReceiver.h
index 3e9d165d..60fa9495 100644
--- a/src/libs/client/OSCListener.h
+++ b/src/libs/client/OSCClientReceiver.h
@@ -14,9 +14,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#ifndef OSCLISTENER_H
-#define OSCLISTENER_H
+#ifndef OSCCLIENTRECEIVER_H
+#define OSCCLIENTRECEIVER_H
#include <cstdlib>
#include <lo/lo.h>
@@ -39,7 +38,7 @@ namespace Client {
#define LO_HANDLER(name) \
int m_##name##_cb (LO_HANDLER_ARGS);\
inline static int name##_cb(LO_HANDLER_ARGS, void* osc_listener)\
-{ return ((OSCListener*)osc_listener)->m_##name##_cb(path, types, argv, argc, msg); }
+{ return ((OSCClientReceiver*)osc_listener)->m_##name##_cb(path, types, argv, argc, msg); }
/** Callbacks for "notification band" OSC messages.
@@ -55,11 +54,11 @@ inline static int name##_cb(LO_HANDLER_ARGS, void* osc_listener)\
*
* \ingroup IngenClient
*/
-class OSCListener : virtual public Ingen::Shared::ClientInterface
+class OSCClientReceiver : virtual public Ingen::Shared::ClientInterface
{
public:
- OSCListener(int listen_port);
- ~OSCListener();
+ OSCClientReceiver(int listen_port);
+ ~OSCClientReceiver();
void start();
void stop();
@@ -69,8 +68,8 @@ public:
private:
// Prevent copies
- OSCListener(const OSCListener& copy);
- OSCListener& operator=(const OSCListener& copy);
+ OSCClientReceiver(const OSCClientReceiver& copy);
+ OSCClientReceiver& operator=(const OSCClientReceiver& copy);
void setup_callbacks();
@@ -118,4 +117,4 @@ private:
} // namespace Ingen
-#endif // OSCLISTENER_H
+#endif // OSCCLIENTRECEIVER_H
diff --git a/src/libs/client/OSCEngineInterface.cpp b/src/libs/client/OSCEngineSender.cpp
index b747e2e4..cc70dc8e 100644
--- a/src/libs/client/OSCEngineInterface.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -14,7 +14,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "OSCEngineInterface.h"
+#include "OSCEngineSender.h"
#include "interface/ClientKey.h"
namespace Ingen {
@@ -24,7 +24,7 @@ namespace Client {
* from the most recently created server, so create the OSC listener before
* this to have it all happen on the same port. Yeah, this is a big magic :/
*/
-OSCEngineInterface::OSCEngineInterface(const string& engine_url)
+OSCEngineSender::OSCEngineSender(const string& engine_url)
: _engine_url(engine_url)
, _engine_addr(lo_address_new_from_url(engine_url.c_str()))
, _id(0)
@@ -32,7 +32,7 @@ OSCEngineInterface::OSCEngineInterface(const string& engine_url)
}
-OSCEngineInterface::~OSCEngineInterface()
+OSCEngineSender::~OSCEngineSender()
{
lo_address_free(_engine_addr);
}
@@ -48,7 +48,7 @@ OSCEngineInterface::~OSCEngineInterface()
* traversal. It is a parameter to remain compatible with EngineInterface.
*/
void
-OSCEngineInterface::register_client(ClientKey key, CountedPtr<ClientInterface> client)
+OSCEngineSender::register_client(ClientKey key, CountedPtr<ClientInterface> client)
{
// FIXME: use parameters.. er, somehow.
assert(_engine_addr);
@@ -57,7 +57,7 @@ OSCEngineInterface::register_client(ClientKey key, CountedPtr<ClientInterface> c
void
-OSCEngineInterface::unregister_client(ClientKey key)
+OSCEngineSender::unregister_client(ClientKey key)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/engine/unregister_client", "i", next_id());
@@ -67,7 +67,7 @@ OSCEngineInterface::unregister_client(ClientKey key)
// Engine commands
void
-OSCEngineInterface::load_plugins()
+OSCEngineSender::load_plugins()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/engine/load_plugins", "i", next_id());
@@ -75,7 +75,7 @@ OSCEngineInterface::load_plugins()
void
-OSCEngineInterface::activate()
+OSCEngineSender::activate()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/engine/activate", "i", next_id());
@@ -83,7 +83,7 @@ OSCEngineInterface::activate()
void
-OSCEngineInterface::deactivate()
+OSCEngineSender::deactivate()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/engine/deactivate", "i", next_id());
@@ -91,7 +91,7 @@ OSCEngineInterface::deactivate()
void
-OSCEngineInterface::quit()
+OSCEngineSender::quit()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/engine/quit", "i", next_id());
@@ -102,7 +102,7 @@ OSCEngineInterface::quit()
// Object commands
void
-OSCEngineInterface::create_patch(const string& path,
+OSCEngineSender::create_patch(const string& path,
uint32_t poly)
{
assert(_engine_addr);
@@ -114,7 +114,7 @@ OSCEngineInterface::create_patch(const string& path,
void
-OSCEngineInterface::create_port(const string& path,
+OSCEngineSender::create_port(const string& path,
const string& data_type,
bool is_output)
{
@@ -128,7 +128,7 @@ OSCEngineInterface::create_port(const string& path,
void
-OSCEngineInterface::create_node(const string& path,
+OSCEngineSender::create_node(const string& path,
const string& plugin_type,
const string& plugin_uri,
bool polyphonic)
@@ -144,7 +144,7 @@ OSCEngineInterface::create_node(const string& path,
void
-OSCEngineInterface::rename(const string& old_path,
+OSCEngineSender::rename(const string& old_path,
const string& new_name)
{
assert(_engine_addr);
@@ -156,7 +156,7 @@ OSCEngineInterface::rename(const string& old_path,
void
-OSCEngineInterface::destroy(const string& path)
+OSCEngineSender::destroy(const string& path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/destroy", "is",
@@ -166,7 +166,7 @@ OSCEngineInterface::destroy(const string& path)
void
-OSCEngineInterface::clear_patch(const string& patch_path)
+OSCEngineSender::clear_patch(const string& patch_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/clear_patch", "is",
@@ -176,7 +176,7 @@ OSCEngineInterface::clear_patch(const string& patch_path)
void
-OSCEngineInterface::enable_patch(const string& patch_path)
+OSCEngineSender::enable_patch(const string& patch_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/enable_patch", "is",
@@ -186,7 +186,7 @@ OSCEngineInterface::enable_patch(const string& patch_path)
void
-OSCEngineInterface::disable_patch(const string& patch_path)
+OSCEngineSender::disable_patch(const string& patch_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/disable_patch", "is",
@@ -196,7 +196,7 @@ OSCEngineInterface::disable_patch(const string& patch_path)
void
-OSCEngineInterface::connect(const string& src_port_path,
+OSCEngineSender::connect(const string& src_port_path,
const string& dst_port_path)
{
assert(_engine_addr);
@@ -208,7 +208,7 @@ OSCEngineInterface::connect(const string& src_port_path,
void
-OSCEngineInterface::disconnect(const string& src_port_path,
+OSCEngineSender::disconnect(const string& src_port_path,
const string& dst_port_path)
{
assert(_engine_addr);
@@ -220,7 +220,7 @@ OSCEngineInterface::disconnect(const string& src_port_path,
void
-OSCEngineInterface::disconnect_all(const string& node_path)
+OSCEngineSender::disconnect_all(const string& node_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/disconnect_all", "is",
@@ -230,7 +230,7 @@ OSCEngineInterface::disconnect_all(const string& node_path)
void
-OSCEngineInterface::set_port_value(const string& port_path,
+OSCEngineSender::set_port_value(const string& port_path,
float val)
{
assert(_engine_addr);
@@ -242,7 +242,7 @@ OSCEngineInterface::set_port_value(const string& port_path,
void
-OSCEngineInterface::set_port_value(const string& port_path,
+OSCEngineSender::set_port_value(const string& port_path,
uint32_t voice,
float val)
{
@@ -256,7 +256,7 @@ OSCEngineInterface::set_port_value(const string& port_path,
void
-OSCEngineInterface::set_port_value_queued(const string& port_path,
+OSCEngineSender::set_port_value_queued(const string& port_path,
float val)
{
assert(_engine_addr);
@@ -268,7 +268,7 @@ OSCEngineInterface::set_port_value_queued(const string& port_path,
void
-OSCEngineInterface::set_program(const string& node_path,
+OSCEngineSender::set_program(const string& node_path,
uint32_t bank,
uint32_t program)
{
@@ -282,7 +282,7 @@ OSCEngineInterface::set_program(const string& node_path,
void
-OSCEngineInterface::midi_learn(const string& node_path)
+OSCEngineSender::midi_learn(const string& node_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/synth/midi_learn", "is",
@@ -292,7 +292,7 @@ OSCEngineInterface::midi_learn(const string& node_path)
void
-OSCEngineInterface::set_metadata(const string& obj_path,
+OSCEngineSender::set_metadata(const string& obj_path,
const string& predicate,
const string& value)
{
@@ -308,7 +308,7 @@ OSCEngineInterface::set_metadata(const string& obj_path,
// Requests //
void
-OSCEngineInterface::ping()
+OSCEngineSender::ping()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/ping", "i", next_id());
@@ -316,7 +316,7 @@ OSCEngineInterface::ping()
void
-OSCEngineInterface::request_port_value(const string& port_path)
+OSCEngineSender::request_port_value(const string& port_path)
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/request/port_value", "is",
@@ -326,7 +326,7 @@ OSCEngineInterface::request_port_value(const string& port_path)
void
-OSCEngineInterface::request_plugins()
+OSCEngineSender::request_plugins()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/request/plugins", "i", next_id());
@@ -334,7 +334,7 @@ OSCEngineInterface::request_plugins()
void
-OSCEngineInterface::request_all_objects()
+OSCEngineSender::request_all_objects()
{
assert(_engine_addr);
lo_send(_engine_addr, "/om/request/all_objects", "i", next_id());
diff --git a/src/libs/client/OSCEngineInterface.h b/src/libs/client/OSCEngineSender.h
index 4405438c..184c0569 100644
--- a/src/libs/client/OSCEngineInterface.h
+++ b/src/libs/client/OSCEngineSender.h
@@ -14,8 +14,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef OSCENGINEINTERFACE_H
-#define OSCENGINEINTERFACE_H
+#ifndef OSCENGINESENDER_H
+#define OSCENGINESENDER_H
#include <inttypes.h>
#include <string>
@@ -37,12 +37,12 @@ namespace Client {
*
* \ingroup IngenClient
*/
-class OSCEngineInterface : public EngineInterface
+class OSCEngineSender : public EngineInterface
{
public:
- OSCEngineInterface(const string& engine_url);
+ OSCEngineSender(const string& engine_url);
- ~OSCEngineInterface();
+ ~OSCEngineSender();
string engine_url() { return _engine_url; }
@@ -141,5 +141,5 @@ protected:
} // namespace Client
} // namespace Ingen
-#endif // OSCENGINEINTERFACE_H
+#endif // OSCENGINESENDER_H
diff --git a/src/libs/client/OSCModelEngineInterface.cpp b/src/libs/client/OSCModelEngineInterface.cpp
index 2e831705..14f2fe3a 100644
--- a/src/libs/client/OSCModelEngineInterface.cpp
+++ b/src/libs/client/OSCModelEngineInterface.cpp
@@ -21,7 +21,7 @@
#include <cstring>
#include <iostream>
#include <unistd.h>
-#include "OSCListener.h"
+#include "OSCClientReceiver.h"
#include "PatchModel.h"
#include "ConnectionModel.h"
#include "PresetModel.h"
@@ -39,7 +39,7 @@ namespace Client {
* of engine events.
*/
OSCModelEngineInterface::OSCModelEngineInterface(const string& engine_url)
-: OSCEngineInterface(engine_url),
+: OSCEngineSender(engine_url),
m_request_id(0),
m_is_attached(false),
m_is_registered(false)
diff --git a/src/libs/client/OSCModelEngineInterface.h b/src/libs/client/OSCModelEngineInterface.h
index a2172e23..f600fb8f 100644
--- a/src/libs/client/OSCModelEngineInterface.h
+++ b/src/libs/client/OSCModelEngineInterface.h
@@ -21,7 +21,7 @@
#include <lo/lo.h>
#include "util/Semaphore.h"
#include "interface/EngineInterface.h"
-#include "OSCEngineInterface.h"
+#include "OSCEngineSender.h"
#include "ModelEngineInterface.h"
using std::string;
@@ -34,29 +34,22 @@ namespace Client {
class NodeModel;
class PresetModel;
class PatchModel;
-class OSCListener;
class ModelClientInterface;
/** Old model-based OSC engine command interface.
*
* This is an old class from before when the well-defined interfaces between
- * engine and client were defined. I've wrapped it around OSCEngineInterface
+ * engine and client were defined. I've wrapped it around OSCEngineSender
* so all the common functions are implemented there, and implemented the
* remaining functions using those, for compatibility. Hopefully something
* better gets figured out and this can go away completely, but for now this
* gets the existing clients working through EngineInterface in the easiest
* way possible. This class needs to die.
*
- * Old comment:
- * Handles all OSC communication on the "control band". For the time being,
- * manages the OSCListener which handles the "notification band", but this
- * will change in the future (for complete separation). See OSC namespace
- * documentation for more details.
- *
* \ingroup IngenClient
*/
-class OSCModelEngineInterface : public OSCEngineInterface, public ModelEngineInterface
+class OSCModelEngineInterface : public OSCEngineSender, public ModelEngineInterface
{
public:
//OSCModelEngineInterface(ModelClientInterface* const client_hooks, const string& engine_url);
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index 403264f2..219ea13f 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -297,7 +297,7 @@ Store::new_port_event(const string& path, const string& type, bool is_output)
if (type == "AUDIO") ptype = PortModel::AUDIO;
else if (type == "CONTROL") ptype = PortModel::CONTROL;
else if (type== "MIDI") ptype = PortModel::MIDI;
- else cerr << "[OSCListener] WARNING: Unknown port type received (" << type << ")" << endl;
+ else cerr << "[Store] WARNING: Unknown port type received (" << type << ")" << endl;
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp
index 1fa64d9a..355d4232 100644
--- a/src/libs/engine/ClientBroadcaster.cpp
+++ b/src/libs/engine/ClientBroadcaster.cpp
@@ -30,7 +30,7 @@
#include "ObjectSender.h"
#include "interface/ClientKey.h"
#include "interface/ClientInterface.h"
-#include "OSCClient.h"
+#include "OSCClientSender.h"
using std::cout; using std::cerr; using std::endl;
using Ingen::Shared::ClientInterface;
@@ -137,6 +137,10 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client, const list<Plugin*>&
const Plugin* plugin;
+ // FIXME FIXME FIXME
+ OSCClientSender* osc_client = dynamic_cast<OSCClientSender*>(client);
+ assert(osc_client);
+
lo_timetag tt;
lo_timetag_now(&tt);
lo_bundle b = lo_bundle_new(tt);
@@ -157,16 +161,14 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client, const list<Plugin*>&
lo_bundle_add_message(b, "/om/plugin", m);
msgs.push_back(m);
if (lo_bundle_length(b) > 1024) {
- // FIXME FIXME FIXME dirty, dirty cast
- lo_send_bundle(((OSCClient*)client)->address(), b);
+ lo_send_bundle(osc_client->address(), b);
lo_bundle_free(b);
b = lo_bundle_new(tt);
}
}
if (lo_bundle_length(b) > 0) {
- // FIXME FIXME FIXME dirty, dirty cast
- lo_send_bundle(((OSCClient*)client)->address(), b);
+ lo_send_bundle(osc_client->address(), b);
lo_bundle_free(b);
} else {
lo_bundle_free(b);
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp
index a98f4fbf..ebe8e4f7 100644
--- a/src/libs/engine/Engine.cpp
+++ b/src/libs/engine/Engine.cpp
@@ -24,7 +24,6 @@
#include "util/Queue.h"
#include "JackAudioDriver.h"
#include "NodeFactory.h"
-#include "OSCReceiver.h"
#include "ClientBroadcaster.h"
#include "Patch.h"
#include "ObjectStore.h"
@@ -49,9 +48,9 @@ using std::cout; using std::cerr; using std::endl;
namespace Ingen {
-Engine::Engine(const char* listen_port, AudioDriver* audio_driver)
-: m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver(*this) ),
- m_osc_receiver(new OSCReceiver(*this, pre_processor_queue_size, listen_port)),
+Engine::Engine(AudioDriver* audio_driver)
+: m_event_source(NULL),
+ m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver(*this) ),
#ifdef HAVE_JACK_MIDI
m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())),
#elif HAVE_ALSA_MIDI
@@ -72,7 +71,6 @@ Engine::Engine(const char* listen_port, AudioDriver* audio_driver)
m_quit_flag(false),
m_activated(false)
{
- m_osc_receiver->activate();
}
@@ -88,7 +86,6 @@ Engine::~Engine()
delete m_object_store;
delete m_client_broadcaster;
- delete m_osc_receiver;
delete m_node_factory;
delete m_midi_driver;
delete m_audio_driver;
@@ -183,7 +180,6 @@ Engine::deactivate()
if (m_midi_driver != NULL)
m_midi_driver->deactivate();
- m_osc_receiver->deactivate();
m_audio_driver->deactivate();
// Finalize any lingering events (unlikely)
diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h
index fbad649f..35192bb5 100644
--- a/src/libs/engine/Engine.h
+++ b/src/libs/engine/Engine.h
@@ -27,7 +27,6 @@ namespace Ingen {
class AudioDriver;
class MidiDriver;
class NodeFactory;
-class OSCReceiver;
class ClientBroadcaster;
class Patch;
class ObjectStore;
@@ -51,7 +50,7 @@ template <typename T> class Driver;
class Engine
{
public:
- Engine(const char* listen_port, AudioDriver* audio_driver = 0);
+ Engine(AudioDriver* audio_driver = 0);
~Engine();
int main();
@@ -63,8 +62,10 @@ public:
void activate();
void deactivate();
+ void set_event_source(EventSource* es) { m_event_source = es; }
+
+ EventSource* event_source() const { return m_event_source; }
AudioDriver* audio_driver() const { return m_audio_driver; }
- OSCReceiver* osc_receiver() const { return m_osc_receiver; }
MidiDriver* midi_driver() const { return m_midi_driver; }
Maid* maid() const { return m_maid; }
PostProcessor* post_processor() const { return m_post_processor; }
@@ -81,8 +82,8 @@ private:
Engine(const Engine&);
Engine& operator=(const Engine&);
+ EventSource* m_event_source;
AudioDriver* m_audio_driver;
- OSCReceiver* m_osc_receiver;
MidiDriver* m_midi_driver;
Maid* m_maid;
PostProcessor* m_post_processor;
diff --git a/src/libs/engine/EventSource.h b/src/libs/engine/EventSource.h
index 212249c6..d251cac5 100644
--- a/src/libs/engine/EventSource.h
+++ b/src/libs/engine/EventSource.h
@@ -17,10 +17,13 @@
#ifndef EVENTSOURCE_H
#define EVENTSOURCE_H
+#include "types.h"
+
namespace Ingen {
class Event;
class QueuedEvent;
+class PostProcessor;
/** Source for events to run in the audio thread.
@@ -41,9 +44,7 @@ public:
virtual ~EventSource() {}
- virtual Event* pop_earliest_queued_before(const SampleCount time) = 0;
-
- virtual Event* pop_earliest_stamped_before(const SampleCount time) = 0;
+ virtual void process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end) = 0;
protected:
EventSource() {}
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 2c0d4a70..66a16d51 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -24,7 +24,6 @@
#include "Event.h"
#include "QueuedEvent.h"
#include "EventSource.h"
-#include "OSCReceiver.h"
#include "PostProcessor.h"
#include "util/Queue.h"
#include "Node.h"
@@ -33,6 +32,7 @@
#include "MidiDriver.h"
#include "List.h"
#include "DuplexPort.h"
+#include "EventSource.h"
#ifdef HAVE_LASH
#include "LashDriver.h"
#endif
@@ -181,8 +181,6 @@ void
JackAudioDriver::deactivate()
{
if (_is_activated) {
- _engine.osc_receiver()->deactivate();
-
jack_deactivate(_client);
_is_activated = false;
@@ -242,48 +240,6 @@ JackAudioDriver::create_port(DuplexPort<Sample>* patch_port)
}
-/** Process all the pending events for this cycle.
- *
- * Called from the realtime thread once every process cycle.
- */
-void
-JackAudioDriver::process_events(SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end)
-{
- Event* ev = NULL;
-
- /* Limit the maximum number of queued events to process per cycle. This
- * makes the process callback (more) realtime-safe by preventing being
- * choked by events coming in faster than they can be processed.
- * FIXME: run the math on this and figure out a good value */
- const unsigned int MAX_QUEUED_EVENTS = _buffer_size / 100;
-
- unsigned int num_events_processed = 0;
-
- // Process the "slow" events first, because it's possible some of the
- // RT events depend on them
-
- /* FIXME: Merge these next two loops into one */
-
- // FIXME
- while ((ev = _engine.osc_receiver()->pop_earliest_queued_before(cycle_end))) {
- ev->execute(nframes, cycle_start, cycle_end);
- _engine.post_processor()->push(ev);
- if (++num_events_processed > MAX_QUEUED_EVENTS)
- break;
- }
-
- while ((ev = _engine.osc_receiver()->pop_earliest_stamped_before(cycle_end))) {
- ev->execute(nframes, cycle_start, cycle_end);
- _engine.post_processor()->push(ev);
- ++num_events_processed;
- }
-
- if (num_events_processed > 0)
- _engine.post_processor()->whip();
-}
-
-
-
/**** Jack Callbacks ****/
@@ -313,7 +269,9 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
_transport_state = jack_transport_query(_client, &_position);
- process_events(nframes, start_of_last_cycle, start_of_current_cycle);
+ if (_engine.event_source())
+ _engine.event_source()->process(*_engine.post_processor(), nframes, start_of_last_cycle, start_of_current_cycle);
+
_engine.midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle);
// Set buffers of patch ports to Jack port buffers (zero-copy processing)
diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h
index aa0cebbc..072434b9 100644
--- a/src/libs/engine/JackAudioDriver.h
+++ b/src/libs/engine/JackAudioDriver.h
@@ -84,8 +84,6 @@ public:
void enable();
void disable();
- void process_events(SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end);
-
DriverPort* create_port(DuplexPort<Sample>* patch_port);
Patch* root_patch() { return _root_patch; }
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index bc2560eb..1f3b4d45 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -23,8 +23,8 @@ libingen_la_SOURCES = \
Engine.cpp \
JackAudioDriver.h \
JackAudioDriver.cpp \
- OSCReceiver.h \
- OSCReceiver.cpp \
+ OSCEngineReceiver.h \
+ OSCEngineReceiver.cpp \
Responder.h \
OSCResponder.h \
OSCResponder.cpp \
@@ -33,8 +33,8 @@ libingen_la_SOURCES = \
ClientBroadcaster.cpp \
ObjectSender.h \
ObjectSender.cpp \
- OSCClient.h \
- OSCClient.cpp \
+ OSCClientSender.h \
+ OSCClientSender.cpp \
Buffer.h \
Buffer.cpp \
Port.h \
diff --git a/src/libs/engine/OSCClient.cpp b/src/libs/engine/OSCClientSender.cpp
index acc56cdf..d6f56e74 100644
--- a/src/libs/engine/OSCClient.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -14,7 +14,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "OSCClient.h"
+#include "OSCClientSender.h"
#include <cassert>
#include <iostream>
#include <unistd.h>
@@ -92,7 +92,7 @@ namespace Ingen {
* user command, ie "unexpected" errors.</p> \n \n
*/
void
-OSCClient::error(const string& msg)
+OSCClientSender::error(const string& msg)
{
lo_send(_address, "/om/error", "s", msg.c_str());
}
@@ -113,7 +113,7 @@ OSCClient::error(const string& msg)
* of how many plugins (/om/plugin messages) to expect.</p> \n \n
*/
void
-OSCClient::num_plugins(uint32_t num)
+OSCClientSender::num_plugins(uint32_t num)
{
lo_message m = lo_message_new();
lo_message_add_int32(m, num);
@@ -132,7 +132,7 @@ OSCClient::num_plugins(uint32_t num)
*/
/*
void
-OSCClient::plugins()
+OSCClientSender::plugins()
{
Engine::instance().node_factory()->lock_plugin_list();
@@ -189,7 +189,7 @@ OSCClient::plugins()
* this one (/om/new_node), followed by a series of /om/new_port commands,
* followed by /om/new_node_end. </p> \n \n
*/
-void OSCClient::new_node(const string& plugin_type,
+void OSCClientSender::new_node(const string& plugin_type,
const string& plugin_uri,
const string& node_path,
bool is_polyphonic,
@@ -301,7 +301,7 @@ void OSCClient::new_node(const string& plugin_type,
* as metadata.</p> \n \n
*/
void
-OSCClient::new_port(const string& path,
+OSCClientSender::new_port(const string& path,
const string& data_type,
bool is_output)
{
@@ -321,7 +321,7 @@ OSCClient::new_port(const string& path,
* \arg \b path (string) - Path of object (which no longer exists) </p> \n \n
*/
void
-OSCClient::object_destroyed(const string& path)
+OSCClientSender::object_destroyed(const string& path)
{
assert(path != "/");
@@ -334,7 +334,7 @@ OSCClient::object_destroyed(const string& path)
* \arg \b path (string) - Path of patch (which is now empty)</p> \n \n
*/
void
-OSCClient::patch_cleared(const string& patch_path)
+OSCClientSender::patch_cleared(const string& patch_path)
{
lo_send(_address, "/om/patch_cleared", "s", patch_path.c_str());
}
@@ -345,7 +345,7 @@ OSCClient::patch_cleared(const string& patch_path)
* \arg \b path (string) - Path of enabled patch</p> \n \n
*/
void
-OSCClient::patch_enabled(const string& patch_path)
+OSCClientSender::patch_enabled(const string& patch_path)
{
lo_send(_address, "/om/patch_enabled", "s", patch_path.c_str());
}
@@ -356,7 +356,7 @@ OSCClient::patch_enabled(const string& patch_path)
* \arg \b path (string) - Path of disabled patch</p> \n \n
*/
void
-OSCClient::patch_disabled(const string& patch_path)
+OSCClientSender::patch_disabled(const string& patch_path)
{
lo_send(_address, "/om/patch_disabled", "s", patch_path.c_str());
}
@@ -368,7 +368,7 @@ OSCClient::patch_disabled(const string& patch_path)
* \arg \b dst-path (string) - Path of the destination port</p> \n \n
*/
void
-OSCClient::connection(const string& src_port_path, const string& dst_port_path)
+OSCClientSender::connection(const string& src_port_path, const string& dst_port_path)
{
lo_send(_address, "/om/new_connection", "ss", src_port_path.c_str(), dst_port_path.c_str());
}
@@ -380,7 +380,7 @@ OSCClient::connection(const string& src_port_path, const string& dst_port_path)
* \arg \b dst-path (string) - Path of the destination port</p> \n \n
*/
void
-OSCClient::disconnection(const string& src_port_path, const string& dst_port_path)
+OSCClientSender::disconnection(const string& src_port_path, const string& dst_port_path)
{
lo_send(_address, "/om/disconnection", "ss", src_port_path.c_str(), dst_port_path.c_str());
}
@@ -393,7 +393,7 @@ OSCClient::disconnection(const string& src_port_path, const string& dst_port_pat
* \arg \b value (string)</p> \n \n
*/
void
-OSCClient::metadata_update(const string& path, const string& key, const string& value)
+OSCClientSender::metadata_update(const string& path, const string& key, const string& value)
{
lo_send(_address, "/om/metadata/update", "sss", path.c_str(), key.c_str(), value.c_str());
}
@@ -408,7 +408,7 @@ OSCClient::metadata_update(const string& path, const string& key, const string&
* changing because of connections to other ports!</p> \n \n
*/
void
-OSCClient::control_change(const string& port_path, float value)
+OSCClientSender::control_change(const string& port_path, float value)
{
lo_send(_address, "/om/control_change", "sf", port_path.c_str(), value);
}
@@ -421,7 +421,7 @@ OSCClient::control_change(const string& port_path, float value)
* \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope")
*/
void
-OSCClient::new_plugin(const string& type, const string& uri, const string& name)
+OSCClientSender::new_plugin(const string& type, const string& uri, const string& name)
{
lo_message m = lo_message_new();
lo_message_add_string(m, type.c_str());
@@ -437,7 +437,7 @@ OSCClient::new_plugin(const string& type, const string& uri, const string& name)
* \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node) </p> \n \n
*/
void
-OSCClient::new_patch(const string& path, uint32_t poly)
+OSCClientSender::new_patch(const string& path, uint32_t poly)
{
lo_send(_address, "/om/new_patch", "si", path.c_str(), poly);
@@ -460,29 +460,16 @@ OSCClient::new_patch(const string& path, uint32_t poly)
* \arg \b new-path (string) - New path of object </p> \n \n
*/
void
-OSCClient::object_renamed(const string& old_path, const string& new_path)
+OSCClientSender::object_renamed(const string& old_path, const string& new_path)
{
lo_send(_address, "/om/object_renamed", "ss", old_path.c_str(), new_path.c_str());
}
-/** Sends all GraphObjects known to the engine.
- */
-/*
-void
-OSCClient::all_objects()
-{
- for (Tree<GraphObject*>::iterator i = Engine::instance().object_store()->objects().begin();
- i != Engine::instance().object_store()->objects().end(); ++i)
- if ((*i)->as_node() != NULL && (*i)->parent() == NULL)
- (*i)->as_node()->send_creation_messages(this);
-}
-*/
-
/** Sends information about a program associated with a DSSI plugin node.
*/
void
-OSCClient::program_add(const string& node_path, uint32_t bank, uint32_t program, const string& name)
+OSCClientSender::program_add(const string& node_path, uint32_t bank, uint32_t program, const string& name)
{
lo_send(_address, "/om/program_add", "siis",
node_path.c_str(), bank, program, name.c_str());
@@ -490,7 +477,7 @@ OSCClient::program_add(const string& node_path, uint32_t bank, uint32_t program,
void
-OSCClient::program_remove(const string& node_path, uint32_t bank, uint32_t program)
+OSCClientSender::program_remove(const string& node_path, uint32_t bank, uint32_t program)
{
lo_send(_address, "/om/program_remove", "sii",
node_path.c_str(), bank, program);
diff --git a/src/libs/engine/OSCClient.h b/src/libs/engine/OSCClientSender.h
index 423bb32f..1826a36d 100644
--- a/src/libs/engine/OSCClient.h
+++ b/src/libs/engine/OSCClientSender.h
@@ -14,8 +14,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef OSCCLIENT_H
-#define OSCCLIENT_H
+#ifndef OSCCLIENTSENDER_H
+#define OSCCLIENTSENDER_H
#include <string>
#include <iostream>
@@ -35,15 +35,15 @@ namespace Ingen {
*
* \ingroup engine
*/
-class OSCClient : public Shared::ClientInterface
+class OSCClientSender : public Shared::ClientInterface
{
public:
- OSCClient(const string& url)
+ OSCClientSender(const string& url)
: _url(url),
_address(lo_address_new_from_url(url.c_str()))
{}
- virtual ~OSCClient()
+ virtual ~OSCClientSender()
{ lo_address_free(_address); }
const string& url() const { return _url; }
@@ -117,8 +117,8 @@ public:
private:
// Prevent copies (undefined)
- OSCClient(const OSCClient&);
- OSCClient& operator=(const OSCClient&);
+ OSCClientSender(const OSCClientSender&);
+ OSCClientSender& operator=(const OSCClientSender&);
string _url;
lo_address _address;
@@ -127,5 +127,5 @@ private:
} // namespace Ingen
-#endif // OSCCLIENT_H
+#endif // OSCCLIENTSENDER_H
diff --git a/src/libs/engine/OSCReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 5c08c17a..4b1ae496 100644
--- a/src/libs/engine/OSCReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -14,7 +14,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "OSCReceiver.h"
+#include "OSCEngineReceiver.h"
#include <iostream>
#include <cstdlib>
#include <string>
@@ -25,7 +25,7 @@
#include "QueuedEventSource.h"
#include "interface/ClientKey.h"
#include "interface/ClientInterface.h"
-#include "OSCClient.h"
+#include "OSCClientSender.h"
#include "OSCResponder.h"
#include "ClientBroadcaster.h"
@@ -47,7 +47,7 @@ using Shared::ClientKey;
*/
-OSCReceiver::OSCReceiver(Engine& engine, size_t queue_size, const char* const port)
+OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, const char* const port)
: QueuedEngineInterface(engine, queue_size, queue_size), // FIXME
_port(port),
_server(NULL),
@@ -122,7 +122,7 @@ OSCReceiver::OSCReceiver(Engine& engine, size_t queue_size, const char* const po
}
-OSCReceiver::~OSCReceiver()
+OSCEngineReceiver::~OSCEngineReceiver()
{
deactivate();
@@ -134,18 +134,18 @@ OSCReceiver::~OSCReceiver()
void
-OSCReceiver::activate()
+OSCEngineReceiver::activate()
{
- set_name("OSCReceiver");
+ set_name("OSCEngineReceiver");
QueuedEventSource::activate();
set_scheduling(SCHED_FIFO, 10);
}
void
-OSCReceiver::deactivate()
+OSCEngineReceiver::deactivate()
{
- cout << "[OSCReceiver] Stopped OSC listening thread" << endl;
+ cout << "[OSCEngineReceiver] Stopped OSC listening thread" << endl;
QueuedEventSource::deactivate();
}
@@ -154,7 +154,7 @@ OSCReceiver::deactivate()
* to wait on OSC messages and prepare them right away in the same thread.
*/
void
-OSCReceiver::_run()
+OSCEngineReceiver::_run()
{
/* get a timestamp here and stamp all the events with the same time so
* they all get executed in the same cycle */
@@ -194,9 +194,9 @@ OSCReceiver::_run()
* working around the fact that liblo addresses really suck. Oh well.
*/
int
-OSCReceiver::set_response_address_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
+OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
{
- OSCReceiver* const me = reinterpret_cast<OSCReceiver*>(user_data);
+ OSCEngineReceiver* const me = reinterpret_cast<OSCEngineReceiver*>(user_data);
//cerr << "SET RESPONSE\n";
@@ -249,7 +249,7 @@ OSCReceiver::set_response_address_cb(const char* path, const char* types, lo_arg
void
-OSCReceiver::error_cb(int num, const char* msg, const char* path)
+OSCEngineReceiver::error_cb(int num, const char* msg, const char* path)
{
cerr << "liblo server error " << num << " in path \"" << "\" - " << msg << endl;
}
@@ -260,7 +260,7 @@ OSCReceiver::error_cb(int num, const char* msg, const char* path)
* \arg \b response-id (integer) </p> \n \n
*/
int
-OSCReceiver::m_ping_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_ping_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
_responder->respond_ok();
return 0;
@@ -277,7 +277,7 @@ OSCReceiver::m_ping_cb(const char* path, const char* types, lo_arg** argv, int a
* finished processing.</p> \n \n
*/
int
-OSCReceiver::m_ping_slow_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_ping_slow_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
ping();
return 0;
@@ -293,7 +293,7 @@ OSCReceiver::m_ping_slow_cb(const char* path, const char* types, lo_arg** argv,
* 10 messages would never get executed. </p> \n \n
*/
int
-OSCReceiver::m_quit_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_quit_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
quit();
@@ -308,12 +308,12 @@ OSCReceiver::m_quit_cb(const char* path, const char* types, lo_arg** argv, int a
* want to register a different specific address, use the URL version.
*/
int
-OSCReceiver::m_register_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_register_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
lo_address addr = lo_message_get_source(msg);
char* const url = lo_address_get_url(addr);
- CountedPtr<ClientInterface> client(new OSCClient((const char*)url));
+ CountedPtr<ClientInterface> client(new OSCClientSender((const char*)url));
register_client(ClientKey(ClientKey::OSC_URL, (const char*)url), client);
free(url);
@@ -326,7 +326,7 @@ OSCReceiver::m_register_client_cb(const char* path, const char* types, lo_arg**
* \arg \b response-id (integer) </p> \n \n
*/
int
-OSCReceiver::m_unregister_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_unregister_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
lo_address addr = lo_message_get_source(msg);
@@ -343,7 +343,7 @@ OSCReceiver::m_unregister_client_cb(const char* path, const char* types, lo_arg*
* \arg \b response-id (integer) </p> \n \n
*/
int
-OSCReceiver::m_load_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_load_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
load_plugins();
return 0;
@@ -358,7 +358,7 @@ OSCReceiver::m_load_plugins_cb(const char* path, const char* types, lo_arg** arg
* anything at all - <em>including respond to your messages!</em> \n \n
*/
int
-OSCReceiver::m_engine_activate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_engine_activate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
QueuedEngineInterface::activate();
return 0;
@@ -370,7 +370,7 @@ OSCReceiver::m_engine_activate_cb(const char* path, const char* types, lo_arg**
* \arg \b response-id (integer) </p> \n \n
*/
int
-OSCReceiver::m_engine_deactivate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_engine_deactivate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
QueuedEngineInterface::deactivate();
return 0;
@@ -384,7 +384,7 @@ OSCReceiver::m_engine_deactivate_cb(const char* path, const char* types, lo_arg*
* \arg \b poly (integer) - Patch's (internal) polyphony </p> \n \n
*/
int
-OSCReceiver::m_create_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_create_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* patch_path = &argv[1]->s;
const int poly = argv[2]->i;
@@ -401,7 +401,7 @@ OSCReceiver::m_create_patch_cb(const char* path, const char* types, lo_arg** arg
* \arg \b name - New name for object </p> \n \n
*/
int
-OSCReceiver::m_rename_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_rename_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* object_path = &argv[1]->s;
const char* name = &argv[2]->s;
@@ -417,7 +417,7 @@ OSCReceiver::m_rename_cb(const char* path, const char* types, lo_arg** argv, int
* \arg \b patch-path - Patch's path
*/
int
-OSCReceiver::m_enable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_enable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* patch_path = &argv[1]->s;
@@ -432,7 +432,7 @@ OSCReceiver::m_enable_patch_cb(const char* path, const char* types, lo_arg** arg
* \arg \b patch-path - Patch's path
*/
int
-OSCReceiver::m_disable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_disable_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* patch_path = &argv[1]->s;
@@ -447,7 +447,7 @@ OSCReceiver::m_disable_patch_cb(const char* path, const char* types, lo_arg** ar
* \arg \b patch-path - Patch's path
*/
int
-OSCReceiver::m_clear_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_clear_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* patch_path = &argv[1]->s;
@@ -464,7 +464,7 @@ OSCReceiver::m_clear_patch_cb(const char* path, const char* types, lo_arg** argv
* \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1) </p> \n \n
*/
int
-OSCReceiver::m_create_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_create_port_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* port_path = &argv[1]->s;
const char* data_type = &argv[2]->s;
@@ -483,7 +483,7 @@ OSCReceiver::m_create_port_cb(const char* path, const char* types, lo_arg** argv
* \arg \b poly (integer-boolean) - Whether node is polyphonic (0 = false, 1 = true) </p> \n \n
*/
int
-OSCReceiver::m_create_node_by_uri_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_create_node_by_uri_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
const char* type = &argv[2]->s;
@@ -511,7 +511,7 @@ OSCReceiver::m_create_node_by_uri_cb(const char* path, const char* types, lo_arg
* </p> \n \n
*/
int
-OSCReceiver::m_create_node_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_create_node_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
const char* type = &argv[2]->s;
@@ -530,7 +530,7 @@ OSCReceiver::m_create_node_cb(const char* path, const char* types, lo_arg** argv
* \arg \b node-path (string) - Full path of the object </p> \n \n
*/
int
-OSCReceiver::m_destroy_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_destroy_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
@@ -546,7 +546,7 @@ OSCReceiver::m_destroy_cb(const char* path, const char* types, lo_arg** argv, in
* \arg \b dst-port-path (string) - Full path of destination port </p> \n \n
*/
int
-OSCReceiver::m_connect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_connect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* src_port_path = &argv[1]->s;
const char* dst_port_path = &argv[2]->s;
@@ -563,7 +563,7 @@ OSCReceiver::m_connect_cb(const char* path, const char* types, lo_arg** argv, in
* \arg \b dst-port-path (string) - Full path of destination port </p> \n \n
*/
int
-OSCReceiver::m_disconnect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_disconnect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* src_port_path = &argv[1]->s;
const char* dst_port_path = &argv[2]->s;
@@ -579,7 +579,7 @@ OSCReceiver::m_disconnect_cb(const char* path, const char* types, lo_arg** argv,
* \arg \b node-path (string) - Full path of node. </p> \n \n
*/
int
-OSCReceiver::m_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
@@ -595,7 +595,7 @@ OSCReceiver::m_disconnect_all_cb(const char* path, const char* types, lo_arg** a
* \arg \b value (float) - Value to set port to
*/
int
-OSCReceiver::m_set_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_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;
@@ -613,7 +613,7 @@ OSCReceiver::m_set_port_value_cb(const char* path, const char* types, lo_arg** a
* \arg \b value (float) - Value to set port to
*/
int
-OSCReceiver::m_set_port_value_voice_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_set_port_value_voice_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* port_path = &argv[1]->s;
const int voice = argv[2]->i;
@@ -635,7 +635,7 @@ OSCReceiver::m_set_port_value_voice_cb(const char* path, const char* types, lo_a
* slow event and arrive out of order). </p> \n \n
*/
int
-OSCReceiver::m_set_port_value_slow_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_set_port_value_slow_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;
@@ -653,7 +653,7 @@ OSCReceiver::m_set_port_value_slow_cb(const char* path, const char* types, lo_ar
* \arg \b velocity (int) - MIDI style velocity (0-127)</p> \n \n
*/
int
-OSCReceiver::m_note_on_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_note_on_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
/*
@@ -674,7 +674,7 @@ OSCReceiver::m_note_on_cb(const char* path, const char* types, lo_arg** argv, in
* \arg \b note-num (int) - MIDI style note number (0-127)</p> \n \n
*/
int
-OSCReceiver::m_note_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_note_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
/*
@@ -693,7 +693,7 @@ OSCReceiver::m_note_off_cb(const char* path, const char* types, lo_arg** argv, i
* \arg \b patch-path (string) - Patch of patch to send event to </p> \n \n
*/
int
-OSCReceiver::m_all_notes_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_all_notes_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
/*
@@ -716,7 +716,7 @@ OSCReceiver::m_all_notes_off_cb(const char* path, const char* types, lo_arg** ar
* method will go away completely. </p> \n \n
*/
int
-OSCReceiver::m_midi_learn_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_midi_learn_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* patch_path = &argv[1]->s;
@@ -732,7 +732,7 @@ OSCReceiver::m_midi_learn_cb(const char* path, const char* types, lo_arg** argv,
* \arg \b response-id (integer)
*/
int
-OSCReceiver::m_lash_restore_done_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_lash_restore_done_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
lash_restore_done();
return 0;
@@ -748,7 +748,7 @@ OSCReceiver::m_lash_restore_done_cb(const char* path, const char* types, lo_arg*
* \arg \b value (string) - Value of new piece of metadata
*/
int
-OSCReceiver::m_metadata_set_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_metadata_set_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* node_path = &argv[1]->s;
const char* key = &argv[2]->s;
@@ -769,7 +769,7 @@ OSCReceiver::m_metadata_set_cb(const char* path, const char* types, lo_arg** arg
* \li Reply will be sent to client registered with the source address of this message.</p> \n \n
*/
int
-OSCReceiver::m_metadata_get_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_metadata_get_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
/*
const char* node_path = &argv[1]->s;
@@ -794,7 +794,7 @@ OSCReceiver::m_metadata_get_cb(const char* path, const char* types, lo_arg** arg
* \li Reply will be sent to client registered with the source address of this message.</p> \n \n
*/
int
-OSCReceiver::m_request_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_request_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
request_plugins();
return 0;
@@ -808,7 +808,7 @@ OSCReceiver::m_request_plugins_cb(const char* path, const char* types, lo_arg**
* \li Reply will be sent to client registered with the source address of this message.</p> \n \n
*/
int
-OSCReceiver::m_request_all_objects_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_request_all_objects_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
request_all_objects();
return 0;
@@ -823,7 +823,7 @@ OSCReceiver::m_request_all_objects_cb(const char* path, const char* types, lo_ar
* \li Reply will be sent to client registered with the source address of this message.</p> \n \n
*/
int
-OSCReceiver::m_request_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_request_port_value_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
const char* port_path = &argv[1]->s;
@@ -834,7 +834,7 @@ OSCReceiver::m_request_port_value_cb(const char* path, const char* types, lo_arg
#ifdef HAVE_DSSI
int
-OSCReceiver::m_dssi_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCEngineReceiver::m_dssi_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
#if 0
string node_path(path);
@@ -862,7 +862,7 @@ OSCReceiver::m_dssi_cb(const char* path, const char* types, lo_arg** argv, int a
if (ev != NULL)
push(ev);
else
- cerr << "[OSCReceiver] Unknown DSSI command received: " << path << endl;
+ cerr << "[OSCEngineReceiver] Unknown DSSI command received: " << path << endl;
#endif
return 0;
}
@@ -874,7 +874,7 @@ OSCReceiver::m_dssi_cb(const char* path, const char* types, lo_arg** argv, int a
// Display incoming OSC messages (for debugging purposes)
int
-OSCReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
+OSCEngineReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
{
printf("[OSCMsg] %s\n", path);
@@ -890,7 +890,7 @@ OSCReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int
int
-OSCReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
+OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
{
const lo_address addr = lo_message_get_source(msg);
char* const url = lo_address_get_url(addr);
diff --git a/src/libs/engine/OSCReceiver.h b/src/libs/engine/OSCEngineReceiver.h
index 671944fd..cc2d7350 100644
--- a/src/libs/engine/OSCReceiver.h
+++ b/src/libs/engine/OSCEngineReceiver.h
@@ -14,8 +14,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef OSCRECEIVER_H
-#define OSCRECEIVER_H
+#ifndef OSCENGINERECEIVER_H
+#define OSCENGINERECEIVER_H
#include "config.h"
#include <string>
@@ -39,8 +39,8 @@ class Patch;
* lot of ugly boiler plate go away */
#define LO_HANDLER(name) \
int m_##name##_cb (LO_HANDLER_ARGS);\
-inline static int name##_cb(LO_HANDLER_ARGS, void* osc_receiver)\
-{ return ((OSCReceiver*)osc_receiver)->m_##name##_cb(path, types, argv, argc, msg); }
+inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\
+{ return ((OSCEngineReceiver*)myself)->m_##name##_cb(path, types, argv, argc, msg); }
/* FIXME: Make this receive and preprocess in the same thread? */
@@ -56,26 +56,26 @@ inline static int name##_cb(LO_HANDLER_ARGS, void* osc_receiver)\
*
* \ingroup engine
*/
-class OSCReceiver : public QueuedEngineInterface
+class OSCEngineReceiver : public QueuedEngineInterface
{
public:
- OSCReceiver(Engine& engine, size_t queue_size, const char* const port);
- ~OSCReceiver();
+ OSCEngineReceiver(Engine& engine, size_t queue_size, const char* const port);
+ ~OSCEngineReceiver();
void activate();
void deactivate();
private:
// Prevent copies (undefined)
- OSCReceiver(const OSCReceiver&);
- OSCReceiver& operator=(const OSCReceiver&);
+ OSCEngineReceiver(const OSCEngineReceiver&);
+ OSCEngineReceiver& operator=(const OSCEngineReceiver&);
virtual void _run();
static void error_cb(int num, const char* msg, const char* path);
- static int set_response_address_cb(LO_HANDLER_ARGS, void* osc_receiver);
- static int generic_cb(LO_HANDLER_ARGS, void* osc_receiver);
- static int unknown_cb(LO_HANDLER_ARGS, void* osc_receiver);
+ static int set_response_address_cb(LO_HANDLER_ARGS, void* myself);
+ static int generic_cb(LO_HANDLER_ARGS, void* myself);
+ static int unknown_cb(LO_HANDLER_ARGS, void* myself);
LO_HANDLER(quit);
LO_HANDLER(ping);
@@ -126,4 +126,4 @@ private:
} // namespace Ingen
-#endif // OSCRECEIVER_H
+#endif // OSCENGINERECEIVER_H
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 0ef11ac1..915b7811 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -16,6 +16,7 @@
#include "QueuedEventSource.h"
#include "QueuedEvent.h"
+#include "PostProcessor.h"
#include <sys/mman.h>
#include <iostream>
using std::cout; using std::cerr; using std::endl;
@@ -64,12 +65,43 @@ QueuedEventSource::push_queued(QueuedEvent* const ev)
}
+/** Process all events for a cycle.
+ *
+ * Executed events will be pushed to @a dest.
+ */
void
-QueuedEventSource::push_stamped(Event* const ev)
+QueuedEventSource::process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end)
{
- _stamped_queue.push(ev);
+ Event* ev = NULL;
+
+ /* Limit the maximum number of queued events to process per cycle. This
+ * makes the process callback (more) realtime-safe by preventing being
+ * choked by events coming in faster than they can be processed.
+ * FIXME: test this and figure out a good value */
+ const unsigned int MAX_QUEUED_EVENTS = nframes / 100;
+
+ unsigned int num_events_processed = 0;
+
+ /* FIXME: Merge these next two loops into one */
+
+ while ((ev = pop_earliest_queued_before(cycle_end))) {
+ ev->execute(nframes, cycle_start, cycle_end);
+ dest.push(ev);
+ if (++num_events_processed > MAX_QUEUED_EVENTS)
+ break;
+ }
+
+ while ((ev = pop_earliest_stamped_before(cycle_end))) {
+ ev->execute(nframes, cycle_start, cycle_end);
+ dest.push(ev);
+ ++num_events_processed;
+ }
+
+ if (num_events_processed > 0)
+ dest.whip();
}
+
/** Pops the prepared event at the front of the prepare queue, if it exists.
*
* This method will only pop events that have been prepared, and are
diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h
index abdea293..f6be92d7 100644
--- a/src/libs/engine/QueuedEventSource.h
+++ b/src/libs/engine/QueuedEventSource.h
@@ -29,6 +29,7 @@
namespace Ingen {
class QueuedEvent;
+class PostProcessor;
/** Queue of events that need processing before reaching the audio thread.
@@ -50,14 +51,16 @@ public:
void activate() { Slave::start(); }
void deactivate() { Slave::stop(); }
- Event* pop_earliest_queued_before(const SampleCount time);
- inline Event* pop_earliest_stamped_before(const SampleCount time);
+ void process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end);
void unblock();
protected:
void push_queued(QueuedEvent* const ev);
- void push_stamped(Event* const ev);
+ inline void push_stamped(Event* const ev) { _stamped_queue.push(ev); }
+
+ Event* pop_earliest_queued_before(const SampleCount time);
+ inline Event* pop_earliest_stamped_before(const SampleCount time);
bool unprepared_events() { return (_prepared_back != _back); }