summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-21 17:47:49 +0000
committerDavid Robillard <d@drobilla.net>2007-10-21 17:47:49 +0000
commit89a9cdf0ab581a4cff5cf8fd859d714a90bb8998 (patch)
tree2a9cbe5ebda35de1bab8c5a34762e112e9a2c948 /src/libs/engine
parent22b17482a552b0966a80c19d94651385357d5701 (diff)
downloadingen-89a9cdf0ab581a4cff5cf8fd859d714a90bb8998.tar.gz
ingen-89a9cdf0ab581a4cff5cf8fd859d714a90bb8998.tar.bz2
ingen-89a9cdf0ab581a4cff5cf8fd859d714a90bb8998.zip
Fix control port value broadcasting.
git-svn-id: http://svn.drobilla.net/lad/ingen@893 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/InputPort.cpp17
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp2
-rw-r--r--src/libs/engine/OutputPort.cpp13
-rw-r--r--src/libs/engine/OutputPort.hpp4
-rw-r--r--src/libs/engine/PortImpl.cpp8
5 files changed, 33 insertions, 11 deletions
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index f64cf97b..7e5f6623 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -31,7 +31,12 @@ using namespace std;
namespace Ingen {
-InputPort::InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size)
+InputPort::InputPort(NodeImpl* parent,
+ const string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ size_t buffer_size)
: PortImpl(parent, name, index, poly, type, buffer_size)
{
}
@@ -177,7 +182,8 @@ InputPort::pre_process(ProcessContext& context)
buffer(i)->prepare_read(context.nframes());
/*cerr << path() << " poly = " << _poly << ", mixdown: " << do_mixdown
- << ", fixed buffers: " << _fixed_buffers << endl;
+ << ", fixed buffers: " << _fixed_buffers << ", joined: " << _buffers->at(0)->is_joined()
+ << " to " << _buffers->at(0)->joined_buffer() << endl;
if (type() == DataType::MIDI)
for (uint32_t i=0; i < _poly; ++i)
@@ -230,7 +236,12 @@ InputPort::post_process(ProcessContext& context)
for (uint32_t i=0; i < _poly; ++i)
buffer(i)->prepare_write(context.nframes());
- //cerr << path() << " input post: buffer: " << buffer(0) << endl;
+ /*if (_broadcast && (_type == DataType::CONTROL)) {
+ const Sample value = ((AudioBuffer*)(*_buffers)[0])->value_at(0);
+
+ cerr << path() << " input post: buffer: " << buffer(0) << " value = "
+ << value << " (last " << _last_broadcasted_value << ")" <<endl;
+ }*/
}
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 66e74e70..4a713dff 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -65,7 +65,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
}
// For debugging, print all incoming OSC messages
- //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL);
+ lo_server_add_method(_server, NULL, NULL, generic_cb, NULL);
// Set response address for this message.
// It's important this is first and returns nonzero.
diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp
index 82e23889..a80d1ddf 100644
--- a/src/libs/engine/OutputPort.cpp
+++ b/src/libs/engine/OutputPort.cpp
@@ -24,6 +24,19 @@ using namespace std;
namespace Ingen {
+
+OutputPort::OutputPort(NodeImpl* parent,
+ const string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ size_t buffer_size)
+ : PortImpl(parent, name, index, poly, type, buffer_size)
+{
+ if (type == DataType::CONTROL)
+ _broadcast = true;
+}
+
void
OutputPort::pre_process(ProcessContext& context)
diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp
index 1db9e4d9..e744b9e6 100644
--- a/src/libs/engine/OutputPort.hpp
+++ b/src/libs/engine/OutputPort.hpp
@@ -45,9 +45,7 @@ public:
uint32_t index,
uint32_t poly,
DataType type,
- size_t buffer_size)
- : PortImpl(parent, name, index, poly, type, buffer_size)
- {}
+ size_t buffer_size);
void pre_process(ProcessContext& context);
void post_process(ProcessContext& context);
diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp
index 4a17a218..ec27092a 100644
--- a/src/libs/engine/PortImpl.cpp
+++ b/src/libs/engine/PortImpl.cpp
@@ -173,20 +173,20 @@ void
PortImpl::broadcast(ProcessContext& context)
{
if (_broadcast) {
- if (_type == DataType::CONTROL) {
- const Sample value = ((AudioBuffer*)(*_buffers)[0])->value_at(0);
+ if (_type == DataType::CONTROL || _type == DataType::AUDIO) {
+ const Sample value = ((AudioBuffer*)buffer(0))->value_at(0);
if (value != _last_broadcasted_value) {
const SendPortValueEvent ev(context.engine(), context.start(), this, false, 0, value);
context.event_sink().write(sizeof(ev), &ev);
_last_broadcasted_value = value;
}
} else if (_type == DataType::MIDI) {
- if (((MidiBuffer*)(*_buffers)[0])->event_count() > 0) {
+ if (((MidiBuffer*)buffer(0))->event_count() > 0) {
const SendPortActivityEvent ev(context.engine(), context.start(), this);
context.event_sink().write(sizeof(ev), &ev);
}
} else if (_type == DataType::OSC) {
- if (((OSCBuffer*)(*_buffers)[0])->event_count() > 0) {
+ if (((OSCBuffer*)buffer(0))->event_count() > 0) {
const SendPortActivityEvent ev(context.engine(), context.start(), this);
context.event_sink().write(sizeof(ev), &ev);
}