summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
committerDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
commit81e9fb3245bd461ebfee4cfa16d1792e48533f9e (patch)
treeeb1b30d79cba70dda9d832100dd7c14b08085b03 /src/server
parente9d9569271ee962c09ab66c6babed1ca5655a6c6 (diff)
downloadingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.gz
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.bz2
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.zip
Centralise atom creation in forge object.
Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4054 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/BufferFactory.cpp6
-rw-r--r--src/server/BufferFactory.hpp1
-rw-r--r--src/server/ControlBindings.cpp5
-rw-r--r--src/server/ControlBindings.hpp9
-rw-r--r--src/server/DuplexPort.cpp3
-rw-r--r--src/server/Engine.cpp35
-rw-r--r--src/server/Event.hpp2
-rw-r--r--src/server/InputPort.cpp7
-rw-r--r--src/server/LV2Node.cpp19
-rw-r--r--src/server/Notification.cpp17
-rw-r--r--src/server/Notification.hpp2
-rw-r--r--src/server/PatchImpl.cpp2
-rw-r--r--src/server/PortImpl.cpp15
-rw-r--r--src/server/events/CreatePort.cpp6
-rw-r--r--src/server/events/RegisterClient.cpp7
-rw-r--r--src/server/events/SetMetadata.cpp2
-rw-r--r--src/server/ingen_lv2.cpp15
-rw-r--r--src/server/internals/Controller.cpp36
-rw-r--r--src/server/internals/Delay.cpp22
-rw-r--r--src/server/internals/Note.cpp29
-rw-r--r--src/server/internals/Trigger.cpp35
21 files changed, 162 insertions, 113 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index a26b0361..6e6474e9 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -51,6 +51,12 @@ BufferFactory::~BufferFactory()
free_list(_free_object.get());
}
+Raul::Forge&
+BufferFactory::forge()
+{
+ return _engine.world()->forge();
+}
+
void
BufferFactory::free_list(Buffer* head)
{
diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp
index a1634c86..15d5ebb8 100644
--- a/src/server/BufferFactory.hpp
+++ b/src/server/BufferFactory.hpp
@@ -59,6 +59,7 @@ public:
void set_block_length(SampleCount block_length);
+ Raul::Forge& forge();
Ingen::Shared::URIs& uris() { assert(_uris); return *_uris.get(); }
private:
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index e761ddac..d8d0ec07 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -208,7 +208,7 @@ ControlBindings::control_to_port_value(Type type,
//if (toggled)
// scaled_value = (scaled_value < 0.5) ? 0.0 : 1.0;
- return Raul::Atom(scaled_value);
+ return _engine.world()->forge().make(scaled_value);
}
int16_t
@@ -288,7 +288,8 @@ ControlBindings::bind(ProcessContext& context, Key key)
_bindings->insert(make_pair(key, _learn_port));
const Notification note = Notification::make(
- Notification::PORT_BINDING, context.start(), _learn_port, key.num, key.type);
+ Notification::PORT_BINDING, context.start(), _learn_port,
+ context.engine().world()->forge().make(key.num), key.type);
context.event_sink().write(sizeof(note), &note);
_learn_port = NULL;
diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp
index fc390ba3..f0858853 100644
--- a/src/server/ControlBindings.hpp
+++ b/src/server/ControlBindings.hpp
@@ -18,11 +18,14 @@
#ifndef INGEN_ENGINE_CONTROLBINDINGS_HPP
#define INGEN_ENGINE_CONTROLBINDINGS_HPP
-#include <stdint.h>
#include <map>
-#include "raul/SharedPtr.hpp"
-#include "raul/Path.hpp"
+#include <stdint.h>
+
#include "ingen/shared/LV2URIMap.hpp"
+#include "raul/Atom.hpp"
+#include "raul/Path.hpp"
+#include "raul/SharedPtr.hpp"
+
#include "BufferFactory.hpp"
namespace Ingen {
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index c2a2b505..8b8cf541 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -51,7 +51,8 @@ DuplexPort::DuplexPort(
, _is_output(is_output)
{
assert(PortImpl::_parent == parent);
- set_property(bufs.uris().ingen_polyphonic, polyphonic);
+ set_property(bufs.uris().ingen_polyphonic,
+ bufs.forge().make(polyphonic));
}
bool
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 1d976edd..ebfd73b3 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -151,7 +151,8 @@ Engine::activate()
_message_context->Thread::start();
- const Ingen::Shared::URIs& uris = *world()->uris().get();
+ const Ingen::Shared::URIs& uris = *world()->uris().get();
+ Raul::Forge& forge = world()->forge();
// Create root patch
PatchImpl* root_patch = _driver->root_patch();
@@ -160,7 +161,7 @@ Engine::activate()
root_patch->set_property(uris.rdf_type,
Resource::Property(uris.ingen_Patch, Resource::INTERNAL));
root_patch->set_property(uris.ingen_polyphony,
- Resource::Property(Raul::Atom(int32_t(1)),
+ Resource::Property(_world->forge().make(int32_t(1)),
Resource::INTERNAL));
root_patch->activate(*_buffer_factory);
_world->store()->add(root_patch);
@@ -170,20 +171,24 @@ Engine::activate()
ProcessContext context(*this);
Resource::Properties control_properties;
- control_properties.insert(make_pair(uris.lv2_name, "Control"));
- control_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort));
+ control_properties.insert(make_pair(uris.lv2_name,
+ forge.make("Control")));
+ control_properties.insert(make_pair(uris.rdf_type,
+ uris.ev_EventPort));
// Add control input
Resource::Properties in_properties(control_properties);
in_properties.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
in_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort));
- in_properties.insert(make_pair(uris.lv2_index, 0));
+ in_properties.insert(make_pair(uris.lv2_index, forge.make(0)));
in_properties.insert(make_pair(uris.lv2_portProperty,
uris.lv2_connectionOptional));
- in_properties.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(32.0f, Resource::EXTERNAL)));
- in_properties.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(32.0f, Resource::EXTERNAL)));
+ in_properties.insert(
+ make_pair(uris.ingen_canvasX,
+ Resource::Property(forge.make(32.0f), Resource::EXTERNAL)));
+ in_properties.insert(
+ make_pair(uris.ingen_canvasY,
+ Resource::Property(forge.make(32.0f), Resource::EXTERNAL)));
execute_and_delete_event(
context, new Events::CreatePort(*this, NULL, -1, 0,
@@ -193,13 +198,15 @@ Engine::activate()
Resource::Properties out_properties(control_properties);
out_properties.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
out_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort));
- out_properties.insert(make_pair(uris.lv2_index, 1));
+ out_properties.insert(make_pair(uris.lv2_index, forge.make(1)));
in_properties.insert(make_pair(uris.lv2_portProperty,
uris.lv2_connectionOptional));
- out_properties.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(128.0f, Resource::EXTERNAL)));
- out_properties.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(32.0f, Resource::EXTERNAL)));
+ out_properties.insert(
+ make_pair(uris.ingen_canvasX,
+ Resource::Property(forge.make(128.0f), Resource::EXTERNAL)));
+ out_properties.insert(
+ make_pair(uris.ingen_canvasY,
+ Resource::Property(forge.make(32.0f), Resource::EXTERNAL)));
execute_and_delete_event(
context, new Events::CreatePort(*this, NULL, -1, 0,
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index 9572610c..8bb1d8aa 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -39,7 +39,7 @@ class ProcessContext;
/** An event (command) to perform some action on Ingen.
*
- * Virtuall all operations on Ingen are implemented as events. An event has
+ * Virtually all operations on Ingen are implemented as events. An event has
* three distinct execution phases:
*
* 1) Pre-process: In a non-realtime thread, prepare event for execution
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index ce0c6263..9ab3692e 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -57,8 +57,8 @@ InputPort::InputPort(BufferFactory& bufs,
// Set default control range
if (type == PortType::CONTROL || type == PortType::CV) {
- set_property(uris.lv2_minimum, 0.0f);
- set_property(uris.lv2_maximum, 1.0f);
+ set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ set_property(uris.lv2_maximum, bufs.forge().make(1.0f));
}
}
@@ -158,7 +158,8 @@ InputPort::remove_connection(ProcessContext& context, const OutputPort* src_port
if (is_a(PortType::AUDIO)) {
// Send an update peak of 0.0 to reset to silence
const Notification note = Notification::make(
- Notification::PORT_ACTIVITY, context.start(), this, 0.0f);
+ Notification::PORT_ACTIVITY, context.start(), this,
+ context.engine().world()->forge().make(0.0f));
context.event_sink().write(sizeof(note), &note);
}
_broadcast = false;
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 2ff24538..ff886166 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -138,9 +138,10 @@ LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly)
bool
LV2Node::instantiate(BufferFactory& bufs)
{
- const Ingen::Shared::URIs& uris = bufs.uris();
- SharedPtr<LV2Info> info = _lv2_plugin->lv2_info();
- const LilvPlugin* plug = _lv2_plugin->lilv_plugin();
+ const Ingen::Shared::URIs& uris = bufs.uris();
+ SharedPtr<LV2Info> info = _lv2_plugin->lv2_info();
+ const LilvPlugin* plug = _lv2_plugin->lilv_plugin();
+ Raul::Forge& forge = bufs.forge();
uint32_t num_ports = lilv_plugin_get_num_ports(plug);
assert(num_ports > 0);
@@ -251,7 +252,7 @@ LV2Node::instantiate(BufferFactory& bufs)
if (lilv_node_is_string(d)) {
const char* str_val = lilv_node_as_string(d);
const size_t str_val_len = strlen(str_val);
- val = str_val;
+ val = forge.make(str_val);
port_buffer_size = str_val_len;
}
}
@@ -281,7 +282,7 @@ LV2Node::instantiate(BufferFactory& bufs)
}
if (val.type() == Atom::NIL)
- val = isnan(def_values[j]) ? 0.0f : def_values[j];
+ val = forge.make(isnan(def_values[j]) ? 0.0f : def_values[j]);
// TODO: set buffer size when necessary
if (direction == INPUT)
@@ -293,12 +294,12 @@ LV2Node::instantiate(BufferFactory& bufs)
|| data_type == PortType::CV)) {
port->set_value(val);
if (!isnan(min_values[j])) {
- port->set_property(uris.lv2_minimum, min_values[j]);
- port->set_minimum(min_values[j]);
+ port->set_property(uris.lv2_minimum, forge.make(min_values[j]));
+ port->set_minimum(forge.make(min_values[j]));
}
if (!isnan(max_values[j])) {
- port->set_property(uris.lv2_maximum, max_values[j]);
- port->set_maximum(max_values[j]);
+ port->set_property(uris.lv2_maximum, forge.make(max_values[j]));
+ port->set_maximum(forge.make(max_values[j]));
}
}
diff --git a/src/server/Notification.cpp b/src/server/Notification.cpp
index 0d78d0b4..c9ea9d00 100644
--- a/src/server/Notification.cpp
+++ b/src/server/Notification.cpp
@@ -28,11 +28,12 @@ void
Notification::post_process(Notification& note,
Engine& engine)
{
+ Raul::Forge& forge = engine.world()->forge();
switch (note.type) {
case PORT_VALUE:
- engine.broadcaster()->set_property(
- note.port->path(),
- engine.world()->uris()->ingen_value, note.value);
+ engine.broadcaster()->set_property(note.port->path(),
+ engine.world()->uris()->ingen_value,
+ note.value);
break;
case PORT_ACTIVITY:
engine.broadcaster()->activity(note.port->path(), note.value);
@@ -43,7 +44,7 @@ Notification::post_process(Notification& note,
switch (note.binding_type) {
case ControlBindings::MIDI_CC:
dict[uris.rdf_type] = uris.midi_Controller;
- dict[uris.midi_controllerNumber] = note.value.get_int32();
+ dict[uris.midi_controllerNumber] = forge.make(note.value.get_int32());
break;
case ControlBindings::MIDI_BENDER:
dict[uris.rdf_type] = uris.midi_Bender;
@@ -53,17 +54,19 @@ Notification::post_process(Notification& note,
break;
case ControlBindings::MIDI_NOTE:
dict[uris.rdf_type] = uris.midi_NoteOn;
- dict[uris.midi_noteNumber] = note.value.get_int32();
+ dict[uris.midi_noteNumber] = note.value;
break;
case ControlBindings::MIDI_RPN: // TODO
case ControlBindings::MIDI_NRPN: // TODO
case ControlBindings::NULL_CONTROL:
break;
}
- note.port->set_property(uris.ingen_controlBinding, dict); // FIXME: thread unsafe
+ // FIXME: not thread-safe
+ const Raul::Atom dict_atom = forge.alloc(dict);
+ note.port->set_property(uris.ingen_controlBinding, dict_atom);
engine.broadcaster()->set_property(note.port->path(),
uris.ingen_controlBinding,
- dict);
+ dict_atom);
break;
}
case NIL:
diff --git a/src/server/Notification.hpp b/src/server/Notification.hpp
index 8fea775e..9f71c1a4 100644
--- a/src/server/Notification.hpp
+++ b/src/server/Notification.hpp
@@ -18,8 +18,6 @@
#ifndef INGEN_ENGINE_NOTIFICATION_HPP
#define INGEN_ENGINE_NOTIFICATION_HPP
-#include "raul/Atom.hpp"
-
#include "ControlBindings.hpp"
#include "types.hpp"
diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp
index b6956baa..f43abf39 100644
--- a/src/server/PatchImpl.cpp
+++ b/src/server/PatchImpl.cpp
@@ -356,7 +356,7 @@ PatchImpl::create_port(BufferFactory& bufs,
Raul::Atom value;
if (type == PortType::CONTROL || type == PortType::CV)
- value = 0.0f;
+ value = bufs.forge().make(0.0f);
return new DuplexPort(bufs, this, name, num_ports(), polyphonic, _polyphony,
type, value, buffer_size, is_output);
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index ac4eb21f..c52199ae 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -55,8 +55,8 @@ PortImpl::PortImpl(BufferFactory& bufs,
, _buffer_size(buffer_size)
, _type(type)
, _value(value)
- , _min(0.0f)
- , _max(1.0f)
+ , _min(bufs.forge().make(0.0f))
+ , _max(bufs.forge().make(1.0f))
, _last_broadcasted_value(value)
, _context(Context::AUDIO)
, _buffers(new Array<BufferFactory::Ref>(static_cast<size_t>(poly)))
@@ -72,7 +72,7 @@ PortImpl::PortImpl(BufferFactory& bufs,
const Ingen::Shared::URIs& uris = bufs.uris();
add_property(uris.rdf_type, type.uri());
- set_property(uris.lv2_index, Atom((int32_t)index));
+ set_property(uris.lv2_index, bufs.forge().make((int32_t)index));
set_context(_context);
}
@@ -206,12 +206,13 @@ PortImpl::clear_buffers()
void
PortImpl::broadcast_value(Context& context, bool force)
{
- Raul::Atom val;
+ Raul::Forge& forge = context.engine().world()->forge();
+ Raul::Atom val;
switch (_type.symbol()) {
case PortType::UNKNOWN:
break;
case PortType::AUDIO:
- val = ((AudioBuffer*)buffer(0).get())->peak(context);
+ val = forge.make(((AudioBuffer*)buffer(0).get())->peak(context));
{
const Notification note = Notification::make(
Notification::PORT_ACTIVITY, context.start(), this, val);
@@ -220,12 +221,12 @@ PortImpl::broadcast_value(Context& context, bool force)
return;
case PortType::CONTROL:
case PortType::CV:
- val = ((AudioBuffer*)buffer(0).get())->value_at(0);
+ val = forge.make(((AudioBuffer*)buffer(0).get())->value_at(0));
break;
case PortType::EVENTS:
if (((EventBuffer*)buffer(0).get())->event_count() > 0) {
const Notification note = Notification::make(
- Notification::PORT_ACTIVITY, context.start(), this, Atom(true));
+ Notification::PORT_ACTIVITY, context.start(), this, forge.make(true));
context.event_sink().write(sizeof(note), &note);
}
break;
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 5080fb79..4f4753d3 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -111,7 +111,9 @@ CreatePort::pre_process()
Resource::Properties::const_iterator index_i = _properties.find(uris.lv2_index);
if (index_i == _properties.end()) {
- index_i = _properties.insert(make_pair(uris.lv2_index, (int)old_num_ports));
+ index_i = _properties.insert(
+ make_pair(uris.lv2_index,
+ _engine.world()->forge().make(int32_t(old_num_ports))));
} else if (index_i->second.type() != Atom::INT
|| index_i->second.get_int32() != static_cast<int32_t>(old_num_ports)) {
Event::pre_process();
@@ -127,7 +129,7 @@ CreatePort::pre_process()
_patch_port->properties().insert(_properties.begin(), _properties.end());
- assert(index_i->second == Atom((int)_patch_port->index()));
+ assert(index_i->second == _engine.world()->forge().make((int)_patch_port->index()));
if (_patch_port) {
diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp
index c18afb72..d95cc19c 100644
--- a/src/server/events/RegisterClient.cpp
+++ b/src/server/events/RegisterClient.cpp
@@ -56,9 +56,10 @@ RegisterClient::post_process()
that to clients.
*/
const Ingen::Shared::URIs& uris = *_engine.world()->uris().get();
- _request_client->set_property(uris.ingen_engine,
- uris.ingen_sampleRate,
- int32_t(_engine.driver()->sample_rate()));
+ _request_client->set_property(
+ uris.ingen_engine,
+ uris.ingen_sampleRate,
+ _engine.world()->forge().make(int32_t(_engine.driver()->sample_rate())));
}
} // namespace Server
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 68bd24d5..0603a150 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -230,7 +230,7 @@ SetMetadata::pre_process()
if (parent) {
if (value.type() == Atom::BOOL) {
op = POLYPHONIC;
- obj->set_property(key, value.get_bool(), value.context());
+ obj->set_property(key, value, value.context());
NodeImpl* node = dynamic_cast<NodeImpl*>(obj);
if (node)
node->set_polyphonic(value.get_bool());
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 9275d555..a568531c 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -68,10 +68,10 @@ public:
typedef std::vector< SharedPtr<const LV2Patch> > Patches;
- Patches patches;
- Ingen::Shared::Configuration conf;
- int argc;
- char** argv;
+ Patches patches;
+ Ingen::Shared::Configuration* conf;
+ int argc;
+ char** argv;
};
/** Library state (constructed/destructed on library load/unload) */
@@ -276,7 +276,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
}
IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin));
- plugin->world = new Ingen::Shared::World(&lib.conf, lib.argc, lib.argv);
+ plugin->world = new Ingen::Shared::World(lib.conf, lib.argc, lib.argv);
if (!plugin->world->load_module("serialisation")) {
delete plugin->world;
return NULL;
@@ -513,9 +513,12 @@ Lib::Lib()
using namespace Ingen;
+ // FIXME
+ Raul::Forge forge;
+ conf = new Ingen::Shared::Configuration(&forge);
Ingen::Shared::set_bundle_path_from_code((void*)&lv2_descriptor);
- Ingen::Shared::World* world = new Ingen::Shared::World(&conf, argc, argv);
+ Ingen::Shared::World* world = new Ingen::Shared::World(conf, argc, argv);
if (!world->load_module("serialisation")) {
delete world;
return;
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index df9c6bfb..f29951c8 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -53,31 +53,36 @@ ControllerNode::ControllerNode(InternalPlugin* plugin,
_ports = new Raul::Array<PortImpl*>(6);
_midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _param_port = new InputPort(bufs, this, "controller", 1, 1, PortType::CONTROL, 0.0f);
- _param_port->set_property(uris.lv2_minimum, 0.0f);
- _param_port->set_property(uris.lv2_maximum, 127.0f);
- _param_port->set_property(uris.lv2_integer, true);
- _param_port->set_property(uris.lv2_name, "Controller");
+ _param_port = new InputPort(bufs, this, "controller", 1, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
+ _param_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _param_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
+ _param_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _param_port->set_property(uris.lv2_name, bufs.forge().make("Controller"));
_ports->at(1) = _param_port;
- _log_port = new InputPort(bufs, this, "logarithmic", 2, 1, PortType::CONTROL, 0.0f);
+ _log_port = new InputPort(bufs, this, "logarithmic", 2, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
_log_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _log_port->set_property(uris.lv2_name, "Logarithmic");
+ _log_port->set_property(uris.lv2_name, bufs.forge().make("Logarithmic"));
_ports->at(2) = _log_port;
- _min_port = new InputPort(bufs, this, "minimum", 3, 1, PortType::CONTROL, 0.0f);
- _min_port->set_property(uris.lv2_name, "Minimum");
+ _min_port = new InputPort(bufs, this, "minimum", 3, 1,
+ PortType::CONTROL, bufs.forge().make(0.0f));
+ _min_port->set_property(uris.lv2_name, bufs.forge().make("Minimum"));
_ports->at(3) = _min_port;
- _max_port = new InputPort(bufs, this, "maximum", 4, 1, PortType::CONTROL, 1.0f);
- _max_port->set_property(uris.lv2_name, "Maximum");
+ _max_port = new InputPort(bufs, this, "maximum", 4, 1,
+ PortType::CONTROL, bufs.forge().make(1.0f));
+ _max_port->set_property(uris.lv2_name, bufs.forge().make("Maximum"));
_ports->at(4) = _max_port;
- _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1, PortType::AUDIO, 0.0f);
- _audio_port->set_property(uris.lv2_name, "Output");
+ _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _audio_port->set_property(uris.lv2_name, bufs.forge().make("Output"));
_ports->at(5) = _audio_port;
}
@@ -115,7 +120,8 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va
const Sample nval = (val / 127.0f); // normalized [0, 1]
if (_learning) {
- _param_port->set_value(control_num);
+ // FIXME: not thread safe
+ _param_port->set_value(context.engine().world()->forge().make(control_num));
((AudioBuffer*)_param_port->buffer(0).get())->set_value(
(float)control_num, context.start(), context.end());
_param_port->broadcast_value(context, true);
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index a1b331ed..e3be103a 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -71,19 +71,23 @@ DelayNode::DelayNode(
_last_delay_time = default_delay;
_delay_samples = default_delay;
- _delay_port = new InputPort(bufs, this, "delay", 1, _polyphony, PortType::CONTROL, default_delay);
- _delay_port->set_property(uris.lv2_name, "Delay");
- _delay_port->set_property(uris.lv2_default, default_delay);
- _delay_port->set_property(uris.lv2_minimum, (float)(1.0/(double)srate));
- _delay_port->set_property(uris.lv2_maximum, MAX_DELAY_SECONDS);
+ _delay_port = new InputPort(bufs, this, "delay", 1, _polyphony,
+ PortType::CONTROL, bufs.forge().make(default_delay));
+ _delay_port->set_property(uris.lv2_name, bufs.forge().make("Delay"));
+ _delay_port->set_property(uris.lv2_default, bufs.forge().make(default_delay));
+ _delay_port->set_property(uris.lv2_minimum, bufs.forge().make((float)(1.0/(double)srate)));
+ _delay_port->set_property(uris.lv2_maximum, bufs.forge().make(MAX_DELAY_SECONDS));
_ports->at(0) = _delay_port;
- _in_port = new InputPort(bufs, this, "in", 0, 1, PortType::AUDIO, 0.0f);
- _in_port->set_property(uris.lv2_name, "Input");
+ _in_port = new InputPort(bufs, this, "in", 0, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(1) = _in_port;
- _out_port = new OutputPort(bufs, this, "out", 0, 1, PortType::AUDIO, 0.0f);
- _out_port->set_property(uris.lv2_name, "Output");
+ _out_port = new OutputPort(bufs, this, "out", 0, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _out_port->set_property(uris.lv2_name,
+ bufs.forge().make("Output"));
_ports->at(2) = _out_port;
//_buffer = bufs.get(PortType::AUDIO, bufs.audio_buffer_size(buffer_length_frames), true);
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index 6942cb02..fc88038b 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -61,28 +61,33 @@ NoteNode::NoteNode(
const Ingen::Shared::URIs& uris = bufs.uris();
_ports = new Raul::Array<PortImpl*>(5);
- _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port = new InputPort(bufs, this, "input", 0, 1,
+ PortType::EVENTS, Raul::Atom());
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, PortType::AUDIO, 440.0f);
- _freq_port->set_property(uris.lv2_name, "Frequency");
+ _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony,
+ PortType::AUDIO, bufs.forge().make(440.0f));
+ _freq_port->set_property(uris.lv2_name, bufs.forge().make("Frequency"));
_ports->at(1) = _freq_port;
- _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, PortType::AUDIO, 0.0f);
- _vel_port->set_property(uris.lv2_minimum, 0.0f);
- _vel_port->set_property(uris.lv2_maximum, 1.0f);
- _vel_port->set_property(uris.lv2_name, "Velocity");
+ _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f));
+ _vel_port->set_property(uris.lv2_name, bufs.forge().make("Velocity"));
_ports->at(2) = _vel_port;
- _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, PortType::AUDIO, 0.0f);
+ _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _gate_port->set_property(uris.lv2_name, "Gate");
+ _gate_port->set_property(uris.lv2_name, bufs.forge().make("Gate"));
_ports->at(3) = _gate_port;
- _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, PortType::AUDIO, 0.0f);
+ _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _trig_port->set_property(uris.lv2_name, "Trigger");
+ _trig_port->set_property(uris.lv2_name, bufs.forge().make("Trigger"));
_ports->at(4) = _trig_port;
}
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 0f2e03ab..ccab41f2 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -56,30 +56,34 @@ TriggerNode::TriggerNode(
_ports = new Raul::Array<PortImpl*>(5);
_midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom());
- _midi_in_port->set_property(uris.lv2_name, "Input");
+ _midi_in_port->set_property(uris.lv2_name, bufs.forge().make("Input"));
_ports->at(0) = _midi_in_port;
- _note_port = new InputPort(bufs, this, "note", 1, 1, PortType::CONTROL, 60.0f);
- _note_port->set_property(uris.lv2_minimum, 0.0f);
- _note_port->set_property(uris.lv2_maximum, 127.0f);
- _note_port->set_property(uris.lv2_integer, true);
- _note_port->set_property(uris.lv2_name, "Note");
+ _note_port = new InputPort(bufs, this, "note", 1, 1,
+ PortType::CONTROL, bufs.forge().make(60.0f));
+ _note_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _note_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
+ _note_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _note_port->set_property(uris.lv2_name, bufs.forge().make("Note"));
_ports->at(1) = _note_port;
- _gate_port = new OutputPort(bufs, this, "gate", 2, 1, PortType::AUDIO, 0.0f);
+ _gate_port = new OutputPort(bufs, this, "gate", 2, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _gate_port->set_property(uris.lv2_name, "Gate");
+ _gate_port->set_property(uris.lv2_name, bufs.forge().make("Gate"));
_ports->at(2) = _gate_port;
- _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, PortType::AUDIO, 0.0f);
+ _trig_port = new OutputPort(bufs, this, "trigger", 3, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
_trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled);
- _trig_port->set_property(uris.lv2_name, "Trigger");
+ _trig_port->set_property(uris.lv2_name, bufs.forge().make("Trigger"));
_ports->at(3) = _trig_port;
- _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, PortType::AUDIO, 0.0f);
- _vel_port->set_property(uris.lv2_minimum, 0.0f);
- _vel_port->set_property(uris.lv2_maximum, 1.0f);
- _vel_port->set_property(uris.lv2_name, "Velocity");
+ _vel_port = new OutputPort(bufs, this, "velocity", 4, 1,
+ PortType::AUDIO, bufs.forge().make(0.0f));
+ _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
+ _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f));
+ _vel_port->set_property(uris.lv2_name, bufs.forge().make("Velocity"));
_ports->at(4) = _vel_port;
}
@@ -133,7 +137,8 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity
assert(time >= context.start() && time <= context.end());
if (_learning) {
- _note_port->set_value(note_num);
+ // FIXME
+ //_note_port->set_value(note_num);
((AudioBuffer*)_note_port->buffer(0).get())->set_value(
(float)note_num, context.start(), context.end());
_note_port->broadcast_value(context, true);