summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-22 07:38:52 +0000
committerDavid Robillard <d@drobilla.net>2006-06-22 07:38:52 +0000
commitc3dc3ff5a5465ed59b0a8b36eb234130dbf0a9d6 (patch)
tree15cb79a6c687883d326d1e8861475c0eebc04dfe /src
parent9cde7e0c1097cf0aa52113a942a3b88d930568b6 (diff)
downloadingen-c3dc3ff5a5465ed59b0a8b36eb234130dbf0a9d6.tar.gz
ingen-c3dc3ff5a5465ed59b0a8b36eb234130dbf0a9d6.tar.bz2
ingen-c3dc3ff5a5465ed59b0a8b36eb234130dbf0a9d6.zip
LADSPA port default value loading (engine side)
git-svn-id: http://svn.drobilla.net/lad/ingen@77 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/engine/InputPort.h4
-rw-r--r--src/libs/engine/LADSPANode.cpp10
-rw-r--r--src/libs/engine/Makefile.am1
-rw-r--r--src/libs/engine/ObjectSender.cpp20
-rw-r--r--src/libs/engine/OutputPort.cpp49
-rw-r--r--src/libs/engine/OutputPort.h12
-rw-r--r--src/libs/engine/TypedPort.cpp6
-rw-r--r--src/libs/engine/TypedPort.h7
8 files changed, 23 insertions, 86 deletions
diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h
index d7af9871..e66cf11a 100644
--- a/src/libs/engine/InputPort.h
+++ b/src/libs/engine/InputPort.h
@@ -57,8 +57,6 @@ public:
void process(samplecount nframes);
- //void tie(OutputPort<T>* const port);
-
bool is_connected() const { return (m_connections.size() > 0); }
bool is_connected_to(const OutputPort<T>* const port) const;
@@ -75,8 +73,6 @@ private:
List<TypedConnection<T>*> m_connections;
// This is just stupid...
- //using TypedPort<T>::m_is_tied;
- //using TypedPort<T>::m_tied_port;
using TypedPort<T>::m_buffers;
using TypedPort<T>::_poly;
using TypedPort<T>::_index;
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index da053b35..a143d5fa 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -114,10 +114,11 @@ LADSPANode::instantiate()
sample default_val = default_port_value(j);
// Set default control val
- if (port->buffer_size() == 1)
+ if (port->buffer_size() == 1) {
((TypedPort<sample>*)port)->set_value(default_val, 0);
- else
+ } else {
((TypedPort<sample>*)port)->set_value(0.0f, 0);
+ }
}
return true;
@@ -144,10 +145,10 @@ LADSPANode::activate()
for (unsigned long j=0; j < _descriptor->PortCount; ++j) {
port = static_cast<TypedPort<sample>*>(_ports->at(j));
set_port_buffer(i, j, ((TypedPort<sample>*)_ports->at(j))->buffer(i)->data());
- if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
+ /* if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
port->set_value(0.0f, 0); // FIXME
else if (port->type() == DataType::FLOAT && port->buffer_size() > 1)
- port->set_value(0.0f, 0);
+ port->set_value(0.0f, 0);*/
}
if (_descriptor->activate != NULL)
_descriptor->activate(_instances[i]);
@@ -328,6 +329,7 @@ LADSPANode::default_port_value(ulong port_index)
}
}
+ cerr << path() << " Port " << port_index << " LADSPA Default value: " << normal << endl;
// FIXME: set min/max as metadata
return normal;
}
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 889f98fd..a7fd98c1 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -46,7 +46,6 @@ libingen_la_SOURCES = \
InputPort.h \
InputPort.cpp \
OutputPort.h \
- OutputPort.cpp \
DuplexPort.h \
DuplexPort.cpp \
MidiMessage.h \
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 33f261fb..b79a5df0 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -88,17 +88,6 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch)
void
ObjectSender::send_node(ClientInterface* client, const Node* node)
{
- // Don't send node notification for bridge nodes, from the client's
- // perspective they don't even exist (just the ports they represent)
- // FIXME: hack, these nodes probably shouldn't even exist in the
- // engine anymore
- /*if (const_cast<Node*>(node)->as_port()) { // bridge node if as_port() returns non-NULL
- // FIXME: remove this whole thing. shouldn't be any bridge nodes anymore
- assert(false);
- send_port(client, const_cast<Node*>(node)->as_port());
- return;
- }*/
-
const Plugin* const plugin = node->plugin();
int polyphonic =
@@ -163,9 +152,12 @@ ObjectSender::send_port(ClientInterface* client, const Port* port)
client->new_port(port->path(), type, port->is_output());
// Send control value
- if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
- client->control_change(port->path(),
- dynamic_cast<const TypedPort<sample>*>(port)->buffer(0)->value_at(0));
+ if (port->type() == DataType::FLOAT && port->buffer_size() == 1) {
+ sample default_value = dynamic_cast<const TypedPort<sample>*>(
+ port)->buffer(0)->value_at(0);
+ cerr << port->path() << " sending default value " << default_value << endl;
+ client->control_change(port->path(), default_value);
+ }
// Send metadata
const map<string, string>& data = port->metadata();
diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp
deleted file mode 100644
index 31280d49..00000000
--- a/src/libs/engine/OutputPort.cpp
+++ /dev/null
@@ -1,49 +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 "OutputPort.h"
-#include "InputPort.h"
-#include <cassert>
-
-namespace Om {
-
-template<typename T>
-OutputPort<T>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size)
-: TypedPort<T>(parent, name, index, poly, type, buffer_size)
-{
-}
-template OutputPort<sample>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
-template OutputPort<MidiMessage>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
-
-#if 0
-template<typename T>
-void
-OutputPort<T>::set_tied_port(InputPort<T>* port)
-{
- //assert(!m_is_tied);
- //assert(m_tied_port == NULL);
- assert(static_cast<TypedPort<T>*>(port) != static_cast<TypedPort<T>*>(this));
- assert(port != NULL);
-
- //m_is_tied = true;
- //m_tied_port = (TypedPort<T>*)port;
-}
-template void OutputPort<sample>::set_tied_port(InputPort<sample>* port);
-template void OutputPort<MidiMessage>::set_tied_port(InputPort<MidiMessage>* port);
-#endif
-
-} // namespace Om
-
diff --git a/src/libs/engine/OutputPort.h b/src/libs/engine/OutputPort.h
index 89cb3398..23ead848 100644
--- a/src/libs/engine/OutputPort.h
+++ b/src/libs/engine/OutputPort.h
@@ -42,11 +42,14 @@ template <typename T>
class OutputPort : virtual public TypedPort<T>
{
public:
- OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
+ OutputPort(Node* parent, const string& name,
+ size_t index, size_t poly,
+ DataType type, size_t buffer_size)
+ : TypedPort<T>(parent, name, index, poly, type, buffer_size)
+ {}
+
virtual ~OutputPort() {}
- //void set_tied_port(InputPort<T>* port);
-
bool is_input() const { return false; }
bool is_output() const { return true; }
@@ -54,9 +57,6 @@ private:
// Prevent copies (undefined)
OutputPort(const OutputPort& copy);
OutputPort<T>& operator=(const OutputPort<T>&);
-
- //using TypedPort<T>::m_is_tied;
- //using TypedPort<T>::m_tied_port;
};
diff --git a/src/libs/engine/TypedPort.cpp b/src/libs/engine/TypedPort.cpp
index 1dad267b..4112ee20 100644
--- a/src/libs/engine/TypedPort.cpp
+++ b/src/libs/engine/TypedPort.cpp
@@ -33,8 +33,6 @@ template <typename T>
TypedPort<T>::TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size)
: Port(parent, name, index, poly, type, buffer_size)
, m_fixed_buffers(false)
-/*, m_is_tied(false)
-, m_tied_port(NULL)*/
{
allocate_buffers();
clear_buffers();
@@ -66,6 +64,8 @@ TypedPort<sample>::set_value(sample val, size_t offset)
if (offset >= _buffer_size)
offset = 0;
assert(offset < _buffer_size);
+
+ cerr << path() << " setting value " << val << endl;
for (size_t v=0; v < _poly; ++v)
m_buffers.at(v)->set(val, offset);
@@ -80,6 +80,8 @@ TypedPort<sample>::set_value(size_t voice, sample val, size_t offset)
if (offset >= _buffer_size)
offset = 0;
assert(offset < _buffer_size);
+
+ cerr << path() << " setting voice value " << val << endl;
m_buffers.at(voice)->set(val, offset);
}
diff --git a/src/libs/engine/TypedPort.h b/src/libs/engine/TypedPort.h
index 04a9bee9..9d4f2dd5 100644
--- a/src/libs/engine/TypedPort.h
+++ b/src/libs/engine/TypedPort.h
@@ -52,9 +52,6 @@ public:
virtual void process(samplecount nframes);
virtual void clear_buffers();
- //TypedPort* tied_port() const { return m_tied_port; }
- //void untie() { m_is_tied = false; m_tied_port = NULL; }
-
/** Used by drivers to prevent port from changing buffers */
void fixed_buffers(bool b) { m_fixed_buffers = b; }
bool fixed_buffers() { return m_fixed_buffers; }
@@ -68,9 +65,7 @@ protected:
void allocate_buffers();
- bool m_fixed_buffers;
- //bool m_is_tied;
- //TypedPort* m_tied_port;
+ bool m_fixed_buffers;
Array<Buffer<T>*> m_buffers;
};