summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--src/common/util/Path.h77
-rw-r--r--src/libs/engine/AlsaMidiDriver.cpp2
-rw-r--r--src/libs/engine/DSSINode.cpp2
-rw-r--r--src/libs/engine/Event.cpp48
-rw-r--r--src/libs/engine/Event.h25
-rw-r--r--src/libs/engine/EventSource.h12
-rw-r--r--src/libs/engine/JackAudioDriver.cpp60
-rw-r--r--src/libs/engine/JackAudioDriver.h3
-rw-r--r--src/libs/engine/Makefile.am1
-rw-r--r--src/libs/engine/MidiControlNode.cpp10
-rw-r--r--src/libs/engine/MidiNoteNode.cpp2
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp4
-rw-r--r--src/libs/engine/OSCReceiver.cpp50
-rw-r--r--src/libs/engine/OSCReceiver.h11
-rw-r--r--src/libs/engine/Om.cpp3
-rw-r--r--src/libs/engine/Om.h4
-rw-r--r--src/libs/engine/OmApp.cpp74
-rw-r--r--src/libs/engine/OmApp.h25
-rw-r--r--src/libs/engine/PostProcessor.cpp7
-rw-r--r--src/libs/engine/PostProcessor.h2
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp113
-rw-r--r--src/libs/engine/QueuedEngineInterface.h6
-rw-r--r--src/libs/engine/QueuedEvent.h27
-rw-r--r--src/libs/engine/QueuedEventSource.cpp37
-rw-r--r--src/libs/engine/QueuedEventSource.h41
-rw-r--r--src/libs/engine/Slave.h15
-rw-r--r--src/libs/engine/events/ActivateEvent.cpp8
-rw-r--r--src/libs/engine/events/ActivateEvent.h2
-rw-r--r--src/libs/engine/events/AddNodeEvent.cpp12
-rw-r--r--src/libs/engine/events/AddNodeEvent.h2
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp8
-rw-r--r--src/libs/engine/events/AddPortEvent.h2
-rw-r--r--src/libs/engine/events/AllNotesOffEvent.cpp10
-rw-r--r--src/libs/engine/events/AllNotesOffEvent.h4
-rw-r--r--src/libs/engine/events/ClearPatchEvent.cpp8
-rw-r--r--src/libs/engine/events/ClearPatchEvent.h2
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp19
-rw-r--r--src/libs/engine/events/ConnectionEvent.h4
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp16
-rw-r--r--src/libs/engine/events/CreatePatchEvent.h2
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.cpp4
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.h2
-rw-r--r--src/libs/engine/events/DSSIControlEvent.cpp4
-rw-r--r--src/libs/engine/events/DSSIControlEvent.h2
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.cpp4
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.h2
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.cpp4
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.h2
-rw-r--r--src/libs/engine/events/DeactivateEvent.cpp6
-rw-r--r--src/libs/engine/events/DeactivateEvent.h2
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp16
-rw-r--r--src/libs/engine/events/DestroyEvent.h4
-rw-r--r--src/libs/engine/events/DisablePatchEvent.cpp8
-rw-r--r--src/libs/engine/events/DisablePatchEvent.h2
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp15
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.h2
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp11
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.h2
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp22
-rw-r--r--src/libs/engine/events/DisconnectionEvent.h6
-rw-r--r--src/libs/engine/events/EnablePatchEvent.cpp8
-rw-r--r--src/libs/engine/events/EnablePatchEvent.h2
-rw-r--r--src/libs/engine/events/LashRestoreDoneEvent.h4
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.cpp15
-rw-r--r--src/libs/engine/events/LoadPluginsEvent.h2
-rw-r--r--src/libs/engine/events/MidiLearnEvent.cpp10
-rw-r--r--src/libs/engine/events/MidiLearnEvent.h6
-rw-r--r--src/libs/engine/events/NoteOffEvent.cpp12
-rw-r--r--src/libs/engine/events/NoteOffEvent.h4
-rw-r--r--src/libs/engine/events/NoteOnEvent.cpp12
-rw-r--r--src/libs/engine/events/NoteOnEvent.h4
-rw-r--r--src/libs/engine/events/PingQueuedEvent.h7
-rw-r--r--src/libs/engine/events/RegisterClientEvent.cpp5
-rw-r--r--src/libs/engine/events/RegisterClientEvent.h1
-rw-r--r--src/libs/engine/events/RenameEvent.cpp8
-rw-r--r--src/libs/engine/events/RenameEvent.h2
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.cpp10
-rw-r--r--src/libs/engine/events/RequestAllObjectsEvent.h2
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.cpp12
-rw-r--r--src/libs/engine/events/RequestMetadataEvent.h2
-rw-r--r--src/libs/engine/events/RequestPluginsEvent.cpp10
-rw-r--r--src/libs/engine/events/RequestPluginsEvent.h2
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp12
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.h2
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp8
-rw-r--r--src/libs/engine/events/SetMetadataEvent.h2
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp14
-rw-r--r--src/libs/engine/events/SetPortValueEvent.h4
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp14
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.h4
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.cpp8
-rw-r--r--src/libs/engine/events/UnregisterClientEvent.h2
-rw-r--r--src/progs/ingenuity/OmFlowCanvas.cpp4
94 files changed, 548 insertions, 550 deletions
diff --git a/Makefile.am b/Makefile.am
index 7125e80e..1234cf35 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
SUBDIRS = src
-doc: Doxyfile src/engine/*.h src/engine/*.cpp \
+doc: doc/Doxyfile src/engine/*.h src/engine/*.cpp \
src/common/util/*.h \
src/common/interface/*.h \
src/clients/*.h src/clients/*.cpp \
src/clients/gtk/*.h src/clients/gtk/*.cpp
- doxygen
+ doxygen doc/Doxyfile
diff --git a/src/common/util/Path.h b/src/common/util/Path.h
index e54b7b61..605736e5 100644
--- a/src/common/util/Path.h
+++ b/src/common/util/Path.h
@@ -25,27 +25,82 @@ namespace Om {
/** Simple wrapper around standard string with useful path-specific methods.
+ *
+ * This enforces that a Path is a valid OSC path (though it is used for
+ * GraphObject paths, which aren't directly OSC paths but a portion of one).
+ *
+ * A path is divided by slashes (/). The first character MUST be a slash, and
+ * the last character MUST NOT be a slash (except in the special case of the
+ * root path "/", which is the only valid single-character path).
+ *
+ * Valid characters are the 95 printable ASCII characters (32-126), excluding:
+ * space # * , ? [ ] { }
*/
class Path : public std::basic_string<char> {
public:
+
+ /** Construct a Path from an std::string.
+ *
+ * It is a fatal error to construct a Path from an invalid string,
+ * use @ref is_valid first to check.
+ */
Path(const std::basic_string<char>& path)
: std::basic_string<char>(path)
{
- assert(path.length() > 0);
+ assert(is_valid(path));
}
+ /** Construct a Path from a C string.
+ *
+ * It is a fatal error to construct a Path from an invalid string,
+ * use @ref is_valid first to check.
+ */
+ Path(const char* cpath)
+ : std::basic_string<char>(cpath)
+ {
+ assert(is_valid(cpath));
+ }
- inline bool is_valid() const
+ static bool is_valid(const std::basic_string<char>& path)
{
- return (find_last_of("/") != string::npos);
+ if (path.length() == 0)
+ return false;
+
+ // Must start with a /
+ if (path.at(0) != '/')
+ return false;
+
+ // Must not end with a slash unless "/"
+ if (path.length() > 1 && path.at(path.length()-1) == '/')
+ return false;
+
+ assert(path.find_last_of("/") != string::npos);
+
+ // All characters must be printable ASCII
+ for (size_t i=0; i < path.length(); ++i)
+ if (path.at(i) < 32 || path.at(i) > 126)
+ return false;
+
+ // Disallowed characters
+ if ( path.find(" ") != string::npos
+ || path.find("#") != string::npos
+ || path.find("*") != string::npos
+ || path.find(",") != string::npos
+ || path.find("?") != string::npos
+ || path.find("[") != string::npos
+ || path.find("]") != string::npos
+ || path.find("{") != string::npos
+ || path.find("}") != string::npos)
+ return false;
+
+ return true;
}
/** Return the name of this object (everything after the last '/').
+ * This is the "method name" for OSC paths.
*/
inline std::basic_string<char> name() const
{
- assert(is_valid());
-
if ((*this) == "/")
return "";
else
@@ -56,26 +111,26 @@ public:
/** Return the parent's path.
*
* Calling this on the path "/" will return "/".
+ * This is the (deepest) "container path" for OSC paths.
*/
inline Path parent() const
{
- assert(is_valid());
-
std::basic_string<char> parent = substr(0, find_last_of("/"));
return (parent == "") ? "/" : parent;
}
+ /** Parent path with a "/" appended.
+ *
+ * Because of the "/" special case, append a child name to base_path()
+ * to construct a path.
+ */
inline Path base_path() const
{
- assert(is_valid());
-
if ((*this) == "/")
return *this;
else
return (*this) + "/";
}
-
- Path(const char* s) : std::basic_string<char>(s) {}
};
diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp
index fbf928bf..bc10de18 100644
--- a/src/libs/engine/AlsaMidiDriver.cpp
+++ b/src/libs/engine/AlsaMidiDriver.cpp
@@ -268,7 +268,7 @@ AlsaMidiDriver::activate()
}
#ifdef HAVE_LASH
- lash_driver->set_alsa_client_id(snd_seq_client_id(m_seq_handle));
+ om->lash_driver()->set_alsa_client_id(snd_seq_client_id(m_seq_handle));
#endif
m_is_activated = true;
diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp
index d9cad41d..0cd8ac22 100644
--- a/src/libs/engine/DSSINode.cpp
+++ b/src/libs/engine/DSSINode.cpp
@@ -63,7 +63,7 @@ DSSINode::instantiate()
if (has_midi_input()) {
_ports = new Array<Port*>(_descriptor->PortCount + 1);
- _midi_in_port = new InputPort<MidiMessage>(this, "MIDI In", _ports->size()-1, 1, DataType::MIDI, _buffer_size);
+ _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", _ports->size()-1, 1, DataType::MIDI, _buffer_size);
_ports->at(_ports->size()-1) = _midi_in_port;
}
diff --git a/src/libs/engine/Event.cpp b/src/libs/engine/Event.cpp
deleted file mode 100644
index fca60bdc..00000000
--- a/src/libs/engine/Event.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard.
- *
- * Om 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.
- *
- * Om 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 "Event.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "AudioDriver.h"
-
-namespace Om {
-
-// It'd be nice if this was inlined..
-Event::Event(CountedPtr<Responder> responder)
-: m_responder(responder),
- m_executed(false)
-{
- m_time_stamp = om->audio_driver()->time_stamp();
-}
-
-
-/** Construct an event with no responder.
- *
- * For internal events only, attempting to access the responder will
- * cause a NULL pointer dereference.
- */
-Event::Event()
-: m_responder(NULL),
- m_executed(false)
-{
- m_time_stamp = om->audio_driver()->time_stamp();
-}
-
-
-} // namespace Om
-
diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h
index 355525cf..604d1e19 100644
--- a/src/libs/engine/Event.h
+++ b/src/libs/engine/Event.h
@@ -43,26 +43,29 @@ class Event : public MaidObject
public:
virtual ~Event() {}
- /** Execute event, MUST be realtime safe */
- virtual void execute(samplecount offset) { assert(!m_executed); m_executed = true; }
+ /** Execute this event in the audio thread (MUST be realtime safe). */
+ virtual void execute(samplecount offset) { assert(!_executed); _executed = true; }
- /** Perform any actions after execution (ie send OSC response to client).
- * No realtime requirement. */
+ /** Perform any actions after execution (ie send replies to commands)
+ * (no realtime requirements). */
virtual void post_process() {}
- inline samplecount time_stamp() { return m_time_stamp; }
+ inline samplecount time_stamp() { return _time_stamp; }
protected:
- Event(CountedPtr<Responder> responder);
- Event();
-
// Prevent copies
Event(const Event&);
Event& operator=(const Event&);
+
+ Event(CountedPtr<Responder> responder, samplecount timestamp)
+ : _responder(responder)
+ , _time_stamp(timestamp)
+ , _executed(false)
+ {}
- CountedPtr<Responder> m_responder;
- samplecount m_time_stamp;
- bool m_executed;
+ CountedPtr<Responder> _responder;
+ samplecount _time_stamp;
+ bool _executed;
};
diff --git a/src/libs/engine/EventSource.h b/src/libs/engine/EventSource.h
index 273100b7..6c52eb11 100644
--- a/src/libs/engine/EventSource.h
+++ b/src/libs/engine/EventSource.h
@@ -28,6 +28,12 @@ class QueuedEvent;
* The AudioDriver gets events from an EventSource in the process callback
* (realtime audio thread) and executes them, then they are sent to the
* PostProcessor and finalised (post-processing thread).
+ *
+ * There are two distinct classes of events - "queued" and "stamped". Queued
+ * events are events that require non-realtime pre-processing before being
+ * executed in the process thread. Stamped events are timestamped realtime
+ * events that require no pre-processing and can be executed immediately
+ * (with sample accuracy).
*/
class EventSource
{
@@ -35,11 +41,9 @@ public:
virtual ~EventSource() {}
- virtual Event* pop_earliest_before(const samplecount time) = 0;
-
- virtual void start() = 0;
+ virtual Event* pop_earliest_queued_before(const samplecount time) = 0;
- virtual void stop() = 0;
+ virtual Event* pop_earliest_stamped_before(const samplecount time) = 0;
protected:
EventSource() {}
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 92794796..dd01941e 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -25,6 +25,7 @@
#include "Event.h"
#include "QueuedEvent.h"
#include "EventSource.h"
+#include "OSCReceiver.h"
#include "PostProcessor.h"
#include "util/Queue.h"
#include "Node.h"
@@ -124,9 +125,7 @@ JackAudioDriver::JackAudioDriver()
m_sample_rate(0),
m_is_activated(false),
m_local_client(true),
- m_root_patch(NULL),
- m_start_of_current_cycle(0),
- m_start_of_last_cycle(0)
+ m_root_patch(NULL)
{
m_client = jack_client_new("Om");
if (m_client == NULL) {
@@ -148,9 +147,7 @@ JackAudioDriver::JackAudioDriver(jack_client_t* jack_client)
m_buffer_size(jack_get_buffer_size(jack_client)),
m_sample_rate(jack_get_sample_rate(jack_client)),
m_is_activated(false),
- m_local_client(false),
- m_start_of_current_cycle(0),
- m_start_of_last_cycle(0)
+ m_local_client(false)
{
jack_on_shutdown(m_client, shutdown_cb, this);
@@ -186,7 +183,7 @@ JackAudioDriver::activate()
} else {
cout << "[JackAudioDriver] Activated Jack client." << endl;
#ifdef HAVE_LASH
- lash_driver->set_jack_client_name("Om"); // FIXME: unique name
+ om->lash_driver()->set_jack_client_name("Om"); // FIXME: unique name
#endif
}
}
@@ -196,8 +193,7 @@ void
JackAudioDriver::deactivate()
{
if (m_is_activated) {
- // FIXME
- reinterpret_cast<EventSource*>(om->osc_receiver())->stop();
+ om->osc_receiver()->deactivate();
jack_deactivate(m_client);
m_is_activated = false;
@@ -268,38 +264,40 @@ JackAudioDriver::process_events(jack_nframes_t block_start, jack_nframes_t block
Event* ev = NULL;
/* Limit the maximum number of queued events to process per cycle. This
- * makes the process callback truly realtime-safe by preventing being
+ * 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 int MAX_SLOW_EVENTS = m_buffer_size / 100;
+ const unsigned int MAX_QUEUED_EVENTS = m_buffer_size / 100;
- int num_events_processed = 0;
- int offset = 0;
+ unsigned int num_events_processed = 0;
+ unsigned int offset = 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 = reinterpret_cast<EventSource*>(om->osc_receiver())
- ->pop_earliest_before(block_end)) != NULL) {
+ while ((ev = om->osc_receiver()->pop_earliest_queued_before(block_end))) {
ev->execute(0); // QueuedEvents are not sample accurate
om->post_processor()->push(ev);
- if (++num_events_processed > MAX_SLOW_EVENTS)
+ if (++num_events_processed > MAX_QUEUED_EVENTS)
break;
}
- while (!om->event_queue()->is_empty()
- && om->event_queue()->front()->time_stamp() < block_end) {
- ev = om->event_queue()->pop();
- offset = ev->time_stamp() - block_start;
- if (offset < 0) offset = 0; // this can happen if we miss a cycle
+ while ((ev = om->osc_receiver()->pop_earliest_stamped_before(block_end))) {
+ if (ev->time_stamp() >= block_start)
+ offset = ev->time_stamp() - block_start;
+ else
+ offset = 0;
+
ev->execute(offset);
om->post_processor()->push(ev);
++num_events_processed;
}
if (num_events_processed > 0)
- om->post_processor()->signal();
+ om->post_processor()->whip();
}
@@ -315,20 +313,24 @@ JackAudioDriver::process_events(jack_nframes_t block_start, jack_nframes_t block
int
JackAudioDriver::m_process_cb(jack_nframes_t nframes)
{
+ static jack_nframes_t start_of_current_cycle = 0;
+ static jack_nframes_t start_of_last_cycle = 0;
+
// FIXME: support nframes != buffer_size, even though that never damn well happens
assert(nframes == m_buffer_size);
- // Note that jack can elect to not call this function for a cycle, if things aren't
- // keeping up
- m_start_of_current_cycle = jack_last_frame_time(m_client);
- m_start_of_last_cycle = m_start_of_current_cycle - nframes;
+ // Jack can elect to not call this function for a cycle, if overloaded
+ // FIXME: this doesn't make sense, and the start time isn't used anyway
+ start_of_current_cycle = jack_last_frame_time(m_client);
+ start_of_last_cycle = start_of_current_cycle - nframes;
- assert(m_start_of_current_cycle - m_start_of_last_cycle == nframes);
+ // FIXME: ditto
+ assert(start_of_current_cycle - start_of_last_cycle == nframes);
m_transport_state = jack_transport_query(m_client, &m_position);
- process_events(m_start_of_last_cycle, m_start_of_current_cycle);
- om->midi_driver()->prepare_block(m_start_of_last_cycle, m_start_of_current_cycle);
+ process_events(start_of_last_cycle, start_of_current_cycle);
+ om->midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle);
// Set buffers of patch ports to Jack port buffers (zero-copy processing)
for (List<JackAudioPort*>::iterator i = m_ports.begin(); i != m_ports.end(); ++i)
diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h
index f491ce11..7141d5d4 100644
--- a/src/libs/engine/JackAudioDriver.h
+++ b/src/libs/engine/JackAudioDriver.h
@@ -140,9 +140,6 @@ private:
List<JackAudioPort*> m_ports;
Patch* m_root_patch;
-
- jack_nframes_t m_start_of_current_cycle;
- jack_nframes_t m_start_of_last_cycle;
};
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index e814b3b8..e356e488 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -56,7 +56,6 @@ libingen_la_SOURCES = \
MidiControlNode.h \
MidiControlNode.cpp \
Event.h \
- Event.cpp \
QueuedEvent.h \
EventSource.h \
QueuedEventSource.h \
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index 5eba4a92..f7fe2984 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -36,10 +36,10 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent,
{
_ports = new Array<Port*>(7);
- _midi_in_port = new InputPort<MidiMessage>(this, "MIDI In", 0, 1, DataType::MIDI, _buffer_size);
+ _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
- _param_port = new InputPort<sample>(this, "Controller Number", 1, 1, DataType::FLOAT, 1);
+ _param_port = new InputPort<sample>(this, "Controller_Number", 1, 1, DataType::FLOAT, 1);
_ports->at(1) = _param_port;
_log_port = new InputPort<sample>(this, "Logarithmic", 2, 1, DataType::FLOAT, 1);
@@ -51,10 +51,10 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent,
_max_port = new InputPort<sample>(this, "Max", 4, 1, DataType::FLOAT, 1);
_ports->at(4) = _max_port;
- _audio_port = new OutputPort<sample>(this, "Out (AR)", 5, 1, DataType::FLOAT, _buffer_size);
+ _audio_port = new OutputPort<sample>(this, "Out_(AR)", 5, 1, DataType::FLOAT, _buffer_size);
_ports->at(5) = _audio_port;
- _control_port = new OutputPort<sample>(this, "Out (CR)", 6, 1, DataType::FLOAT, 1);
+ _control_port = new OutputPort<sample>(this, "Out_(CR)", 6, 1, DataType::FLOAT, 1);
_ports->at(6) = _control_port;
_plugin.plug_label("midi_control_in");
@@ -94,7 +94,7 @@ MidiControlNode::control(uchar control_num, uchar val, samplecount offset)
_learn_event->set_value(control_num);
_learn_event->execute(offset);
om->post_processor()->push(_learn_event);
- om->post_processor()->signal();
+ om->post_processor()->whip();
_learning = false;
_learn_event = NULL;
}
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 3c66e283..47c2d5ac 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -41,7 +41,7 @@ MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, sampl
{
_ports = new Array<Port*>(5);
- _midi_in_port = new InputPort<MidiMessage>(this, "DataType::MIDI In", 0, 1, DataType::MIDI, _buffer_size);
+ _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
_freq_port = new OutputPort<sample>(this, "Frequency", 1, poly, DataType::FLOAT, _buffer_size);
diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp
index 2f2d4362..4026da8e 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -30,10 +30,10 @@ MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent,
{
_ports = new Array<Port*>(5);
- _midi_in_port = new InputPort<MidiMessage>(this, "DataType::MIDI In", 0, 1, DataType::MIDI, _buffer_size);
+ _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
- _note_port = new InputPort<sample>(this, "Note Number", 1, 1, DataType::FLOAT, 1);
+ _note_port = new InputPort<sample>(this, "Note_Number", 1, 1, DataType::FLOAT, 1);
// new PortInfo("Note Number", CONTROL, INPUT, INTEGER, 60, 0, 127), 1);
_ports->at(1) = _note_port;
diff --git a/src/libs/engine/OSCReceiver.cpp b/src/libs/engine/OSCReceiver.cpp
index 30bda10b..0e2cfd06 100644
--- a/src/libs/engine/OSCReceiver.cpp
+++ b/src/libs/engine/OSCReceiver.cpp
@@ -50,7 +50,7 @@ using Shared::ClientKey;
OSCReceiver::OSCReceiver(size_t queue_size, const char* const port)
-: QueuedEngineInterface(queue_size),
+: QueuedEngineInterface(queue_size, queue_size), // FIXME
_port(port),
_server(NULL),
_osc_responder(NULL)
@@ -136,19 +136,19 @@ OSCReceiver::~OSCReceiver()
void
-OSCReceiver::start()
+OSCReceiver::activate()
{
set_name("OSCReceiver");
- QueuedEventSource::start();
+ QueuedEventSource::activate();
set_scheduling(SCHED_FIFO, 10);
}
void
-OSCReceiver::stop()
+OSCReceiver::deactivate()
{
cout << "[OSCReceiver] Stopped OSC listening thread" << endl;
- QueuedEventSource::stop();
+ QueuedEventSource::deactivate();
}
@@ -158,9 +158,8 @@ OSCReceiver::stop()
void
OSCReceiver::_run()
{
- /* FIXME: Make Event() take a timestamp as a parameter, get a timestamp
- * here and stamp all the events with the same time so they all get
- * executed in the same cycle */
+ /* get a timestamp here and stamp all the events with the same time so
+ * they all get executed in the same cycle */
while (true) {
assert( ! unprepared_events());
@@ -174,7 +173,7 @@ OSCReceiver::_run()
// Process them all
while (unprepared_events())
- _signalled();
+ _whipped(); // Whip our slave self
// No more unprepared events
}
@@ -266,7 +265,6 @@ int
OSCReceiver::m_ping_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
_responder->respond_ok();
-
return 0;
}
@@ -284,7 +282,6 @@ int
OSCReceiver::m_ping_slow_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
ping();
-
return 0;
}
@@ -302,7 +299,6 @@ OSCReceiver::m_quit_cb(const char* path, const char* types, lo_arg** argv, int a
{
quit();
-
return 0;
}
@@ -366,7 +362,7 @@ OSCReceiver::m_load_plugins_cb(const char* path, const char* types, lo_arg** arg
int
OSCReceiver::m_engine_activate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- activate();
+ QueuedEngineInterface::activate();
return 0;
}
@@ -378,7 +374,7 @@ OSCReceiver::m_engine_activate_cb(const char* path, const char* types, lo_arg**
int
OSCReceiver::m_engine_deactivate_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- deactivate();
+ QueuedEngineInterface::deactivate();
return 0;
}
@@ -396,7 +392,6 @@ OSCReceiver::m_create_patch_cb(const char* path, const char* types, lo_arg** arg
const int poly = argv[2]->i;
create_patch(patch_path, poly);
-
return 0;
}
@@ -414,7 +409,6 @@ OSCReceiver::m_rename_cb(const char* path, const char* types, lo_arg** argv, int
const char* name = &argv[2]->s;
rename(object_path, name);
-
return 0;
}
@@ -430,7 +424,6 @@ OSCReceiver::m_enable_patch_cb(const char* path, const char* types, lo_arg** arg
const char* patch_path = &argv[1]->s;
enable_patch(patch_path);
-
return 0;
}
@@ -446,7 +439,6 @@ OSCReceiver::m_disable_patch_cb(const char* path, const char* types, lo_arg** ar
const char* patch_path = &argv[1]->s;
disable_patch(patch_path);
-
return 0;
}
@@ -462,7 +454,6 @@ OSCReceiver::m_clear_patch_cb(const char* path, const char* types, lo_arg** argv
const char* patch_path = &argv[1]->s;
clear_patch(patch_path);
-
return 0;
}
@@ -482,7 +473,6 @@ OSCReceiver::m_create_port_cb(const char* path, const char* types, lo_arg** argv
const int direction = argv[3]->i;
create_port(port_path, data_type, (direction == 1));
-
return 0;
}
@@ -505,7 +495,6 @@ OSCReceiver::m_create_node_by_uri_cb(const char* path, const char* types, lo_arg
// FIXME: make sure poly is valid
create_node(node_path, type, plug_uri, (poly == 1));
-
return 0;
}
@@ -533,7 +522,6 @@ OSCReceiver::m_create_node_cb(const char* path, const char* types, lo_arg** argv
const int poly = argv[5]->i;
create_node(node_path, type, lib_name, plug_label, (poly == 1));
-
return 0;
}
@@ -549,7 +537,6 @@ OSCReceiver::m_destroy_cb(const char* path, const char* types, lo_arg** argv, in
const char* node_path = &argv[1]->s;
destroy(node_path);
-
return 0;
}
@@ -567,7 +554,6 @@ OSCReceiver::m_connect_cb(const char* path, const char* types, lo_arg** argv, in
const char* dst_port_path = &argv[2]->s;
connect(src_port_path, dst_port_path);
-
return 0;
}
@@ -585,7 +571,6 @@ OSCReceiver::m_disconnect_cb(const char* path, const char* types, lo_arg** argv,
const char* dst_port_path = &argv[2]->s;
disconnect(src_port_path, dst_port_path);
-
return 0;
}
@@ -601,7 +586,6 @@ OSCReceiver::m_disconnect_all_cb(const char* path, const char* types, lo_arg** a
const char* node_path = &argv[1]->s;
disconnect_all(node_path);
-
return 0;
}
@@ -619,7 +603,6 @@ OSCReceiver::m_set_port_value_cb(const char* path, const char* types, lo_arg** a
const float value = argv[2]->f;
set_port_value(port_path, value);
-
return 0;
}
@@ -639,7 +622,6 @@ OSCReceiver::m_set_port_value_voice_cb(const char* path, const char* types, lo_a
const float value = argv[3]->f;
set_port_value(port_path, voice, value);
-
return 0;
}
@@ -661,7 +643,6 @@ OSCReceiver::m_set_port_value_slow_cb(const char* path, const char* types, lo_ar
const float value = argv[2]->f;
set_port_value_queued(port_path, value);
-
return 0;
}
@@ -755,8 +736,7 @@ OSCReceiver::m_midi_learn_cb(const char* path, const char* types, lo_arg** argv,
int
OSCReceiver::m_lash_restore_done_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- lash_retore_done();
-
+ lash_restore_done();
return 0;
}
#endif // HAVE_LASH
@@ -818,11 +798,7 @@ OSCReceiver::m_metadata_get_cb(const char* path, const char* types, lo_arg** arg
int
OSCReceiver::m_request_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- cerr << "REQUEST PLUGINS\n";
-
- // FIXME
request_plugins();
-
return 0;
}
@@ -837,7 +813,6 @@ int
OSCReceiver::m_request_all_objects_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
request_all_objects();
-
return 0;
}
@@ -852,10 +827,9 @@ OSCReceiver::m_request_all_objects_cb(const char* path, const char* types, lo_ar
int
OSCReceiver::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;
+ const char* port_path = &argv[1]->s;
request_port_value(port_path);
-
return 0;
}
diff --git a/src/libs/engine/OSCReceiver.h b/src/libs/engine/OSCReceiver.h
index c966632f..67cc8ee2 100644
--- a/src/libs/engine/OSCReceiver.h
+++ b/src/libs/engine/OSCReceiver.h
@@ -50,19 +50,20 @@ inline static int name##_cb(LO_HANDLER_ARGS, void* osc_receiver)\
*
* This inherits from QueuedEngineInterface and calls it's own functions
* via OSC. It's not actually a directly callable EngineInterface (it's
- * callable via OSC...) so it is-implemented-as-a (privately inherits)
- * QueuedEngineInterface.
+ * callable via OSC...) so it should be implemented-as-a (privately inherit)
+ * QueuedEngineInterface, but it needs to be public so it's an EventSource
+ * the Driver can use. This probably should be fixed somehow..
*
* \ingroup engine
*/
-class OSCReceiver : private QueuedEngineInterface
+class OSCReceiver : public QueuedEngineInterface
{
public:
OSCReceiver(size_t queue_size, const char* const port);
~OSCReceiver();
- void start();
- void stop();
+ void activate();
+ void deactivate();
private:
// Prevent copies (undefined)
diff --git a/src/libs/engine/Om.cpp b/src/libs/engine/Om.cpp
index f1e32a31..f991e08e 100644
--- a/src/libs/engine/Om.cpp
+++ b/src/libs/engine/Om.cpp
@@ -30,7 +30,4 @@
namespace Om
{
OmApp* om = 0;
-#ifdef HAVE_LASH
- LashDriver* lash_driver = 0;
-#endif
}
diff --git a/src/libs/engine/Om.h b/src/libs/engine/Om.h
index fe9689aa..002b3bc1 100644
--- a/src/libs/engine/Om.h
+++ b/src/libs/engine/Om.h
@@ -30,10 +30,6 @@
*/
namespace Om
{
-#ifdef HAVE_LASH
- class LashDriver;
- extern LashDriver* lash_driver;
-#endif
class OmApp;
extern OmApp* om;
}
diff --git a/src/libs/engine/OmApp.cpp b/src/libs/engine/OmApp.cpp
index 5a001633..f6ef9f54 100644
--- a/src/libs/engine/OmApp.cpp
+++ b/src/libs/engine/OmApp.cpp
@@ -50,43 +50,9 @@ using std::cout; using std::cerr; using std::endl;
namespace Om {
-OmApp::OmApp(const char* port)
-: m_maid(new Maid(maid_queue_size)),
- m_audio_driver(new JackAudioDriver()),
-#ifdef HAVE_JACK_MIDI
- m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())),
-#elif HAVE_ALSA_MIDI
- m_midi_driver(new AlsaMidiDriver()),
-#else
- m_midi_driver(new DummyMidiDriver()),
-#endif
- m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)),
- m_client_broadcaster(new ClientBroadcaster()),
- m_object_store(new ObjectStore()),
- m_node_factory(new NodeFactory()),
- m_event_queue(new Queue<Event*>(event_queue_size)),
-// m_pre_processor(new QueuedEventSource(pre_processor_queue_size)),
- m_post_processor(new PostProcessor(post_processor_queue_size)),
- m_quit_flag(false),
- m_activated(false)
-{
- mlock(m_audio_driver, sizeof(JackAudioDriver));
- mlock(m_object_store, sizeof(ObjectStore));
- mlock(m_osc_receiver, sizeof(OSCReceiver));
-#ifdef HAVE_ALSA_MIDI
- mlock(m_midi_driver, sizeof(AlsaMidiDriver));
-#else
- mlock(m_midi_driver, sizeof(DummyMidiDriver));
-#endif
-
- m_osc_receiver->start();
- m_post_processor->start();
-}
-
-
OmApp::OmApp(const char* port, AudioDriver* audio_driver)
-: m_maid(new Maid(maid_queue_size)),
- m_audio_driver(audio_driver),
+: m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver() ),
+ m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)),
#ifdef HAVE_JACK_MIDI
m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())),
#elif HAVE_ALSA_MIDI
@@ -94,27 +60,20 @@ OmApp::OmApp(const char* port, AudioDriver* audio_driver)
#else
m_midi_driver(new DummyMidiDriver()),
#endif
- m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)),
+ m_post_processor(new PostProcessor(post_processor_queue_size)),
+ m_maid(new Maid(maid_queue_size)),
m_client_broadcaster(new ClientBroadcaster()),
m_object_store(new ObjectStore()),
m_node_factory(new NodeFactory()),
- m_event_queue(new Queue<Event*>(event_queue_size)),
- //m_pre_processor(new QueuedEventSource(pre_processor_queue_size)),
- m_post_processor(new PostProcessor(post_processor_queue_size)),
+#ifdef HAVE_LASH
+ m_lash_driver(new LashDriver()),
+#else
+ m_lash_driver(NULL),
+#endif
m_quit_flag(false),
m_activated(false)
{
- mlock(m_audio_driver, sizeof(JackAudioDriver));
- mlock(m_object_store, sizeof(ObjectStore));
- mlock(m_osc_receiver, sizeof(OSCReceiver));
-#ifdef HAVE_ALSA_MIDI
- mlock(m_midi_driver, sizeof(AlsaMidiDriver));
-#else
- mlock(m_midi_driver, sizeof(DummyMidiDriver));
-#endif
-
- m_osc_receiver->start();
- m_post_processor->start();
+ m_osc_receiver->activate();
}
@@ -186,11 +145,11 @@ OmApp::activate()
return;
// Create root patch
- CreatePatchEvent create_ev(CountedPtr<Responder>(new Responder()), "/", 1);
+ CreatePatchEvent create_ev(CountedPtr<Responder>(new Responder()), 0, "/", 1);
create_ev.pre_process();
create_ev.execute(0);
create_ev.post_process();
- EnablePatchEvent enable_ev(CountedPtr<Responder>(new Responder()), "/");
+ EnablePatchEvent enable_ev(CountedPtr<Responder>(new Responder()), 0, "/");
enable_ev.pre_process();
enable_ev.execute(0);
enable_ev.post_process();
@@ -201,6 +160,9 @@ OmApp::activate()
#ifdef HAVE_ALSA_MIDI
m_midi_driver->activate();
#endif
+
+ m_post_processor->start();
+
m_activated = true;
}
@@ -222,9 +184,13 @@ OmApp::deactivate()
if (m_midi_driver != NULL)
m_midi_driver->deactivate();
- m_osc_receiver->stop();
+ m_osc_receiver->deactivate();
m_audio_driver->deactivate();
+ // Finalize any lingering events (unlikely)
+ m_post_processor->whip();
+ m_post_processor->stop();
+
m_activated = false;
}
diff --git a/src/libs/engine/OmApp.h b/src/libs/engine/OmApp.h
index 8f14d0c2..b7305a2d 100644
--- a/src/libs/engine/OmApp.h
+++ b/src/libs/engine/OmApp.h
@@ -33,6 +33,7 @@ class EventSource;
class PostProcessor;
class Event;
class QueuedEvent;
+class LashDriver;
template <typename T> class Driver;
@@ -45,8 +46,7 @@ template <typename T> class Driver;
class OmApp
{
public:
- OmApp(const char* const port);
- OmApp(const char* const port, AudioDriver* audio_driver);
+ OmApp(const char* const port, AudioDriver* audio_driver = 0);
~OmApp();
int main();
@@ -58,16 +58,17 @@ public:
void activate();
void deactivate();
- Maid* maid() const { return m_maid; }
+
AudioDriver* audio_driver() const { return m_audio_driver; }
- MidiDriver* midi_driver() const { return m_midi_driver; }
OSCReceiver* osc_receiver() const { return m_osc_receiver; }
+ MidiDriver* midi_driver() const { return m_midi_driver; }
+ PostProcessor* post_processor() const { return m_post_processor; }
+ Maid* maid() const { return m_maid; }
ClientBroadcaster* client_broadcaster() const { return m_client_broadcaster; }
ObjectStore* object_store() const { return m_object_store; }
NodeFactory* node_factory() const { return m_node_factory; }
- Queue<Event*>* event_queue() const { return m_event_queue; }
- //EventSource* pre_processor() const { return m_pre_processor; }
- PostProcessor* post_processor() const { return m_post_processor; }
+ LashDriver* lash_driver() const { return m_lash_driver; }
+
/** Return the active driver for the given (template parameter) type.
* This is a hook for BridgeNode. See OmApp.cpp for specializations. */
@@ -78,16 +79,16 @@ private:
OmApp(const OmApp&);
OmApp& operator=(const OmApp&);
- Maid* m_maid;
+
AudioDriver* m_audio_driver;
- MidiDriver* m_midi_driver;
OSCReceiver* m_osc_receiver;
+ MidiDriver* m_midi_driver;
+ PostProcessor* m_post_processor;
+ Maid* m_maid;
ClientBroadcaster* m_client_broadcaster;
ObjectStore* m_object_store;
NodeFactory* m_node_factory;
- Queue<Event*>* m_event_queue;
- //EventSource* m_pre_processor;
- PostProcessor* m_post_processor;
+ LashDriver* m_lash_driver;
bool m_quit_flag;
bool m_activated;
diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp
index 8b68159e..9477317d 100644
--- a/src/libs/engine/PostProcessor.cpp
+++ b/src/libs/engine/PostProcessor.cpp
@@ -37,13 +37,12 @@ PostProcessor::PostProcessor(size_t queue_size)
}
-/** Post processing thread.
+/** Post-Process every pending event.
*
- * Infinite loop that waits on the semaphore and processes every enqueued
- * event (to be signalled at the end of every process cycle).
+ * The PostProcessor should be whipped by the audio thread once every cycle
*/
void
-PostProcessor::_signalled()
+PostProcessor::_whipped()
{
while ( ! _events.is_empty()) {
Event* const ev = _events.pop();
diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h
index e0c384eb..a243d824 100644
--- a/src/libs/engine/PostProcessor.h
+++ b/src/libs/engine/PostProcessor.h
@@ -50,7 +50,7 @@ private:
PostProcessor& operator=(const PostProcessor&);
Queue<Event*> _events;
- virtual void _signalled();
+ virtual void _whipped();
};
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index 0546b8a2..26632380 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -20,11 +20,12 @@
#include "Om.h"
#include "util/Queue.h"
#include "OmApp.h"
+#include "AudioDriver.h"
namespace Om {
-QueuedEngineInterface::QueuedEngineInterface(size_t queue_size)
-: QueuedEventSource(queue_size)
+QueuedEngineInterface::QueuedEngineInterface(size_t queued_size, size_t stamped_size)
+: QueuedEventSource(queued_size, stamped_size)
, _responder(CountedPtr<Responder>(new Responder())) // NULL responder
{
}
@@ -38,7 +39,6 @@ QueuedEngineInterface::QueuedEngineInterface(size_t queue_size)
void
QueuedEngineInterface::set_responder(CountedPtr<Responder> responder)
{
- //cerr << "SET\n";
_responder = responder;
}
@@ -58,16 +58,16 @@ QueuedEngineInterface::disable_responses()
void
QueuedEngineInterface::register_client(ClientKey key, CountedPtr<ClientInterface> client)
{
- RegisterClientEvent* ev = new RegisterClientEvent(_responder, key, client);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new RegisterClientEvent(_responder, timestamp, key, client));
}
void
QueuedEngineInterface::unregister_client(ClientKey key)
{
- UnregisterClientEvent* ev = new UnregisterClientEvent(_responder, key);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new UnregisterClientEvent(_responder, timestamp, key));
}
@@ -76,8 +76,8 @@ QueuedEngineInterface::unregister_client(ClientKey key)
void
QueuedEngineInterface::load_plugins()
{
- LoadPluginsEvent* ev = new LoadPluginsEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new LoadPluginsEvent(_responder, timestamp));
}
@@ -85,16 +85,16 @@ QueuedEngineInterface::load_plugins()
void
QueuedEngineInterface::activate()
{
- ActivateEvent* ev = new ActivateEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new ActivateEvent(_responder, timestamp));
}
void
QueuedEngineInterface::deactivate()
{
- DeactivateEvent* ev = new DeactivateEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DeactivateEvent(_responder, timestamp));
}
@@ -113,8 +113,8 @@ void
QueuedEngineInterface::create_patch(const string& path,
uint32_t poly)
{
- CreatePatchEvent* ev = new CreatePatchEvent(_responder, path, poly);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new CreatePatchEvent(_responder, timestamp, path, poly));
}
@@ -123,8 +123,8 @@ void QueuedEngineInterface::create_port(const string& path,
const string& data_type,
bool direction)
{
- AddPortEvent* ev = new AddPortEvent(_responder, path, data_type, direction);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new AddPortEvent(_responder, timestamp, path, data_type, direction));
}
@@ -134,14 +134,14 @@ QueuedEngineInterface::create_node(const string& path,
const string& plugin_uri,
bool polyphonic)
{
+ const samplecount timestamp = om->audio_driver()->time_stamp();
// FIXME: ew
Plugin* plugin = new Plugin();
plugin->set_type(plugin_type);
plugin->uri(plugin_uri);
- AddNodeEvent* ev = new AddNodeEvent(_responder, path, plugin, polyphonic);
- push(ev);
+ push_queued(new AddNodeEvent(_responder, timestamp, path, plugin, polyphonic));
}
@@ -152,6 +152,7 @@ QueuedEngineInterface::create_node(const string& path,
const string& plugin_label,
bool polyphonic)
{
+ const samplecount timestamp = om->audio_driver()->time_stamp();
// FIXME: ew
Plugin* plugin = new Plugin();
@@ -159,46 +160,47 @@ QueuedEngineInterface::create_node(const string& path,
plugin->lib_name(plugin_lib);
plugin->plug_label(plugin_label);
- AddNodeEvent* ev = new AddNodeEvent(_responder, path, plugin, polyphonic);
- push(ev);
+ push_queued(new AddNodeEvent(_responder, timestamp, path, plugin, polyphonic));
}
void
QueuedEngineInterface::rename(const string& old_path,
const string& new_name)
{
- RenameEvent* ev = new RenameEvent(_responder, old_path, new_name);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new RenameEvent(_responder, timestamp, old_path, new_name));
}
void
QueuedEngineInterface::destroy(const string& path)
{
- DestroyEvent* ev = new DestroyEvent(_responder, this, path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DestroyEvent(_responder, timestamp, this, path));
}
void
QueuedEngineInterface::clear_patch(const string& patch_path)
{
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new ClearPatchEvent(_responder, timestamp, patch_path));
}
void
QueuedEngineInterface::enable_patch(const string& patch_path)
{
- EnablePatchEvent* ev = new EnablePatchEvent(_responder, patch_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new EnablePatchEvent(_responder, timestamp, patch_path));
}
void
QueuedEngineInterface::disable_patch(const string& patch_path)
{
- DisablePatchEvent* ev = new DisablePatchEvent(_responder, patch_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DisablePatchEvent(_responder, timestamp, patch_path));
}
@@ -206,8 +208,8 @@ void
QueuedEngineInterface::connect(const string& src_port_path,
const string& dst_port_path)
{
- ConnectionEvent* ev = new ConnectionEvent(_responder, src_port_path, dst_port_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new ConnectionEvent(_responder, timestamp, src_port_path, dst_port_path));
}
@@ -216,16 +218,16 @@ void
QueuedEngineInterface::disconnect(const string& src_port_path,
const string& dst_port_path)
{
- DisconnectionEvent* ev = new DisconnectionEvent(_responder, src_port_path, dst_port_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DisconnectionEvent(_responder, timestamp, src_port_path, dst_port_path));
}
void
QueuedEngineInterface::disconnect_all(const string& node_path)
{
- DisconnectNodeEvent* ev = new DisconnectNodeEvent(_responder, node_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DisconnectNodeEvent(_responder, timestamp, node_path));
}
@@ -233,8 +235,8 @@ void
QueuedEngineInterface::set_port_value(const string& port_path,
float value)
{
- SetPortValueEvent* ev = new SetPortValueEvent(_responder, port_path, value);
- om->event_queue()->push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_stamped(new SetPortValueEvent(_responder, timestamp, port_path, value));
}
@@ -243,8 +245,8 @@ QueuedEngineInterface::set_port_value(const string& port_path,
uint32_t voice,
float value)
{
- SetPortValueEvent* ev = new SetPortValueEvent(_responder, voice, port_path, value);
- om->event_queue()->push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_stamped(new SetPortValueEvent(_responder, timestamp, voice, port_path, value));
}
@@ -252,8 +254,8 @@ void
QueuedEngineInterface::set_port_value_queued(const string& port_path,
float value)
{
- SetPortValueQueuedEvent* ev = new SetPortValueQueuedEvent(_responder, port_path, value);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new SetPortValueQueuedEvent(_responder, timestamp, port_path, value));
}
@@ -262,15 +264,16 @@ QueuedEngineInterface::set_program(const string& node_path,
uint32_t bank,
uint32_t program)
{
- push(new DSSIProgramEvent(_responder, node_path, bank, program));
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new DSSIProgramEvent(_responder, timestamp, node_path, bank, program));
}
void
QueuedEngineInterface::midi_learn(const string& node_path)
{
- MidiLearnEvent* ev = new MidiLearnEvent(_responder, node_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new MidiLearnEvent(_responder, timestamp, node_path));
}
@@ -279,10 +282,8 @@ QueuedEngineInterface::set_metadata(const string& path,
const string& predicate,
const string& value)
{
- SetMetadataEvent* ev = new SetMetadataEvent(_responder,
- path, predicate, value);
-
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new SetMetadataEvent(_responder, timestamp, path, predicate, value));
}
@@ -291,32 +292,32 @@ QueuedEngineInterface::set_metadata(const string& path,
void
QueuedEngineInterface::ping()
{
- PingQueuedEvent* ev = new PingQueuedEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new PingQueuedEvent(_responder, timestamp));
}
void
QueuedEngineInterface::request_port_value(const string& port_path)
{
- RequestPortValueEvent* ev = new RequestPortValueEvent(_responder, port_path);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new RequestPortValueEvent(_responder, timestamp, port_path));
}
void
QueuedEngineInterface::request_plugins()
{
- RequestPluginsEvent* ev = new RequestPluginsEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new RequestPluginsEvent(_responder, timestamp));
}
void
QueuedEngineInterface::request_all_objects()
{
- RequestAllObjectsEvent* ev = new RequestAllObjectsEvent(_responder);
- push(ev);
+ const samplecount timestamp = om->audio_driver()->time_stamp();
+ push_queued(new RequestAllObjectsEvent(_responder, timestamp));
}
diff --git a/src/libs/engine/QueuedEngineInterface.h b/src/libs/engine/QueuedEngineInterface.h
index 12afcb65..1292623b 100644
--- a/src/libs/engine/QueuedEngineInterface.h
+++ b/src/libs/engine/QueuedEngineInterface.h
@@ -21,6 +21,7 @@
#include <string>
#include <memory>
#include "util/CountedPtr.h"
+#include "interface/EngineInterface.h"
#include "interface/ClientInterface.h"
#include "interface/ClientKey.h"
#include "QueuedEventSource.h"
@@ -31,6 +32,7 @@ namespace Om {
using Shared::ClientKey;
using Shared::ClientInterface;
+using Shared::EngineInterface;
/** A queued (preprocessed) event source / interface.
@@ -53,10 +55,10 @@ using Shared::ClientInterface;
* events and get pushed directly into the realtime event queue. Should that
* be separated into a different interface/client?
*/
-class QueuedEngineInterface : public Om::QueuedEventSource
+class QueuedEngineInterface : public Om::QueuedEventSource, public EngineInterface
{
public:
- QueuedEngineInterface(size_t queue_size);
+ QueuedEngineInterface(size_t queued_size, size_t stamped_size);
virtual ~QueuedEngineInterface() {}
virtual void set_responder(CountedPtr<Responder> responder);
diff --git a/src/libs/engine/QueuedEvent.h b/src/libs/engine/QueuedEvent.h
index d5cd9701..a46e0376 100644
--- a/src/libs/engine/QueuedEvent.h
+++ b/src/libs/engine/QueuedEvent.h
@@ -45,39 +45,44 @@ public:
/** Process this event into a realtime-suitable event.
*/
virtual void pre_process() {
- assert(m_pre_processed == false);
- m_pre_processed = true;
+ assert(_pre_processed == false);
+ _pre_processed = true;
}
virtual void execute(samplecount offset) {
- assert(m_pre_processed);
+ assert(_pre_processed);
Event::execute(offset);
}
virtual void post_process() {}
/** If this event blocks the prepare phase of other slow events */
- bool is_blocking() { return m_blocking; }
+ bool is_blocking() { return _blocking; }
- bool is_prepared() { return m_pre_processed; }
+ bool is_prepared() { return _pre_processed; }
protected:
// Prevent copies
QueuedEvent(const QueuedEvent& copy);
QueuedEvent& operator=(const QueuedEvent&);
- QueuedEvent(CountedPtr<Responder> responder, bool blocking = false, QueuedEventSource* source=NULL)
- : Event(responder), m_pre_processed(false), m_blocking(blocking), m_source(source)
+ QueuedEvent(CountedPtr<Responder> responder,
+ samplecount timestamp,
+ bool blocking = false,
+ QueuedEventSource* source = NULL)
+ : Event(responder, timestamp)
+ , _pre_processed(false), _blocking(blocking), _source(source)
{}
// NULL event base (for internal events only!)
QueuedEvent()
- : Event(), m_pre_processed(false), m_blocking(false), m_source(NULL)
+ : Event(NULL, 0)
+ , _pre_processed(false), _blocking(false), _source(NULL)
{}
- bool m_pre_processed;
- bool m_blocking;
- QueuedEventSource* m_source;
+ bool _pre_processed;
+ bool _blocking;
+ QueuedEventSource* _source;
};
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 8254f3c8..ba05a0c1 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -24,12 +24,13 @@ using std::cout; using std::cerr; using std::endl;
namespace Om {
-QueuedEventSource::QueuedEventSource(size_t size)
+QueuedEventSource::QueuedEventSource(size_t queued_size, size_t stamped_size)
: _front(0),
_back(0),
_prepared_back(0),
- _size(size+1),
- _blocking_semaphore(0)
+ _size(queued_size+1),
+ _blocking_semaphore(0),
+ _stamped_queue(stamped_size)
{
_events = (QueuedEvent**)calloc(_size, sizeof(QueuedEvent*));
@@ -39,7 +40,7 @@ QueuedEventSource::QueuedEventSource(size_t size)
QueuedEventSource::~QueuedEventSource()
{
- stop();
+ Thread::stop();
free(_events);
}
@@ -48,7 +49,7 @@ QueuedEventSource::~QueuedEventSource()
/** Push an unprepared event onto the queue.
*/
void
-QueuedEventSource::push(QueuedEvent* const ev)
+QueuedEventSource::push_queued(QueuedEvent* const ev)
{
assert(!ev->is_prepared());
@@ -58,21 +59,30 @@ QueuedEventSource::push(QueuedEvent* const ev)
} else {
_events[_back] = ev;
_back = (_back + 1) % _size;
- signal();
+ whip();
}
}
-/** Pops the prepared event at the front of the queue, if it exists.
+void
+QueuedEventSource::push_stamped(Event* const ev)
+{
+ _stamped_queue.push(ev);
+}
+
+/** 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
* stamped before the time passed. In other words, it may return NULL
* even if there are events pending in the queue. The events returned are
* actually QueuedEvents, but after this they are "normal" events and the
- * engine deals with them just like a realtime in-band event.
+ * engine deals with them just like a realtime in-band event. The engine will
+ * not use the timestamps of the returned events in any way, since it is free
+ * to execute these non-time-stamped events whenever it wants (at whatever rate
+ * it wants).
*/
Event*
-QueuedEventSource::pop_earliest_before(const samplecount time)
+QueuedEventSource::pop_earliest_queued_before(const samplecount time)
{
QueuedEvent* const front_event = _events[_front];
@@ -102,18 +112,19 @@ QueuedEventSource::unblock()
}
+/** Pre-process a single event */
void
-QueuedEventSource::_signalled()
+QueuedEventSource::_whipped()
{
QueuedEvent* const ev = _events[_prepared_back];
- assert(ev != NULL);
-
+
+ assert(ev);
if (ev == NULL) {
cerr << "[QueuedEventSource] ERROR: Signalled, but event is NULL." << endl;
return;
}
- assert(ev != NULL);
+ assert(ev);
assert(!ev->is_prepared());
ev->pre_process();
diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h
index c3e6904a..9d450a27 100644
--- a/src/libs/engine/QueuedEventSource.h
+++ b/src/libs/engine/QueuedEventSource.h
@@ -21,12 +21,13 @@
#include <pthread.h>
#include "types.h"
#include "util/Semaphore.h"
+#include "util/Queue.h"
#include "Slave.h"
+#include "Event.h"
#include "EventSource.h"
namespace Om {
-class Event;
class QueuedEvent;
@@ -35,28 +36,32 @@ class QueuedEvent;
* Implemented as a deque (ringbuffer) in a circular array. Pushing and
* popping are threadsafe, as long as a single thread pushes and a single
* thread pops (ie this data structure is threadsafe, but the push and pop
- * methods themselves are not).
+ * methods themselves are not). Creating an instance of this class spawns
+ * a pre-processing thread to prepare queued events.
*
* This class is it's own slave. :)
*/
class QueuedEventSource : public EventSource, protected Slave
{
public:
- QueuedEventSource(size_t size);
+ QueuedEventSource(size_t queued_size, size_t stamped_size);
~QueuedEventSource();
- void start() { Thread::start(); }
- void stop() { Thread::stop(); }
+ void activate() { Slave::start(); }
+ void deactivate() { Slave::stop(); }
- Event* pop_earliest_before(const samplecount time);
+ Event* pop_earliest_queued_before(const samplecount time);
+ inline Event* pop_earliest_stamped_before(const samplecount time);
void unblock();
protected:
- void push(QueuedEvent* const ev);
+ void push_queued(QueuedEvent* const ev);
+ void push_stamped(Event* const ev);
+
bool unprepared_events() { return (_prepared_back != _back); }
- virtual void _signalled(); ///< Prepare 1 event
+ virtual void _whipped(); ///< Prepare 1 event
private:
// Prevent copies (undefined)
@@ -66,15 +71,35 @@ private:
// Note that it's crucially important which functions access which of these
// variables, to maintain threadsafeness.
+ //(FIXME: make this a separate class?)
+ // 2-part queue for events that require pre-processing:
size_t _front; ///< Front of queue
size_t _back; ///< Back of entire queue (1 past index of back element)
size_t _prepared_back; ///< Back of prepared section (1 past index of back prepared element)
const size_t _size;
QueuedEvent** _events;
Semaphore _blocking_semaphore;
+
+ /** Queue for timestamped events (no pre-processing). */
+ Queue<Event*> _stamped_queue;
};
+/** Pops the realtime (timestamped, not preprocessed) event off the realtime queue.
+ *
+ * Engine will use the sample timestamps of returned events directly and execute the
+ * event with sample accuracy. Timestamps in the past will be bumped forward to
+ * the beginning of the cycle (offset 0), when eg. skipped cycles occur.
+ */
+inline Event*
+QueuedEventSource::pop_earliest_stamped_before(const samplecount time)
+{
+ if (!_stamped_queue.is_empty() && _stamped_queue.front()->time_stamp() < time)
+ return _stamped_queue.pop();
+ return NULL;
+}
+
+
} // namespace Om
#endif // QUEUEDEVENTSOURCE_H
diff --git a/src/libs/engine/Slave.h b/src/libs/engine/Slave.h
index e6cc8ed5..9b2b01bd 100644
--- a/src/libs/engine/Slave.h
+++ b/src/libs/engine/Slave.h
@@ -31,25 +31,26 @@ namespace Om {
class Slave : public Thread
{
public:
- Slave() : _semaphore(0) {}
+ Slave() : _whip(0) {}
- inline void signal() { _semaphore.post(); }
+ /** Tell the slave to do whatever work it does. Realtime safe. */
+ inline void whip() { _whip.post(); }
protected:
- virtual void _signalled() = 0;
+ virtual void _whipped() = 0;
- Semaphore _semaphore;
+ Semaphore _whip;
private:
// Prevent copies
Slave(const Slave&);
Slave& operator=(const Slave&);
- void _run()
+ inline void _run()
{
while (true) {
- _semaphore.wait();
- _signalled();
+ _whip.wait();
+ _whipped();
}
}
};
diff --git a/src/libs/engine/events/ActivateEvent.cpp b/src/libs/engine/events/ActivateEvent.cpp
index 716a0326..06dabddd 100644
--- a/src/libs/engine/events/ActivateEvent.cpp
+++ b/src/libs/engine/events/ActivateEvent.cpp
@@ -22,8 +22,8 @@
namespace Om {
-ActivateEvent::ActivateEvent(CountedPtr<Responder> responder)
-: QueuedEvent(responder)
+ActivateEvent::ActivateEvent(CountedPtr<Responder> responder, samplecount timestamp)
+: QueuedEvent(responder, timestamp)
{
}
@@ -42,9 +42,9 @@ void
ActivateEvent::post_process()
{
if (om != NULL)
- m_responder->respond_ok();
+ _responder->respond_ok();
else
- m_responder->respond_error("Not ready to activate yet.");
+ _responder->respond_error("Not ready to activate yet.");
}
diff --git a/src/libs/engine/events/ActivateEvent.h b/src/libs/engine/events/ActivateEvent.h
index 65831f05..a144fb88 100644
--- a/src/libs/engine/events/ActivateEvent.h
+++ b/src/libs/engine/events/ActivateEvent.h
@@ -29,7 +29,7 @@ namespace Om {
class ActivateEvent : public QueuedEvent
{
public:
- ActivateEvent(CountedPtr<Responder> responder);
+ ActivateEvent(CountedPtr<Responder> responder, samplecount timestamp);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp
index 1ad693dc..08011223 100644
--- a/src/libs/engine/events/AddNodeEvent.cpp
+++ b/src/libs/engine/events/AddNodeEvent.cpp
@@ -34,8 +34,8 @@
namespace Om {
-AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, const string& path, Plugin* plugin, bool poly)
-: QueuedEvent(responder),
+AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly)
+: QueuedEvent(responder, timestamp),
m_path(path),
m_plugin(plugin),
m_poly(poly),
@@ -107,17 +107,17 @@ AddNodeEvent::post_process()
string msg;
if (m_node_already_exists) {
msg = string("Could not create node - ").append(m_path);// + " already exists.";
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_patch == NULL) {
msg = "Could not find patch '" + m_path.parent() +"' for add_node.";
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_node == NULL) {
msg = "Unable to load node ";
msg.append(m_path).append(" (you're missing the plugin \"").append(
m_plugin->lib_name()).append(":").append(m_plugin->plug_label()).append("\")");;
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else {
- m_responder->respond_ok();
+ _responder->respond_ok();
//om->client_broadcaster()->send_node_creation_messages(m_node);
om->client_broadcaster()->send_node(m_node);
}
diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h
index eb02ddd5..cc5cc294 100644
--- a/src/libs/engine/events/AddNodeEvent.h
+++ b/src/libs/engine/events/AddNodeEvent.h
@@ -39,7 +39,7 @@ class Plugin;
class AddNodeEvent : public QueuedEvent
{
public:
- AddNodeEvent(CountedPtr<Responder> responder, const string& path, Plugin* plugin, bool poly);
+ AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly);
~AddNodeEvent();
void pre_process();
diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp
index 4c530227..ba7b28f8 100644
--- a/src/libs/engine/events/AddPortEvent.cpp
+++ b/src/libs/engine/events/AddPortEvent.cpp
@@ -37,8 +37,8 @@
namespace Om {
-AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, const string& path, const string& type, bool is_output)
-: QueuedEvent(responder),
+AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output)
+: QueuedEvent(responder, timestamp),
_path(path),
_type(type),
_is_output(is_output),
@@ -124,9 +124,9 @@ AddPortEvent::post_process()
{
if (!_patch_port) {
const string msg = string("Could not create port - ").append(_path);
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_port(_patch_port);
}
}
diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h
index 2ccf2f78..afc02a51 100644
--- a/src/libs/engine/events/AddPortEvent.h
+++ b/src/libs/engine/events/AddPortEvent.h
@@ -41,7 +41,7 @@ class DriverPort;
class AddPortEvent : public QueuedEvent
{
public:
- AddPortEvent(CountedPtr<Responder> responder, const string& path, const string& type, bool is_output);
+ AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp
index ae411ab9..4fe6a1d2 100644
--- a/src/libs/engine/events/AllNotesOffEvent.cpp
+++ b/src/libs/engine/events/AllNotesOffEvent.cpp
@@ -25,8 +25,8 @@ namespace Om {
/** Note off with patch explicitly passed - triggered by MIDI.
*/
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch)
-: Event(responder),
+AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch)
+: Event(responder, timestamp),
m_patch(patch)
{
}
@@ -34,8 +34,8 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch
/** Note off event with lookup - triggered by OSC.
*/
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, const string& patch_path)
-: Event(responder),
+AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path)
+: Event(responder, timestamp),
m_patch(NULL),
m_patch_path(patch_path)
{
@@ -58,7 +58,7 @@ void
AllNotesOffEvent::post_process()
{
if (m_patch != NULL)
- m_responder->respond_ok();
+ _responder->respond_ok();
}
diff --git a/src/libs/engine/events/AllNotesOffEvent.h b/src/libs/engine/events/AllNotesOffEvent.h
index 51d33b26..dc6aeb90 100644
--- a/src/libs/engine/events/AllNotesOffEvent.h
+++ b/src/libs/engine/events/AllNotesOffEvent.h
@@ -33,8 +33,8 @@ class Patch;
class AllNotesOffEvent : public Event
{
public:
- AllNotesOffEvent(CountedPtr<Responder> responder, Patch* patch);
- AllNotesOffEvent(CountedPtr<Responder> responder, const string& patch_path);
+ AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch);
+ AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path);
void execute(samplecount offset);
void post_process();
diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp
index 1f60a5a7..e72e554a 100644
--- a/src/libs/engine/events/ClearPatchEvent.cpp
+++ b/src/libs/engine/events/ClearPatchEvent.cpp
@@ -31,7 +31,7 @@
namespace Om {
-ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, const string& patch_path)
+ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path)
: QueuedEvent(responder, true),
m_patch_path(patch_path),
m_patch(NULL),
@@ -100,13 +100,13 @@ ClearPatchEvent::post_process()
assert(m_patch->connections().size() == 0);
// Reply
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_patch_cleared(m_patch_path);
} else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
+ _responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
- m_source->unblock();
+ _source->unblock();
}
diff --git a/src/libs/engine/events/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h
index d0b17fe0..88effdce 100644
--- a/src/libs/engine/events/ClearPatchEvent.h
+++ b/src/libs/engine/events/ClearPatchEvent.h
@@ -35,7 +35,7 @@ class Patch;
class ClearPatchEvent : public QueuedEvent
{
public:
- ClearPatchEvent(CountedPtr<Responder> responder, const string& patch_path);
+ ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index 0faff865..17e43147 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -17,6 +17,7 @@
#include "ConnectionEvent.h"
#include <string>
#include "Responder.h"
+#include "types.h"
#include "Om.h"
#include "OmApp.h"
#include "TypedConnection.h"
@@ -36,8 +37,8 @@ namespace Om {
//// ConnectionEvent ////
-ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder),
+ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(responder, timestamp),
m_src_port_path(src_port_path),
m_dst_port_path(dst_port_path),
m_patch(NULL),
@@ -104,10 +105,10 @@ ConnectionEvent::pre_process()
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
- m_typed_event = new TypedConnectionEvent<sample>(m_responder,
+ m_typed_event = new TypedConnectionEvent<sample>(_responder, _time_stamp,
dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
- m_typed_event = new TypedConnectionEvent<MidiMessage>(m_responder,
+ m_typed_event = new TypedConnectionEvent<MidiMessage>(_responder, _time_stamp,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
@@ -140,7 +141,7 @@ ConnectionEvent::post_process()
// FIXME: better error messages
string msg = "Unable to make connection ";
msg.append(m_src_port_path + " -> " + m_dst_port_path);
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
@@ -150,8 +151,8 @@ ConnectionEvent::post_process()
template <typename T>
-TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(responder),
+TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
+: QueuedEvent(responder, timestamp),
m_src_port(src_port),
m_dst_port(dst_port),
m_patch(NULL),
@@ -248,11 +249,11 @@ TypedConnectionEvent<T>::post_process()
if (m_succeeded) {
assert(m_connection != NULL);
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_connection(m_connection);
} else {
- m_responder->respond_error("Unable to make connection.");
+ _responder->respond_error("Unable to make connection.");
}
}
diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h
index 23bedcef..ea380130 100644
--- a/src/libs/engine/events/ConnectionEvent.h
+++ b/src/libs/engine/events/ConnectionEvent.h
@@ -46,7 +46,7 @@ template <typename T> class TypedConnectionEvent; // helper, defined below
class ConnectionEvent : public QueuedEvent
{
public:
- ConnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path);
+ ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path);
~ConnectionEvent();
void pre_process();
@@ -80,7 +80,7 @@ template <typename T>
class TypedConnectionEvent : public QueuedEvent
{
public:
- TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 61bd2827..56720b06 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -31,8 +31,8 @@
namespace Om {
-CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, const string& path, int poly)
-: QueuedEvent(responder),
+CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly)
+: QueuedEvent(responder, timestamp),
m_path(path),
m_patch(NULL),
m_parent(NULL),
@@ -116,10 +116,10 @@ CreatePatchEvent::execute(samplecount offset)
void
CreatePatchEvent::post_process()
{
- if (m_responder.get()) {
+ if (_responder.get()) {
if (m_error == NO_ERROR) {
- m_responder->respond_ok();
+ _responder->respond_ok();
// Don't want to send nodes that have been added since prepare()
//om->client_broadcaster()->send_node_creation_messages(m_patch);
@@ -130,17 +130,17 @@ CreatePatchEvent::post_process()
} else if (m_error == OBJECT_EXISTS) {
string msg = "Unable to create patch: ";
msg += m_path += " already exists.";
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_error == PARENT_NOT_FOUND) {
string msg = "Unable to create patch: Parent ";
msg += m_path.parent() += " not found.";
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_error == INVALID_POLY) {
string msg = "Unable to create patch ";
msg.append(m_path).append(": ").append("Invalid polyphony respondered.");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else {
- m_responder->respond_error("Unable to load patch.");
+ _responder->respond_error("Unable to load patch.");
}
}
}
diff --git a/src/libs/engine/events/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h
index 4583efd9..f83def15 100644
--- a/src/libs/engine/events/CreatePatchEvent.h
+++ b/src/libs/engine/events/CreatePatchEvent.h
@@ -39,7 +39,7 @@ class Plugin;
class CreatePatchEvent : public QueuedEvent
{
public:
- CreatePatchEvent(CountedPtr<Responder> responder, const string& path, int poly);
+ CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp
index a16ebe4c..9e045c9c 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.cpp
+++ b/src/libs/engine/events/DSSIConfigureEvent.cpp
@@ -25,8 +25,8 @@
namespace Om {
-DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, const string& node_path, const string& key, const string& val)
-: QueuedEvent(responder),
+DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val)
+: QueuedEvent(responder, timestamp),
m_node_path(node_path),
m_key(key),
m_val(val),
diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h
index f8ef2aa6..19baf7d6 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.h
+++ b/src/libs/engine/events/DSSIConfigureEvent.h
@@ -30,7 +30,7 @@ namespace Om {
class DSSIConfigureEvent : public QueuedEvent
{
public:
- DSSIConfigureEvent(CountedPtr<Responder> responder, const string& node_path, const string& key, const string& val);
+ DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp
index f326ca72..fc7dc6b5 100644
--- a/src/libs/engine/events/DSSIControlEvent.cpp
+++ b/src/libs/engine/events/DSSIControlEvent.cpp
@@ -24,8 +24,8 @@
namespace Om {
-DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, const string& node_path, int port_num, sample val)
-: QueuedEvent(responder),
+DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val)
+: QueuedEvent(responder, timestamp),
m_node_path(node_path),
m_port_num(port_num),
m_val(val),
diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h
index de636445..95048d0a 100644
--- a/src/libs/engine/events/DSSIControlEvent.h
+++ b/src/libs/engine/events/DSSIControlEvent.h
@@ -32,7 +32,7 @@ namespace Om {
class DSSIControlEvent : public QueuedEvent
{
public:
- DSSIControlEvent(CountedPtr<Responder> responder, const string& node_path, int port_num, sample val);
+ DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp
index 9a869c73..3f64d3d2 100644
--- a/src/libs/engine/events/DSSIProgramEvent.cpp
+++ b/src/libs/engine/events/DSSIProgramEvent.cpp
@@ -29,8 +29,8 @@ using std::cout; using std::cerr; using std::endl;
namespace Om {
-DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, const string& node_path, int bank, int program)
-: QueuedEvent(responder),
+DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program)
+: QueuedEvent(responder, timestamp),
m_node_path(node_path),
m_bank(bank),
m_program(program),
diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h
index 49207ca1..9868d2ce 100644
--- a/src/libs/engine/events/DSSIProgramEvent.h
+++ b/src/libs/engine/events/DSSIProgramEvent.h
@@ -30,7 +30,7 @@ namespace Om {
class DSSIProgramEvent : public QueuedEvent
{
public:
- DSSIProgramEvent(CountedPtr<Responder> responder, const string& node_path, int bank, int program);
+ DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp
index d32466d4..8cb7e4bc 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.cpp
+++ b/src/libs/engine/events/DSSIUpdateEvent.cpp
@@ -28,8 +28,8 @@ using std::cerr; using std::endl;
namespace Om {
-DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, const string& path, const string& url)
-: QueuedEvent(responder),
+DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url)
+: QueuedEvent(responder, timestamp),
m_path(path),
m_url(url),
m_node(NULL)
diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h
index 25a77f02..a48cd7b4 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.h
+++ b/src/libs/engine/events/DSSIUpdateEvent.h
@@ -36,7 +36,7 @@ class DSSINode;
class DSSIUpdateEvent : public QueuedEvent
{
public:
- DSSIUpdateEvent(CountedPtr<Responder> responder, const string& path, const string& url);
+ DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp
index 22434cbe..fef3ece6 100644
--- a/src/libs/engine/events/DeactivateEvent.cpp
+++ b/src/libs/engine/events/DeactivateEvent.cpp
@@ -22,8 +22,8 @@
namespace Om {
-DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder)
-: QueuedEvent(responder)
+DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp)
+: QueuedEvent(responder, timestamp)
{
}
@@ -45,7 +45,7 @@ DeactivateEvent::execute(samplecount offset)
void
DeactivateEvent::post_process()
{
- m_responder->respond_ok();
+ _responder->respond_ok();
om->deactivate();
}
diff --git a/src/libs/engine/events/DeactivateEvent.h b/src/libs/engine/events/DeactivateEvent.h
index 35c96e78..7e540ba8 100644
--- a/src/libs/engine/events/DeactivateEvent.h
+++ b/src/libs/engine/events/DeactivateEvent.h
@@ -29,7 +29,7 @@ namespace Om {
class DeactivateEvent : public QueuedEvent
{
public:
- DeactivateEvent(CountedPtr<Responder> responder);
+ DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 383f1d34..fec3f3c0 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -35,7 +35,7 @@
namespace Om {
-DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex)
+DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex)
: QueuedEvent(responder, true, source),
m_path(path),
m_node(NULL),
@@ -48,7 +48,7 @@ DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* s
}
-DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, Node* node, bool lock_mutex)
+DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, bool lock_mutex)
: QueuedEvent(responder, true),
m_path(node->path()),
m_node(node),
@@ -139,17 +139,17 @@ DestroyEvent::execute(samplecount offset)
void
DestroyEvent::post_process()
{
- assert(m_source);
- m_source->unblock();
+ assert(_source);
+ _source->unblock();
if (m_node == NULL) {
if (m_path == "/")
- m_responder->respond_error("You can not destroy the root patch (/)");
+ _responder->respond_error("You can not destroy the root patch (/)");
else
- m_responder->respond_error("Could not find node to destroy");
+ _responder->respond_error("Could not find node to destroy");
} else if (m_patch_listnode != NULL) {
m_node->deactivate();
- m_responder->respond_ok();
+ _responder->respond_ok();
if (m_disconnect_event != NULL)
m_disconnect_event->post_process();
if (m_parent_disconnect_event != NULL)
@@ -158,7 +158,7 @@ DestroyEvent::post_process()
om->maid()->push(m_patch_listnode);
om->maid()->push(m_node);
} else {
- m_responder->respond_error("Unable to destroy object");
+ _responder->respond_error("Unable to destroy object");
}
}
diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h
index 1f26ed90..1fcbd171 100644
--- a/src/libs/engine/events/DestroyEvent.h
+++ b/src/libs/engine/events/DestroyEvent.h
@@ -44,8 +44,8 @@ class DisconnectPortEvent;
class DestroyEvent : public QueuedEvent
{
public:
- DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex = true);
- DestroyEvent(CountedPtr<Responder> responder, Node* node, bool lock_mutex = true);
+ DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex = true);
+ DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, bool lock_mutex = true);
~DestroyEvent();
void pre_process();
diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp
index c896d943..67f84fa2 100644
--- a/src/libs/engine/events/DisablePatchEvent.cpp
+++ b/src/libs/engine/events/DisablePatchEvent.cpp
@@ -27,8 +27,8 @@
namespace Om {
-DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, const string& patch_path)
-: QueuedEvent(responder),
+DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path)
+: QueuedEvent(responder, timestamp),
m_patch_path(patch_path),
m_patch(NULL)
{
@@ -58,10 +58,10 @@ void
DisablePatchEvent::post_process()
{
if (m_patch != NULL) {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_patch_disable(m_patch_path);
} else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
+ _responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
}
diff --git a/src/libs/engine/events/DisablePatchEvent.h b/src/libs/engine/events/DisablePatchEvent.h
index 708e269b..6df64e40 100644
--- a/src/libs/engine/events/DisablePatchEvent.h
+++ b/src/libs/engine/events/DisablePatchEvent.h
@@ -34,7 +34,7 @@ class Patch;
class DisablePatchEvent : public QueuedEvent
{
public:
- DisablePatchEvent(CountedPtr<Responder> responder, const string& patch_path);
+ DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 22c2459e..5f2a483a 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -39,8 +39,8 @@ using std::cerr; using std::endl;
namespace Om {
-DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, const string& node_path)
-: QueuedEvent(responder),
+DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path)
+: QueuedEvent(responder, timestamp),
m_node_path(node_path),
m_patch(NULL),
m_node(NULL),
@@ -99,7 +99,8 @@ DisconnectNodeEvent::pre_process()
for (ConnectionListIterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
c = (*i);
if ((c->src_port()->parent_node() == m_node || c->dst_port()->parent_node() == m_node) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), c->src_port(), c->dst_port());
+ DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp,
+ c->src_port(), c->dst_port());
ev->pre_process();
m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev));
c->pending_disconnection(true);
@@ -127,13 +128,13 @@ void
DisconnectNodeEvent::post_process()
{
if (m_succeeded) {
- if (m_responder)
- m_responder->respond_ok();
+ if (_responder)
+ _responder->respond_ok();
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
(*i)->post_process();
} else {
- if (m_responder)
- m_responder->respond_error("Unable to disconnect all ports.");
+ if (_responder)
+ _responder->respond_error("Unable to disconnect all ports.");
}
}
diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h
index 40e6c086..31c32f2e 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.h
+++ b/src/libs/engine/events/DisconnectNodeEvent.h
@@ -42,7 +42,7 @@ template <typename T> class OutputPort;
class DisconnectNodeEvent : public QueuedEvent
{
public:
- DisconnectNodeEvent(CountedPtr<Responder> responder, const string& node_path);
+ DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path);
DisconnectNodeEvent(Node* node);
~DisconnectNodeEvent();
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
index 2ec408d6..bfb238c6 100644
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ b/src/libs/engine/events/DisconnectPortEvent.cpp
@@ -39,8 +39,8 @@ using std::cerr; using std::endl;
namespace Om {
-DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, const string& port_path)
-: QueuedEvent(responder),
+DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path)
+: QueuedEvent(responder, timestamp),
m_port_path(port_path),
m_patch(NULL),
m_port(NULL),
@@ -104,7 +104,8 @@ DisconnectPortEvent::pre_process()
for (List<Connection*>::const_iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
c = (*i);
if ((c->src_port() == m_port || c->dst_port() == m_port) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), c->src_port(), c->dst_port());
+ DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr<Responder>(new Responder()), _time_stamp,
+ c->src_port(), c->dst_port());
ev->pre_process();
m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev));
c->pending_disconnection(true);
@@ -132,11 +133,11 @@ void
DisconnectPortEvent::post_process()
{
if (m_succeeded) {
- m_responder->respond_ok();
+ _responder->respond_ok();
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
(*i)->post_process();
} else {
- m_responder->respond_error("Unable to disconnect port.");
+ _responder->respond_error("Unable to disconnect port.");
}
}
diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h
index 82e0ef90..31113a63 100644
--- a/src/libs/engine/events/DisconnectPortEvent.h
+++ b/src/libs/engine/events/DisconnectPortEvent.h
@@ -43,7 +43,7 @@ using std::string;
class DisconnectPortEvent : public QueuedEvent
{
public:
- DisconnectPortEvent(CountedPtr<Responder> responder, const string& port_path);
+ DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path);
DisconnectPortEvent(Port* port);
~DisconnectPortEvent();
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index 3d7a16d8..7bd5edd9 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -36,8 +36,8 @@ namespace Om {
//// DisconnectionEvent ////
-DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder),
+DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(responder, timestamp),
m_src_port_path(src_port_path),
m_dst_port_path(dst_port_path),
m_patch(NULL),
@@ -50,8 +50,8 @@ DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, const st
}
-DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, Port* const src_port, Port* const dst_port)
-: QueuedEvent(responder),
+DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, Port* const src_port, Port* const dst_port)
+: QueuedEvent(responder, timestamp),
m_src_port_path(src_port->path()),
m_dst_port_path(dst_port->path()),
m_patch(src_port->parent_node()->parent_patch()),
@@ -113,10 +113,10 @@ DisconnectionEvent::pre_process()
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
- m_typed_event = new TypedDisconnectionEvent<sample>(m_responder,
+ m_typed_event = new TypedDisconnectionEvent<sample>(_responder, _time_stamp,
dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
- m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder,
+ m_typed_event = new TypedDisconnectionEvent<MidiMessage>(_responder, _time_stamp,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
@@ -150,7 +150,7 @@ DisconnectionEvent::post_process()
// FIXME: better error messages
string msg = "Unable to disconnect ";
msg.append(m_src_port_path + " -> " + m_dst_port_path);
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
@@ -160,8 +160,8 @@ DisconnectionEvent::post_process()
template <typename T>
-TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(responder),
+TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
+: QueuedEvent(responder, timestamp),
m_src_port(src_port),
m_dst_port(dst_port),
m_patch(NULL),
@@ -270,11 +270,11 @@ TypedDisconnectionEvent<T>::post_process()
{
if (m_succeeded) {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path());
} else {
- m_responder->respond_error("Unable to disconnect ports.");
+ _responder->respond_error("Unable to disconnect ports.");
}
}
diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h
index 43b2d841..cf37976d 100644
--- a/src/libs/engine/events/DisconnectionEvent.h
+++ b/src/libs/engine/events/DisconnectionEvent.h
@@ -46,8 +46,8 @@ template <typename T> class TypedDisconnectionEvent; // helper, defined below
class DisconnectionEvent : public QueuedEvent
{
public:
- DisconnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path);
- DisconnectionEvent(CountedPtr<Responder> responder, Port* const src_port, Port* const dst_port);
+ DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path);
+ DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, Port* const src_port, Port* const dst_port);
~DisconnectionEvent();
void pre_process();
@@ -82,7 +82,7 @@ template <typename T>
class TypedDisconnectionEvent : public QueuedEvent
{
public:
- TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp
index eee50dac..7ce7dd27 100644
--- a/src/libs/engine/events/EnablePatchEvent.cpp
+++ b/src/libs/engine/events/EnablePatchEvent.cpp
@@ -26,8 +26,8 @@
namespace Om {
-EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, const string& patch_path)
-: QueuedEvent(responder),
+EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path)
+: QueuedEvent(responder, timestamp),
m_patch_path(patch_path),
m_patch(NULL),
m_process_order(NULL)
@@ -70,10 +70,10 @@ void
EnablePatchEvent::post_process()
{
if (m_patch != NULL) {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_patch_enable(m_patch_path);
} else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
+ _responder->respond_error(string("Patch ") + m_patch_path + " not found");
}
}
diff --git a/src/libs/engine/events/EnablePatchEvent.h b/src/libs/engine/events/EnablePatchEvent.h
index 0c86a100..75b751aa 100644
--- a/src/libs/engine/events/EnablePatchEvent.h
+++ b/src/libs/engine/events/EnablePatchEvent.h
@@ -37,7 +37,7 @@ class Node;
class EnablePatchEvent : public QueuedEvent
{
public:
- EnablePatchEvent(CountedPtr<Responder> responder, const string& patch_path);
+ EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/LashRestoreDoneEvent.h b/src/libs/engine/events/LashRestoreDoneEvent.h
index ed3933a5..31713c4b 100644
--- a/src/libs/engine/events/LashRestoreDoneEvent.h
+++ b/src/libs/engine/events/LashRestoreDoneEvent.h
@@ -39,11 +39,11 @@ class Port;
class LashRestoreDoneEvent : public QueuedEvent
{
public:
- LashRestoreDoneEvent(CountedPtr<Responder> responder) : QueuedEvent(responder) {}
+ LashRestoreDoneEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {}
void post_process()
{
- m_responder->respond_ok();
+ _responder->respond_ok();
lash_driver->restore_finished();
}
};
diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp
index 93099ef0..d1939a6b 100644
--- a/src/libs/engine/events/LoadPluginsEvent.cpp
+++ b/src/libs/engine/events/LoadPluginsEvent.cpp
@@ -20,23 +20,24 @@
#include "OmApp.h"
#include "NodeFactory.h"
+#include <iostream>
+using std::cerr;
+
namespace Om {
-LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder)
-: QueuedEvent(responder)
+LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp)
+: QueuedEvent(responder, timestamp)
{
+ cerr << "LOADING PLUGINS\n";
+ om->node_factory()->load_plugins();
}
void
LoadPluginsEvent::post_process()
{
- // Why is this done here and not in pre_process()???
- om->node_factory()->load_plugins();
- m_responder->respond_ok();
-
- //cerr << "Load plugins post finished\n";
+ _responder->respond_ok();
}
diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h
index 10970cec..b17eb262 100644
--- a/src/libs/engine/events/LoadPluginsEvent.h
+++ b/src/libs/engine/events/LoadPluginsEvent.h
@@ -29,7 +29,7 @@ namespace Om {
class LoadPluginsEvent : public QueuedEvent
{
public:
- LoadPluginsEvent(CountedPtr<Responder> responder);
+ LoadPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp);
void post_process();
};
diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp
index cd9fd8f2..6c7c8613 100644
--- a/src/libs/engine/events/MidiLearnEvent.cpp
+++ b/src/libs/engine/events/MidiLearnEvent.cpp
@@ -38,8 +38,8 @@ MidiLearnResponseEvent::post_process()
// MidiLearnEvent
-MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, const string& node_path)
-: QueuedEvent(responder),
+MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path)
+: QueuedEvent(responder, timestamp),
m_node_path(node_path),
m_node(NULL),
m_response_event(NULL)
@@ -51,7 +51,7 @@ void
MidiLearnEvent::pre_process()
{
m_node = om->object_store()->find_node(m_node_path);
- m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller Number");
+ m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller_Number", _time_stamp);
QueuedEvent::pre_process();
}
@@ -74,11 +74,11 @@ void
MidiLearnEvent::post_process()
{
if (m_node != NULL) {
- m_responder->respond_ok();
+ _responder->respond_ok();
} else {
string msg = "Did not find node '";
msg.append(m_node_path).append("' for MIDI learn.");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/MidiLearnEvent.h b/src/libs/engine/events/MidiLearnEvent.h
index de0dfbe3..320b20c3 100644
--- a/src/libs/engine/events/MidiLearnEvent.h
+++ b/src/libs/engine/events/MidiLearnEvent.h
@@ -37,8 +37,8 @@ class ControlChangeEvent;
class MidiLearnResponseEvent : public Event
{
public:
- MidiLearnResponseEvent(const string& port_path)
- : Event(CountedPtr<Responder>(NULL)),
+ MidiLearnResponseEvent(const string& port_path, samplecount timestamp)
+ : Event(NULL, timestamp),
m_port_path(port_path),
m_value(0.0f)
{}
@@ -64,7 +64,7 @@ private:
class MidiLearnEvent : public QueuedEvent
{
public:
- MidiLearnEvent(CountedPtr<Responder> responder, const string& node_path);
+ MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp
index a84317a5..f4a54d13 100644
--- a/src/libs/engine/events/NoteOffEvent.cpp
+++ b/src/libs/engine/events/NoteOffEvent.cpp
@@ -28,8 +28,8 @@ namespace Om {
/** Note off with patch explicitly passed - triggered by MIDI.
*/
-NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar note_num)
-: Event(responder),
+NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num)
+: Event(responder, timestamp),
m_node(node),
m_note_num(note_num)
{
@@ -38,8 +38,8 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar no
/** Note off event with lookup - triggered by OSC.
*/
-NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num)
-: Event(responder),
+NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num)
+: Event(responder, timestamp),
m_node(NULL),
m_node_path(node_path),
m_note_num(note_num)
@@ -67,9 +67,9 @@ void
NoteOffEvent::post_process()
{
if (m_node != NULL)
- m_responder->respond_ok();
+ _responder->respond_ok();
else
- m_responder->respond_error("Did not find node for note_off");
+ _responder->respond_error("Did not find node for note_off");
}
diff --git a/src/libs/engine/events/NoteOffEvent.h b/src/libs/engine/events/NoteOffEvent.h
index 3a9f715f..05a34a0e 100644
--- a/src/libs/engine/events/NoteOffEvent.h
+++ b/src/libs/engine/events/NoteOffEvent.h
@@ -34,8 +34,8 @@ class Node;
class NoteOffEvent : public Event
{
public:
- NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar note_num);
- NoteOffEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num);
+ NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num);
+ NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num);
void execute(samplecount offset);
void post_process();
diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp
index 4a0ba141..7eeaa597 100644
--- a/src/libs/engine/events/NoteOnEvent.cpp
+++ b/src/libs/engine/events/NoteOnEvent.cpp
@@ -31,8 +31,8 @@ namespace Om {
*
* Used to be triggered by MIDI. Not used anymore.
*/
-NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar note_num, uchar velocity)
-: Event(responder),
+NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* patch, uchar note_num, uchar velocity)
+: Event(responder, timestamp),
m_node(patch),
m_note_num(note_num),
m_velocity(velocity),
@@ -45,8 +45,8 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar not
*
* Triggered by OSC.
*/
-NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num, uchar velocity)
-: Event(responder),
+NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num, uchar velocity)
+: Event(responder, timestamp),
m_node(NULL),
m_node_path(node_path),
m_note_num(note_num),
@@ -78,9 +78,9 @@ NoteOnEvent::post_process()
{
if (m_is_osc_triggered) {
if (m_node != NULL)
- m_responder->respond_ok();
+ _responder->respond_ok();
else
- m_responder->respond_error("Did not find node for note_on");
+ _responder->respond_error("Did not find node for note_on");
}
}
diff --git a/src/libs/engine/events/NoteOnEvent.h b/src/libs/engine/events/NoteOnEvent.h
index af6251e9..8f57eb38 100644
--- a/src/libs/engine/events/NoteOnEvent.h
+++ b/src/libs/engine/events/NoteOnEvent.h
@@ -34,8 +34,8 @@ class Node;
class NoteOnEvent : public Event
{
public:
- NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar note_num, uchar velocity);
- NoteOnEvent(CountedPtr<Responder> responder, const string& node_path, uchar note_num, uchar velocity);
+ NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* patch, uchar note_num, uchar velocity);
+ NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num, uchar velocity);
void execute(samplecount offset);
void post_process();
diff --git a/src/libs/engine/events/PingQueuedEvent.h b/src/libs/engine/events/PingQueuedEvent.h
index 790cf7cc..9f575eea 100644
--- a/src/libs/engine/events/PingQueuedEvent.h
+++ b/src/libs/engine/events/PingQueuedEvent.h
@@ -26,16 +26,17 @@ namespace Om {
class Port;
-/** A "blocking" ping that travels through the event queue before responding.
+/** A ping that travels through the pre-processed event queue before responding
+ * (useful for the order guarantee).
*
* \ingroup engine
*/
class PingQueuedEvent : public QueuedEvent
{
public:
- PingQueuedEvent(CountedPtr<Responder> responder) : QueuedEvent(responder) {}
+ PingQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {}
- void post_process() { m_responder->respond_ok(); }
+ void post_process() { _responder->respond_ok(); }
};
diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp
index d2ea41ab..53a9cda9 100644
--- a/src/libs/engine/events/RegisterClientEvent.cpp
+++ b/src/libs/engine/events/RegisterClientEvent.cpp
@@ -24,9 +24,10 @@ namespace Om {
RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder,
+ samplecount timestamp,
ClientKey key,
CountedPtr<ClientInterface> client)
-: QueuedEvent(responder)
+: QueuedEvent(responder, timestamp)
, _key(key)
, _client(client)
{
@@ -45,7 +46,7 @@ RegisterClientEvent::pre_process()
void
RegisterClientEvent::post_process()
{
- m_responder->respond_ok();
+ _responder->respond_ok();
}
diff --git a/src/libs/engine/events/RegisterClientEvent.h b/src/libs/engine/events/RegisterClientEvent.h
index 6399e5be..2e0bfe16 100644
--- a/src/libs/engine/events/RegisterClientEvent.h
+++ b/src/libs/engine/events/RegisterClientEvent.h
@@ -36,6 +36,7 @@ class RegisterClientEvent : public QueuedEvent
{
public:
RegisterClientEvent(CountedPtr<Responder> responder,
+ samplecount timestamp,
ClientKey key,
CountedPtr<ClientInterface> client);
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 52002774..2f654569 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -28,8 +28,8 @@
namespace Om {
-RenameEvent::RenameEvent(CountedPtr<Responder> responder, const string& path, const string& name)
-: QueuedEvent(responder),
+RenameEvent::RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name)
+: QueuedEvent(responder, timestamp),
m_old_path(path),
m_name(name),
m_new_path(m_old_path.parent().base_path() + name),
@@ -103,7 +103,7 @@ RenameEvent::post_process()
string msg = "Unable to rename object - ";
if (m_error == NO_ERROR) {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_rename(m_old_path, m_new_path);
} else {
if (m_error == OBJECT_EXISTS)
@@ -115,7 +115,7 @@ RenameEvent::post_process()
else if (m_error == INVALID_NAME)
msg.append(m_name).append(" is not a valid name");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/RenameEvent.h b/src/libs/engine/events/RenameEvent.h
index 41e5eec0..40f40d3c 100644
--- a/src/libs/engine/events/RenameEvent.h
+++ b/src/libs/engine/events/RenameEvent.h
@@ -42,7 +42,7 @@ class DisconnectPortEvent;
class RenameEvent : public QueuedEvent
{
public:
- RenameEvent(CountedPtr<Responder> responder, const string& path, const string& name);
+ RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name);
~RenameEvent();
void pre_process();
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp
index 0b8f6255..5e215914 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.cpp
+++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp
@@ -23,8 +23,8 @@
namespace Om {
-RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder)
-: QueuedEvent(responder),
+RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder, samplecount timestamp)
+: QueuedEvent(responder, timestamp),
m_client(CountedPtr<ClientInterface>(NULL))
{
}
@@ -33,7 +33,7 @@ RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder)
void
RequestAllObjectsEvent::pre_process()
{
- m_client = m_responder->find_client();
+ m_client = _responder->find_client();
QueuedEvent::pre_process();
}
@@ -43,10 +43,10 @@ void
RequestAllObjectsEvent::post_process()
{
if (m_client) {
- m_responder->respond_ok();
+ _responder->respond_ok();
ObjectSender::send_all(m_client.get());
} else {
- m_responder->respond_error("Invalid URL");
+ _responder->respond_error("Invalid URL");
}
}
diff --git a/src/libs/engine/events/RequestAllObjectsEvent.h b/src/libs/engine/events/RequestAllObjectsEvent.h
index b5d43f59..70dbc4a3 100644
--- a/src/libs/engine/events/RequestAllObjectsEvent.h
+++ b/src/libs/engine/events/RequestAllObjectsEvent.h
@@ -35,7 +35,7 @@ namespace Shared {
class RequestAllObjectsEvent : public QueuedEvent
{
public:
- RequestAllObjectsEvent(CountedPtr<Responder> responder);
+ RequestAllObjectsEvent(CountedPtr<Responder> responder, samplecount timestamp);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp
index 0590f3b3..c492d0dd 100644
--- a/src/libs/engine/events/RequestMetadataEvent.cpp
+++ b/src/libs/engine/events/RequestMetadataEvent.cpp
@@ -28,8 +28,8 @@ using std::string;
namespace Om {
-RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, const string& node_path, const string& key)
-: QueuedEvent(responder),
+RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key)
+: QueuedEvent(responder, timestamp),
m_path(node_path),
m_key(key),
m_value(""),
@@ -42,7 +42,7 @@ RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, cons
void
RequestMetadataEvent::pre_process()
{
- m_client = m_responder->find_client();
+ m_client = _responder->find_client();
if (m_client) {
m_object = om->object_store()->find(m_path);
@@ -65,13 +65,13 @@ RequestMetadataEvent::post_process()
if (m_value == "") {
string msg = "Unable to find object ";
msg += m_path;
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else {
- m_responder->respond_ok();
+ _responder->respond_ok();
m_client->metadata_update(m_path, m_key, m_value);
}
} else {
- m_responder->respond_error("Unknown client");
+ _responder->respond_error("Unknown client");
}
}
diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h
index d086d7da..97ac46ab 100644
--- a/src/libs/engine/events/RequestMetadataEvent.h
+++ b/src/libs/engine/events/RequestMetadataEvent.h
@@ -37,7 +37,7 @@ namespace Shared {
class RequestMetadataEvent : public QueuedEvent
{
public:
- RequestMetadataEvent(CountedPtr<Responder> responder, const string& path, const string& key);
+ RequestMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp
index 984bddf6..fc29c846 100644
--- a/src/libs/engine/events/RequestPluginsEvent.cpp
+++ b/src/libs/engine/events/RequestPluginsEvent.cpp
@@ -23,8 +23,8 @@
namespace Om {
-RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder)
-: QueuedEvent(responder),
+RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp)
+: QueuedEvent(responder, timestamp),
m_client(CountedPtr<ClientInterface>(NULL))
{
}
@@ -33,7 +33,7 @@ RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder)
void
RequestPluginsEvent::pre_process()
{
- m_client = m_responder->find_client();
+ m_client = _responder->find_client();
QueuedEvent::pre_process();
}
@@ -44,9 +44,9 @@ RequestPluginsEvent::post_process()
{
if (m_client) {
om->client_broadcaster()->send_plugins_to(m_client.get());
- m_responder->respond_ok();
+ _responder->respond_ok();
} else {
- m_responder->respond_error("Invalid URL");
+ _responder->respond_error("Invalid URL");
}
}
diff --git a/src/libs/engine/events/RequestPluginsEvent.h b/src/libs/engine/events/RequestPluginsEvent.h
index b8c76362..0d97deaf 100644
--- a/src/libs/engine/events/RequestPluginsEvent.h
+++ b/src/libs/engine/events/RequestPluginsEvent.h
@@ -36,7 +36,7 @@ namespace Shared {
class RequestPluginsEvent : public QueuedEvent
{
public:
- RequestPluginsEvent(CountedPtr<Responder> responder);
+ RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp);
void pre_process();
void post_process();
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index ac690883..f8036447 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -29,8 +29,8 @@ using std::string;
namespace Om {
-RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, const string& port_path)
-: QueuedEvent(responder),
+RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path)
+: QueuedEvent(responder, timestamp),
m_port_path(port_path),
m_port(NULL),
m_value(0.0),
@@ -42,7 +42,7 @@ RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, co
void
RequestPortValueEvent::pre_process()
{
- m_client = m_responder->find_client();
+ m_client = _responder->find_client();
m_port = om->object_store()->find_port(m_port_path);
QueuedEvent::pre_process();
@@ -66,12 +66,12 @@ RequestPortValueEvent::post_process()
{
string msg;
if (m_port) {
- m_responder->respond_error("Unable to find port for get_value responder.");
+ _responder->respond_error("Unable to find port for get_value responder.");
} else if (m_client) {
- m_responder->respond_ok();
+ _responder->respond_ok();
m_client->control_change(m_port_path, m_value);
} else {
- m_responder->respond_error("Invalid URL");
+ _responder->respond_error("Invalid URL");
}
}
diff --git a/src/libs/engine/events/RequestPortValueEvent.h b/src/libs/engine/events/RequestPortValueEvent.h
index fd915c3b..bfb87790 100644
--- a/src/libs/engine/events/RequestPortValueEvent.h
+++ b/src/libs/engine/events/RequestPortValueEvent.h
@@ -37,7 +37,7 @@ using Shared::ClientInterface;
class RequestPortValueEvent : public QueuedEvent
{
public:
- RequestPortValueEvent(CountedPtr<Responder> responder, const string& port_path);
+ RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index 37e164c1..35ea2b47 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -28,8 +28,8 @@ using std::string;
namespace Om {
-SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, const string& path, const string& key, const string& value)
-: QueuedEvent(responder),
+SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value)
+: QueuedEvent(responder, timestamp),
m_path(path),
m_key(key),
m_value(value),
@@ -68,9 +68,9 @@ SetMetadataEvent::post_process()
if (m_object == NULL) {
string msg = "Unable to find object ";
msg += m_path;
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else {
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_metadata_update(m_path, m_key, m_value);
}
}
diff --git a/src/libs/engine/events/SetMetadataEvent.h b/src/libs/engine/events/SetMetadataEvent.h
index faa9ae72..82e14ea2 100644
--- a/src/libs/engine/events/SetMetadataEvent.h
+++ b/src/libs/engine/events/SetMetadataEvent.h
@@ -34,7 +34,7 @@ class GraphObject;
class SetMetadataEvent : public QueuedEvent
{
public:
- SetMetadataEvent(CountedPtr<Responder> responder, const string& path, const string& key, const string& value);
+ SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index 6401689b..8b861a58 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -28,8 +28,8 @@ namespace Om {
/** Voice-specific control setting
*/
-SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val)
-: Event(responder),
+SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val)
+: Event(responder, timestamp),
m_voice_num(voice_num),
m_port_path(port_path),
m_val(val),
@@ -39,8 +39,8 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, size_t voi
}
-SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, const string& port_path, sample val)
-: Event(responder),
+SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val)
+: Event(responder, timestamp),
m_voice_num(-1),
m_port_path(port_path),
m_val(val),
@@ -76,7 +76,7 @@ SetPortValueEvent::post_process()
if (m_error == NO_ERROR) {
assert(m_port != NULL);
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
@@ -89,12 +89,12 @@ SetPortValueEvent::post_process()
} else if (m_error == PORT_NOT_FOUND) {
string msg = "Unable to find port ";
msg.append(m_port_path).append(" for set_port_value");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_error == TYPE_MISMATCH) {
string msg = "Attempt to set ";
msg.append(m_port_path).append(" to incompatible type");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/SetPortValueEvent.h b/src/libs/engine/events/SetPortValueEvent.h
index 0606e546..33c9cbd9 100644
--- a/src/libs/engine/events/SetPortValueEvent.h
+++ b/src/libs/engine/events/SetPortValueEvent.h
@@ -34,8 +34,8 @@ class Port;
class SetPortValueEvent : public Event
{
public:
- SetPortValueEvent(CountedPtr<Responder> responder, const string& port_path, sample val);
- SetPortValueEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val);
+ SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val);
+ SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val);
void execute(samplecount offset);
void post_process();
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
index 6ef39d55..21c1d104 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
@@ -29,8 +29,8 @@ namespace Om {
/** Voice-specific control setting
*/
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val)
-: QueuedEvent(responder),
+SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val)
+: QueuedEvent(responder, timestamp),
m_voice_num(voice_num),
m_port_path(port_path),
m_val(val),
@@ -40,8 +40,8 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder
}
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, const string& port_path, sample val)
-: QueuedEvent(responder),
+SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val)
+: QueuedEvent(responder, timestamp),
m_voice_num(-1),
m_port_path(port_path),
m_val(val),
@@ -88,7 +88,7 @@ SetPortValueQueuedEvent::post_process()
if (m_error == NO_ERROR) {
assert(m_port != NULL);
- m_responder->respond_ok();
+ _responder->respond_ok();
om->client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
@@ -101,12 +101,12 @@ SetPortValueQueuedEvent::post_process()
} else if (m_error == PORT_NOT_FOUND) {
string msg = "Unable to find port ";
msg.append(m_port_path).append(" for set_port_value_slow");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
} else if (m_error == TYPE_MISMATCH) {
string msg = "Attempt to set ";
msg.append(m_port_path).append(" to incompatible type");
- m_responder->respond_error(msg);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.h b/src/libs/engine/events/SetPortValueQueuedEvent.h
index d29f424b..035cb414 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.h
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.h
@@ -34,8 +34,8 @@ class Port;
class SetPortValueQueuedEvent : public QueuedEvent
{
public:
- SetPortValueQueuedEvent(CountedPtr<Responder> responder, const string& port_path, sample val);
- SetPortValueQueuedEvent(CountedPtr<Responder> responder, size_t voice_num, const string& port_path, sample val);
+ SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val);
+ SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val);
void pre_process();
void execute(samplecount offset);
diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp
index 10696640..175543c9 100644
--- a/src/libs/engine/events/UnregisterClientEvent.cpp
+++ b/src/libs/engine/events/UnregisterClientEvent.cpp
@@ -24,8 +24,8 @@
namespace Om {
-UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, ClientKey key)
-: QueuedEvent(responder)
+UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key)
+: QueuedEvent(responder, timestamp)
, _key(key)
{
}
@@ -35,9 +35,9 @@ void
UnregisterClientEvent::post_process()
{
if (om->client_broadcaster()->unregister_client(_key))
- m_responder->respond_ok();
+ _responder->respond_ok();
else
- m_responder->respond_error("Unable to unregister client");
+ _responder->respond_error("Unable to unregister client");
}
diff --git a/src/libs/engine/events/UnregisterClientEvent.h b/src/libs/engine/events/UnregisterClientEvent.h
index 56556629..e7c6a996 100644
--- a/src/libs/engine/events/UnregisterClientEvent.h
+++ b/src/libs/engine/events/UnregisterClientEvent.h
@@ -39,7 +39,7 @@ using Shared::ClientKey;
class UnregisterClientEvent : public QueuedEvent
{
public:
- UnregisterClientEvent(CountedPtr<Responder> responder, ClientKey key);
+ UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key);
void post_process();
diff --git a/src/progs/ingenuity/OmFlowCanvas.cpp b/src/progs/ingenuity/OmFlowCanvas.cpp
index fc9ec9ef..72f9f1c2 100644
--- a/src/progs/ingenuity/OmFlowCanvas.cpp
+++ b/src/progs/ingenuity/OmFlowCanvas.cpp
@@ -107,8 +107,8 @@ OmFlowCanvas::connect(const Port* src_port, const Port* dst_port)
nm->x(dst->module()->property_x() - dst->module()->width() - 20);
nm->y(dst->module()->property_y());
Controller::instance().create_node_from_model(nm);
- Controller::instance().connect(src->model()->path(), nm->path() + "/MIDI In");
- Controller::instance().connect(nm->path() + "/Out (CR)", dst->model()->path());
+ Controller::instance().connect(src->model()->path(), nm->path() + "/MIDI_In");
+ Controller::instance().connect(nm->path() + "/Out_(CR)", dst->model()->path());
Controller::instance().midi_learn(nm->path());
// Set control node range to port's user range