summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-30 23:36:39 +0000
committerDavid Robillard <d@drobilla.net>2007-09-30 23:36:39 +0000
commit8450921d5309c5ba677997e7ca722a466c8dc222 (patch)
tree2c0fdf58f142be8f42222c3a580614cfbf0d7989 /src/libs/engine/events
parentffc6f457d61460ca73bb24a3d7e583f90d54ecd2 (diff)
downloadingen-8450921d5309c5ba677997e7ca722a466c8dc222.tar.gz
ingen-8450921d5309c5ba677997e7ca722a466c8dc222.tar.bz2
ingen-8450921d5309c5ba677997e7ca722a466c8dc222.zip
Working port notification for LV2 GUIs (ll-plugins VU meter works in Ingen now).
git-svn-id: http://svn.drobilla.net/lad/ingen@790 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/DisablePatchEvent.cpp70
-rw-r--r--src/libs/engine/events/DisablePatchEvent.hpp53
-rw-r--r--src/libs/engine/events/EnablePatchEvent.cpp23
-rw-r--r--src/libs/engine/events/EnablePatchEvent.hpp7
-rw-r--r--src/libs/engine/events/EnablePortBroadcastingEvent.cpp29
-rw-r--r--src/libs/engine/events/EnablePortBroadcastingEvent.hpp4
-rw-r--r--src/libs/engine/events/Makefile.am4
7 files changed, 35 insertions, 155 deletions
diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp
deleted file mode 100644
index bc5219a6..00000000
--- a/src/libs/engine/events/DisablePatchEvent.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "DisablePatchEvent.hpp"
-#include "Responder.hpp"
-#include "Engine.hpp"
-#include "Patch.hpp"
-#include "ClientBroadcaster.hpp"
-#include "util.hpp"
-#include "ObjectStore.hpp"
-#include "Port.hpp"
-
-namespace Ingen {
-
-
-DisablePatchEvent::DisablePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
-: QueuedEvent(engine, responder, timestamp),
- _patch_path(patch_path),
- _patch(NULL)
-{
-}
-
-
-void
-DisablePatchEvent::pre_process()
-{
- _patch = _engine.object_store()->find_patch(_patch_path);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DisablePatchEvent::execute(ProcessContext& context)
-{
- QueuedEvent::execute(context);
-
- if (_patch != NULL)
- _patch->disable();
-}
-
-
-void
-DisablePatchEvent::post_process()
-{
- if (_patch != NULL) {
- _responder->respond_ok();
- _engine.broadcaster()->send_patch_disable(_patch_path);
- } else {
- _responder->respond_error(string("Patch ") + _patch_path + " not found");
- }
-}
-
-
-} // namespace Ingen
-
diff --git a/src/libs/engine/events/DisablePatchEvent.hpp b/src/libs/engine/events/DisablePatchEvent.hpp
deleted file mode 100644
index 1a208246..00000000
--- a/src/libs/engine/events/DisablePatchEvent.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef DISABLEPATCHEVENT_H
-#define DISABLEPATCHEVENT_H
-
-#include <string>
-#include "QueuedEvent.hpp"
-
-using std::string;
-
-namespace Ingen {
-
-class Patch;
-
-
-/** Disables a Patch's DSP processing.
- *
- * \ingroup engine
- */
-class DisablePatchEvent : public QueuedEvent
-{
-public:
- DisablePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
-
- void pre_process();
- void execute(ProcessContext& context);
- void post_process();
-
-private:
- string _patch_path;
- Patch* _patch;
-};
-
-
-} // namespace Ingen
-
-
-#endif // DISABLEPATCHEVENT_H
diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp
index d0d872bb..e380340f 100644
--- a/src/libs/engine/events/EnablePatchEvent.cpp
+++ b/src/libs/engine/events/EnablePatchEvent.cpp
@@ -26,11 +26,12 @@
namespace Ingen {
-EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path)
+EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path, bool enable)
: QueuedEvent(engine, responder, timestamp),
_patch_path(patch_path),
_patch(NULL),
- _compiled_patch(NULL)
+ _compiled_patch(NULL),
+ _enable(enable)
{
}
@@ -40,10 +41,10 @@ EnablePatchEvent::pre_process()
{
_patch = _engine.object_store()->find_patch(_patch_path);
- if (_patch != NULL) {
+ if (_enable && _patch) {
/* Any event that requires a new process order will set the patch's
- * process order to NULL if it is executed when the patch is not
- * active. So, if the PO is NULL, calculate it here */
+ * compiled_patch to NULL if it is executed when the patch is not
+ * active. So, if the CP is NULL, calculate it here */
if (_patch->compiled_patch() == NULL)
_compiled_patch = _patch->compile();
}
@@ -58,9 +59,12 @@ EnablePatchEvent::execute(ProcessContext& context)
QueuedEvent::execute(context);
if (_patch != NULL) {
- _patch->enable();
+ if (_enable)
+ _patch->enable();
+ else
+ _patch->disable();
- if (_patch->compiled_patch() == NULL)
+ if (_enable && _patch->compiled_patch() == NULL)
_patch->compiled_patch(_compiled_patch);
}
}
@@ -71,7 +75,10 @@ EnablePatchEvent::post_process()
{
if (_patch != NULL) {
_responder->respond_ok();
- _engine.broadcaster()->send_patch_enable(_patch_path);
+ if (_enable)
+ _engine.broadcaster()->send_patch_enable(_patch_path);
+ else
+ _engine.broadcaster()->send_patch_disable(_patch_path);
} else {
_responder->respond_error(string("Patch ") + _patch_path + " not found");
}
diff --git a/src/libs/engine/events/EnablePatchEvent.hpp b/src/libs/engine/events/EnablePatchEvent.hpp
index f0ba5714..a5d7d7e7 100644
--- a/src/libs/engine/events/EnablePatchEvent.hpp
+++ b/src/libs/engine/events/EnablePatchEvent.hpp
@@ -39,7 +39,11 @@ class CompiledPatch;
class EnablePatchEvent : public QueuedEvent
{
public:
- EnablePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path);
+ EnablePatchEvent(Engine& engine,
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ const string& patch_path,
+ bool enable);
void pre_process();
void execute(ProcessContext& context);
@@ -49,6 +53,7 @@ private:
string _patch_path;
Patch* _patch;
CompiledPatch* _compiled_patch; // Patch's new process order
+ bool _enable;
};
diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
index e432a884..27603e86 100644
--- a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
+++ b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp
@@ -33,10 +33,12 @@ namespace Ingen {
EnablePortBroadcastingEvent::EnablePortBroadcastingEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const std::string& port_path)
+ const std::string& port_path,
+ bool enable)
: QueuedEvent(engine, responder, timestamp),
_port_path(port_path),
- _port(NULL)
+ _port(NULL),
+ _enable(enable)
{
}
@@ -55,31 +57,18 @@ EnablePortBroadcastingEvent::execute(ProcessContext& context)
{
QueuedEvent::execute(context);
-#if 0
- assert(_time >= start && _time <= end);
-
- if (_port != NULL && _port->type() == DataType::FLOAT)
- _value = ((AudioBuffer*)_port->buffer(0))->value_at(0/*_time - start*/);
- else
- _port = NULL; // triggers error response
-#endif
+ if (_port)
+ _port->monitor(_enable);
}
void
EnablePortBroadcastingEvent::post_process()
{
-#if 0
- string msg;
- if (!_port) {
- _responder->respond_error("Unable to find port for get_value responder.");
- } else if (_responder->client()) {
+ if (_port)
_responder->respond_ok();
- _responder->client()->control_change(_port_path, _value);
- } else {
- _responder->respond_error("Unable to find client to send port value");
- }
-#endif
+ else
+ _responder->respond_error("Unable to find port for get_value responder.");
}
diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp b/src/libs/engine/events/EnablePortBroadcastingEvent.hpp
index 55f7decb..e24389cb 100644
--- a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp
+++ b/src/libs/engine/events/EnablePortBroadcastingEvent.hpp
@@ -41,7 +41,8 @@ public:
EnablePortBroadcastingEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- const std::string& port_path);
+ const std::string& port_path,
+ bool enable);
void pre_process();
void execute(ProcessContext& context);
@@ -50,6 +51,7 @@ public:
private:
const std::string _port_path;
Port* _port;
+ bool _enable;
};
diff --git a/src/libs/engine/events/Makefile.am b/src/libs/engine/events/Makefile.am
index e634b63b..7d51ce90 100644
--- a/src/libs/engine/events/Makefile.am
+++ b/src/libs/engine/events/Makefile.am
@@ -3,6 +3,8 @@ MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
AddNodeEvent.cpp \
AddNodeEvent.hpp \
+ AddPortEvent.cpp \
+ AddPortEvent.hpp \
AllNotesOffEvent.cpp \
AllNotesOffEvent.hpp \
ClearPatchEvent.cpp \
@@ -23,8 +25,6 @@ EXTRA_DIST = \
DeactivateEvent.hpp \
DestroyEvent.cpp \
DestroyEvent.hpp \
- DisablePatchEvent.cpp \
- DisablePatchEvent.hpp \
DisconnectNodeEvent.cpp \
DisconnectNodeEvent.hpp \
DisconnectPortEvent.cpp \