summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-25 06:55:57 +0000
committerDavid Robillard <d@drobilla.net>2008-01-25 06:55:57 +0000
commitdf8ee18c0139f889bf7c697713a2205364845464 (patch)
tree2d3d2389504676b194fcb47a9ed3e7b1da8f94c4 /src/libs/engine
parentf3f08e248a96f2a6d75d4fc6ee3dc34985805e58 (diff)
downloadingen-df8ee18c0139f889bf7c697713a2205364845464.tar.gz
ingen-df8ee18c0139f889bf7c697713a2205364845464.tar.bz2
ingen-df8ee18c0139f889bf7c697713a2205364845464.zip
Overhaul SLV2 API to return/take SLV2Value (instead of strings or primitives) wherever possible.
Make 'index' a fundemental property of ingen ports. git-svn-id: http://svn.drobilla.net/lad/ingen@1113 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/DuplexPort.cpp8
-rw-r--r--src/libs/engine/DuplexPort.hpp10
-rw-r--r--src/libs/engine/InputPort.cpp3
-rw-r--r--src/libs/engine/InputPort.hpp9
-rw-r--r--src/libs/engine/LADSPANode.cpp10
-rw-r--r--src/libs/engine/LV2Node.cpp26
-rw-r--r--src/libs/engine/LV2Plugin.cpp2
-rw-r--r--src/libs/engine/MidiControlNode.cpp22
-rw-r--r--src/libs/engine/MidiControlNode.hpp1
-rw-r--r--src/libs/engine/MidiNoteNode.cpp12
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp11
-rw-r--r--src/libs/engine/NodeFactory.cpp15
-rw-r--r--src/libs/engine/OSCClientSender.cpp4
-rw-r--r--src/libs/engine/OSCClientSender.hpp1
-rw-r--r--src/libs/engine/ObjectSender.cpp2
-rw-r--r--src/libs/engine/OutputPort.cpp3
-rw-r--r--src/libs/engine/OutputPort.hpp1
-rw-r--r--src/libs/engine/PatchImpl.cpp2
-rw-r--r--src/libs/engine/PortImpl.cpp14
-rw-r--r--src/libs/engine/PortImpl.hpp25
20 files changed, 93 insertions, 88 deletions
diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp
index 0da8d9d4..7fde9d0d 100644
--- a/src/libs/engine/DuplexPort.cpp
+++ b/src/libs/engine/DuplexPort.cpp
@@ -30,10 +30,10 @@ using namespace std;
namespace Ingen {
-DuplexPort::DuplexPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output)
- : PortImpl(parent, name, index, poly, type, buffer_size)
- , InputPort(parent, name, index, poly, type, buffer_size)
- , OutputPort(parent, name, index, poly, type, buffer_size)
+DuplexPort::DuplexPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, const Atom& value, size_t buffer_size, bool is_output)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
+ , InputPort(parent, name, index, poly, type, value, buffer_size)
+ , OutputPort(parent, name, index, poly, type, value, buffer_size)
, _is_output(is_output)
{
assert(PortImpl::_parent == parent);
diff --git a/src/libs/engine/DuplexPort.hpp b/src/libs/engine/DuplexPort.hpp
index c8413b70..43d202a9 100644
--- a/src/libs/engine/DuplexPort.hpp
+++ b/src/libs/engine/DuplexPort.hpp
@@ -41,7 +41,15 @@ class NodeImpl;
class DuplexPort : public InputPort, public OutputPort
{
public:
- DuplexPort(NodeImpl* parent, const std::string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output);
+ DuplexPort(NodeImpl* parent,
+ const std::string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ const Atom& value,
+ size_t buffer_size,
+ bool is_output);
+
virtual ~DuplexPort() {}
void pre_process(ProcessContext& context);
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index 7e5f6623..6e216384 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -36,8 +36,9 @@ InputPort::InputPort(NodeImpl* parent,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
- : PortImpl(parent, name, index, poly, type, buffer_size)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
{
}
diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp
index cd185ad8..c3fa3dad 100644
--- a/src/libs/engine/InputPort.hpp
+++ b/src/libs/engine/InputPort.hpp
@@ -47,7 +47,14 @@ class NodeImpl;
class InputPort : virtual public PortImpl
{
public:
- InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size);
+ InputPort(NodeImpl* parent,
+ const string& name,
+ uint32_t index,
+ uint32_t poly,
+ DataType type,
+ const Atom& value,
+ size_t buffer_size);
+
virtual ~InputPort() {}
typedef Raul::List< SharedPtr<ConnectionImpl> > Connections;
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index 71e40c9d..921e6304 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -171,20 +171,20 @@ LADSPANode::instantiate()
}
assert (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])
|| LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j]));
+
+ Sample default_val, min, max;
+ get_port_limits(j, default_val, min, max);
if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) {
- port = new InputPort(this, port_name, j, _polyphony, type, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, type, default_val, port_buffer_size);
_ports->at(j) = port;
} else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) {
- port = new OutputPort(this, port_name, j, _polyphony, type, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, type, default_val, port_buffer_size);
_ports->at(j) = port;
}
assert(port);
assert(_ports->at(j) == port);
-
- Sample default_val, min, max;
- get_port_limits(j, default_val, min, max);
// Work around broke-ass crackhead plugins
if (default_val < min) {
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 2fbd390f..a0fdebc0 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -153,7 +153,7 @@ LV2Node::instantiate()
SLV2Port id = slv2_plugin_get_port_by_index(plug, j);
// LV2 shortnames are guaranteed to be unique, valid C identifiers
- port_name = (char*)slv2_port_get_symbol(plug, id);
+ port_name = slv2_value_as_string(slv2_port_get_symbol(plug, id));
assert(port_name.find("/") == string::npos);
@@ -185,15 +185,24 @@ LV2Node::instantiate()
_instances = NULL;
return false;
}
+
+ SLV2Value def, min, max;
+ slv2_port_get_range(plug, id, &def, &min, &max);
+
+ // FIXME: need nice type preserving SLV2Value -> Raul::Atom conversion
+ Atom defatm = (float)((def && slv2_value_is_float(def)) ? slv2_value_as_float(def) : 0.0f);
if (direction == INPUT)
- port = new InputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, data_type, defatm, port_buffer_size);
else
- port = new OutputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, data_type, defatm, port_buffer_size);
if (direction == INPUT && data_type == DataType::CONTROL)
- ((AudioBuffer*)port->buffer(0))->set(
- slv2_port_get_default_value(_lv2_plugin->slv2_plugin(), id), 0);
+ ((AudioBuffer*)port->buffer(0))->set(slv2_value_as_float(def), 0);
+
+ slv2_value_free(def);
+ slv2_value_free(min);
+ slv2_value_free(max);
_ports->at(j) = port;
}
@@ -213,12 +222,7 @@ LV2Node::activate()
set_port_buffer(i, j, port->buffer(i));
if (port->type() == DataType::CONTROL) {
-
- const float val = slv2_port_get_default_value(_lv2_plugin->slv2_plugin(),
- slv2_plugin_get_port_by_index(_lv2_plugin->slv2_plugin(), j));
-
- ((AudioBuffer*)port->buffer(i))->set(val, 0);
-
+ ((AudioBuffer*)port->buffer(i))->set(port->value().get_float(), 0);
} else if (port->type() == DataType::AUDIO) {
((AudioBuffer*)port->buffer(i))->set(0.0f, 0);
}
diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Plugin.cpp
index aaf6da61..7d069eda 100644
--- a/src/libs/engine/LV2Plugin.cpp
+++ b/src/libs/engine/LV2Plugin.cpp
@@ -47,7 +47,7 @@ LV2Plugin::symbol() const
const string
LV2Plugin::name() const
{
- return slv2_plugin_get_name(_slv2_plugin);
+ return slv2_value_as_string(slv2_plugin_get_name(_slv2_plugin));
}
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index c48d2e74..263180f7 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -42,33 +42,27 @@ MidiControlNode::MidiControlNode(const string& path,
{
_ports = new Raul::Array<PortImpl*>(7);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 1);
+ _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 0.0f, 1);
_param_port->set_variable("ingen:minimum", 0.0f);
_param_port->set_variable("ingen:maximum", 127.0f);
- _param_port->set_variable("ingen:default", 0.0f);
_param_port->set_variable("ingen:integer", 1);
_ports->at(1) = _param_port;
- _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 1);
+ _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, 1);
_log_port->set_variable("ingen:toggled", 1);
- _log_port->set_variable("ingen:default", 0.0f);
_ports->at(2) = _log_port;
- _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 1);
- _min_port->set_variable("ingen:default", 0.0f);
+ _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 0.0f, 1);
_ports->at(3) = _min_port;
- _max_port = new InputPort(this, "maximum", 4, 1, DataType::CONTROL, 1);
+ _max_port = new InputPort(this, "maximum", 4, 1, DataType::CONTROL, 1.0f, 1);
_ports->at(4) = _max_port;
- _audio_port = new OutputPort(this, "ar_output", 5, 1, DataType::AUDIO, _buffer_size);
+ _audio_port = new OutputPort(this, "ar_output", 5, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(5) = _audio_port;
-
- _control_port = new OutputPort(this, "cr_output", 6, 1, DataType::CONTROL, 1);
- _ports->at(6) = _control_port;
}
@@ -139,10 +133,8 @@ MidiControlNode::control(uchar control_num, uchar val, SampleCount offset)
scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val;
}
- if (control_num == ((AudioBuffer*)_param_port->buffer(0))->value_at(0)) {
- ((AudioBuffer*)_control_port->buffer(0))->set(scaled_value, 0);
+ if (control_num == ((AudioBuffer*)_param_port->buffer(0))->value_at(0))
((AudioBuffer*)_audio_port->buffer(0))->set(scaled_value, offset);
- }
}
diff --git a/src/libs/engine/MidiControlNode.hpp b/src/libs/engine/MidiControlNode.hpp
index c51f36f6..1df42b33 100644
--- a/src/libs/engine/MidiControlNode.hpp
+++ b/src/libs/engine/MidiControlNode.hpp
@@ -54,7 +54,6 @@ private:
InputPort* _log_port;
InputPort* _min_port;
InputPort* _max_port;
- OutputPort* _control_port;
OutputPort* _audio_port;
MidiLearnResponseEvent* _learn_event;
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 0ee5de92..531c48cb 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -45,25 +45,23 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, PatchImpl* paren
{
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _freq_port = new OutputPort(this, "frequency", 1, _polyphony, DataType::AUDIO, _buffer_size);
+ _freq_port = new OutputPort(this, "frequency", 1, _polyphony, DataType::AUDIO, 440.0f, _buffer_size);
_ports->at(1) = _freq_port;
- _vel_port = new OutputPort(this, "velocity", 2, _polyphony, DataType::AUDIO, _buffer_size);
+ _vel_port = new OutputPort(this, "velocity", 2, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_vel_port->set_variable("ingen:minimum", 0.0f);
_vel_port->set_variable("ingen:maximum", 1.0f);
_ports->at(2) = _vel_port;
- _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, _buffer_size);
+ _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_gate_port->set_variable("ingen:toggled", 1);
- _gate_port->set_variable("ingen:default", 0.0f);
_ports->at(3) = _gate_port;
- _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, _buffer_size);
+ _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, 0.0f, _buffer_size);
_trig_port->set_variable("ingen:toggled", 1);
- _trig_port->set_variable("ingen:default", 0.0f);
_ports->at(4) = _trig_port;
}
diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp
index de257b2b..4d7ea000 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -35,23 +35,22 @@ MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, PatchImpl*
{
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, _buffer_size);
+ _midi_in_port = new InputPort(this, "input", 0, 1, DataType::EVENT, Atom(), _buffer_size);
_ports->at(0) = _midi_in_port;
- _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 1);
+ _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 60.0f, 1);
_note_port->set_variable("ingen:minimum", 0.0f);
_note_port->set_variable("ingen:maximum", 127.0f);
- _note_port->set_variable("ingen:default", 60.0f);
_note_port->set_variable("ingen:integer", 1);
_ports->at(1) = _note_port;
- _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, _buffer_size);
+ _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(2) = _gate_port;
- _trig_port = new OutputPort(this, "trigger", 3, 1, DataType::AUDIO, _buffer_size);
+ _trig_port = new OutputPort(this, "trigger", 3, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(3) = _trig_port;
- _vel_port = new OutputPort(this, "velocity", 4, 1, DataType::AUDIO, _buffer_size);
+ _vel_port = new OutputPort(this, "velocity", 4, 1, DataType::AUDIO, 0.0f, _buffer_size);
_ports->at(4) = _vel_port;
}
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index eb414978..4ca038b6 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -179,7 +179,7 @@ NodeFactory::load_lv2_plugins()
SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
- const string uri((const char*)slv2_plugin_get_uri(lv2_plug));
+ const string uri(slv2_value_as_uri(slv2_plugin_get_uri(lv2_plug)));
#ifndef NDEBUG
assert(_plugins.find(uri) == _plugins.end());
@@ -188,16 +188,9 @@ NodeFactory::load_lv2_plugins()
LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri);
plugin->slv2_plugin(lv2_plug);
- plugin->library_path(slv2_uri_to_path(slv2_plugin_get_library_uri(lv2_plug)));
- char* const name = slv2_plugin_get_name(lv2_plug);
- if (name) {
- //plugin->name(name);
- free(name);
- _plugins.insert(make_pair(uri, plugin));
- } else {
- cerr << "ERROR: LV2 Plugin " << uri << " has no name. Ignoring." << endl;
- continue;
- }
+ plugin->library_path(slv2_uri_to_path(slv2_value_as_uri(
+ slv2_plugin_get_library_uri(lv2_plug))));
+ _plugins.insert(make_pair(uri, plugin));
}
slv2_plugins_free(_world->slv2_world, plugins);
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 95bf520e..7a62b3b7 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -271,6 +271,7 @@ void OSCClientSender::new_node(const std::string& plugin_uri,
/** \page client_osc_namespace
* <p> \b /ingen/new_port - Notification of a new port's creation.
* \arg \b path (string) - Path of new port
+ * \arg \b index (integer) - Index (or sort key) of port on parent
* \arg \b data-type (string) - Type of port (ingen:AudioPort, ingen:ControlPort, ingen:MIDIPort, or ingen:OSCPort)
* \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1)
*
@@ -284,13 +285,14 @@ void OSCClientSender::new_node(const std::string& plugin_uri,
*/
void
OSCClientSender::new_port(const std::string& path,
+ uint32_t index,
const std::string& data_type,
bool is_output)
{
if (!_enabled)
return;
- lo_send(_address, "/ingen/new_port", "ssi", path.c_str(), data_type.c_str(), is_output);
+ lo_send(_address, "/ingen/new_port", "sisi", path.c_str(), index, data_type.c_str(), is_output);
}
diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp
index ec513b2e..4644b684 100644
--- a/src/libs/engine/OSCClientSender.hpp
+++ b/src/libs/engine/OSCClientSender.hpp
@@ -88,6 +88,7 @@ public:
uint32_t num_ports);
virtual void new_port(const std::string& path,
+ uint32_t index,
const std::string& data_type,
bool is_output);
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index bb1b5c54..f51f0ad0 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -116,7 +116,7 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port)
client->bundle_begin();
- client->new_port(port->path(), port->type().uri(), port->is_output());
+ client->new_port(port->path(), port->index(), port->type().uri(), port->is_output());
client->polyphonic(port->path(), port->polyphonic());
// Send variable
diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp
index a80d1ddf..6f36a34a 100644
--- a/src/libs/engine/OutputPort.cpp
+++ b/src/libs/engine/OutputPort.cpp
@@ -30,8 +30,9 @@ OutputPort::OutputPort(NodeImpl* parent,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
- : PortImpl(parent, name, index, poly, type, buffer_size)
+ : PortImpl(parent, name, index, poly, type, value, buffer_size)
{
if (type == DataType::CONTROL)
_broadcast = true;
diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp
index a184c32b..8d441b5c 100644
--- a/src/libs/engine/OutputPort.hpp
+++ b/src/libs/engine/OutputPort.hpp
@@ -45,6 +45,7 @@ public:
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size);
void pre_process(ProcessContext& context);
diff --git a/src/libs/engine/PatchImpl.cpp b/src/libs/engine/PatchImpl.cpp
index 360b3838..13576f1c 100644
--- a/src/libs/engine/PatchImpl.cpp
+++ b/src/libs/engine/PatchImpl.cpp
@@ -320,7 +320,7 @@ PatchImpl::create_port(const string& name, DataType type, size_t buffer_size, bo
assert( !(type == DataType::UNKNOWN) );
- return new DuplexPort(this, name, 0, _polyphony, type, buffer_size, is_output);
+ return new DuplexPort(this, name, 0, _polyphony, type, Atom(), buffer_size, is_output);
}
diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp
index 4fc61c20..9500aab1 100644
--- a/src/libs/engine/PortImpl.cpp
+++ b/src/libs/engine/PortImpl.cpp
@@ -37,15 +37,17 @@ PortImpl::PortImpl(NodeImpl* const node,
uint32_t index,
uint32_t poly,
DataType type,
+ const Atom& value,
size_t buffer_size)
: GraphObjectImpl(node, name, (type == DataType::AUDIO || type == DataType::CONTROL))
, _index(index)
, _poly(poly)
, _buffer_size(buffer_size)
, _type(type)
+ , _value(value)
, _fixed_buffers(false)
, _broadcast(false)
- , _last_broadcasted_value(0.0f) // default?
+ , _last_broadcasted_value(_value) // default?
, _buffers(new Raul::Array<Buffer*>(poly))
{
assert(node != NULL);
@@ -59,6 +61,8 @@ PortImpl::PortImpl(NodeImpl* const node,
if (type == DataType::EVENT)
_broadcast = true; // send activity blips
+
+ set_variable("ingen:default", value);
assert(_buffers->size() > 0);
}
@@ -122,14 +126,6 @@ PortImpl::apply_poly(Raul::Maid& maid, uint32_t poly)
}
-Raul::Atom
-PortImpl::value() const
-{
- // FIXME: will need this for ingen-side serialization
- throw;
-}
-
-
void
PortImpl::allocate_buffers()
{
diff --git a/src/libs/engine/PortImpl.hpp b/src/libs/engine/PortImpl.hpp
index 22e44c05..c2e2403d 100644
--- a/src/libs/engine/PortImpl.hpp
+++ b/src/libs/engine/PortImpl.hpp
@@ -27,7 +27,7 @@
#include "interface/DataType.hpp"
#include "Buffer.hpp"
-namespace Raul { class Maid; }
+namespace Raul { class Maid; class Atom; }
namespace Ingen {
@@ -68,7 +68,8 @@ public:
*/
virtual bool apply_poly(Raul::Maid& maid, uint32_t poly);
- virtual Raul::Atom value() const;
+ const Raul::Atom& value() const { return _value; }
+ void set_value(const Raul::Atom& v) { _value = v; }
inline Buffer* buffer(uint32_t voice) const {
Buffer* const buf = _buffers->at(voice);
@@ -87,11 +88,11 @@ public:
/** Empty buffer contents completely (ie silence) */
virtual void clear_buffers();
-
+
virtual bool is_input() const = 0;
virtual bool is_output() const = 0;
- uint32_t num() const { return _index; }
+ uint32_t index() const { return _index; }
uint32_t poly() const { return _poly; }
DataType type() const { return _type; }
size_t buffer_size() const { return _buffer_size; }
@@ -110,19 +111,21 @@ protected:
uint32_t index,
uint32_t poly,
DataType type,
+ const Raul::Atom& value,
size_t buffer_size);
virtual void allocate_buffers();
virtual void connect_buffers();
virtual void broadcast(ProcessContext& context);
- uint32_t _index;
- uint32_t _poly;
- uint32_t _buffer_size;
- DataType _type;
- bool _fixed_buffers;
- bool _broadcast;
- Sample _last_broadcasted_value;
+ uint32_t _index;
+ uint32_t _poly;
+ uint32_t _buffer_size;
+ DataType _type;
+ Raul::Atom _value;
+ bool _fixed_buffers;
+ bool _broadcast;
+ Sample _last_broadcasted_value;
Raul::Array<Buffer*>* _buffers;