summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/client/PluginModel.cpp23
-rw-r--r--src/client/PluginUI.cpp14
-rw-r--r--src/gui/App.hpp1
-rw-r--r--src/gui/ConnectWindow.cpp77
-rw-r--r--src/gui/ControlPanel.hpp2
-rw-r--r--src/gui/Controls.cpp7
-rw-r--r--src/gui/LoadPatchWindow.cpp10
-rw-r--r--src/gui/LoadPluginWindow.cpp7
-rw-r--r--src/gui/NewSubpatchWindow.cpp4
-rw-r--r--src/gui/NodeMenu.cpp8
-rw-r--r--src/gui/NodeModule.cpp19
-rw-r--r--src/gui/ObjectMenu.cpp7
-rw-r--r--src/gui/PatchCanvas.cpp27
-rw-r--r--src/gui/PatchPortModule.cpp10
-rw-r--r--src/gui/PatchTreeWindow.cpp6
-rw-r--r--src/gui/PatchView.cpp14
-rw-r--r--src/gui/PatchWindow.cpp4
-rw-r--r--src/gui/Port.cpp4
-rw-r--r--src/gui/PortMenu.cpp8
-rw-r--r--src/gui/PortPropertiesWindow.cpp8
-rw-r--r--src/gui/PropertiesWindow.cpp10
-rw-r--r--src/gui/RenameWindow.cpp4
-rw-r--r--src/gui/SubpatchModule.cpp4
-rw-r--r--src/ingen/main.cpp3
-rw-r--r--src/osc/OSCEngineReceiver.cpp17
-rw-r--r--src/serialisation/Parser.cpp20
-rw-r--r--src/serialisation/Serialiser.cpp5
-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
-rw-r--r--src/shared/Builder.cpp5
-rw-r--r--src/shared/Configuration.cpp37
-rw-r--r--src/shared/LV2Atom.cpp13
-rw-r--r--src/shared/URIs.cpp5
-rw-r--r--src/shared/World.cpp8
53 files changed, 393 insertions, 273 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 72326dd0..09a5abfb 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -51,14 +51,16 @@ PluginModel::PluginModel(Shared::URIs& uris,
add_properties(properties);
assert(_rdf_world);
- add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", this->type_uri());
+ add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
+ this->type_uri());
LilvNode* plugin_uri = lilv_new_uri(_lilv_world, uri.c_str());
_lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri);
lilv_node_free(plugin_uri);
- if (_type == Internal)
+ if (_type == Internal) {
set_property("http://usefulinc.com/ns/doap#name",
- Atom(uri.substr(uri.find_last_of('#') + 1).c_str()));
+ uris.forge.alloc(uri.substr(uri.find_last_of('#') + 1)));
+ }
}
const Atom&
@@ -93,7 +95,8 @@ PluginModel::get_property(const URI& key) const
else
symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1);
}
- set_property("http://lv2plug.in/ns/lv2core#symbol", symbol);
+ set_property("http://lv2plug.in/ns/lv2core#symbol",
+ _uris.forge.alloc(symbol));
return get_property(key);
}
@@ -105,16 +108,20 @@ PluginModel::get_property(const URI& key) const
LILV_FOREACH(nodes, i, values) {
const LilvNode* val = lilv_nodes_get(values, i);
if (lilv_node_is_uri(val)) {
- ret = set_property(key, Atom(Atom::URI, lilv_node_as_uri(val)));
+ ret = set_property(
+ key, _uris.forge.alloc(Atom::URI, lilv_node_as_uri(val)));
break;
} else if (lilv_node_is_string(val)) {
- ret = set_property(key, lilv_node_as_string(val));
+ ret = set_property(key,
+ _uris.forge.alloc(lilv_node_as_string(val)));
break;
} else if (lilv_node_is_float(val)) {
- ret = set_property(key, Atom(lilv_node_as_float(val)));
+ ret = set_property(key,
+ _uris.forge.make(lilv_node_as_float(val)));
break;
} else if (lilv_node_is_int(val)) {
- ret = set_property(key, Atom(lilv_node_as_int(val)));
+ ret = set_property(key,
+ _uris.forge.make(lilv_node_as_int(val)));
break;
}
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 37789b28..f69d189b 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -63,9 +63,10 @@ lv2_ui_write(SuilController controller,
if (*(float*)buffer == port->value().get_float())
return; // do nothing (handle stupid plugin UIs that feed back)
- ui->world()->engine()->set_property(port->path(),
- uris.ingen_value,
- Atom(*(float*)buffer));
+ ui->world()->engine()->set_property(
+ port->path(),
+ uris.ingen_value,
+ ui->world()->forge().make(*(float*)buffer));
} else if (format == uris.ui_Events.id) {
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
@@ -77,11 +78,14 @@ lv2_ui_write(SuilController controller,
std::pair<bool, uint16_t> midi_id =
uri_map.global_to_event(uris.midi_MidiEvent.id);
if (midi_id.first && ev->type == midi_id.second) {
- // FIXME: bundle multiple events by writing an entire buffer here
+ // FIXME
+ /*
ui->world()->engine()->set_property(
port->path(),
uris.ingen_value,
- Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size, data));
+ Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size,
+ data));
+ */
} else {
warn << "Unable to serialise UI event type " << ev->type
<< ", event lost" << endl;
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 5ca767e9..9953a993 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -102,6 +102,7 @@ public:
Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const std::string& path, int size);
+ Raul::Forge& forge() const { return _world->forge(); }
SharedPtr<Ingen::ServerInterface> engine() const { return _world->engine(); }
SharedPtr<Client::SigClientInterface> client() const { return _client; }
SharedPtr<Client::ClientStore> store() const { return _store; }
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 0bfa1999..b14e388e 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -104,13 +104,13 @@ ConnectWindow::set_connected_to(SharedPtr<ServerInterface> engine)
else
_internal_radio->set_sensitive(false);
- _server_radio->set_sensitive(true);
- _launch_radio->set_sensitive(true);
+ _server_radio->set_sensitive(true);
+ _launch_radio->set_sensitive(true);
- if (_mode == CONNECT_REMOTE )
- _url_entry->set_sensitive(true);
- else if (_mode == LAUNCH_REMOTE )
- _port_spinbutton->set_sensitive(true);
+ if (_mode == CONNECT_REMOTE )
+ _url_entry->set_sensitive(true);
+ else if (_mode == LAUNCH_REMOTE )
+ _port_spinbutton->set_sensitive(true);
_progress_label->set_text(string("Disconnected"));
}
@@ -194,7 +194,7 @@ ConnectWindow::connect(bool existing)
_app->register_callbacks();
Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
+ sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
} else {
error << "Failed to launch ingen process." << endl;
@@ -205,22 +205,22 @@ ConnectWindow::connect(bool existing)
} else
#endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP)
- if (_mode == INTERNAL) {
- if (!world->local_engine())
- world->load_module("server");
+ if (_mode == INTERNAL) {
+ if (!world->local_engine())
+ world->load_module("server");
- SharedPtr<SigClientInterface> client(new SigClientInterface());
+ SharedPtr<SigClientInterface> client(new SigClientInterface());
- world->load_module("jack");
+ world->load_module("jack");
- world->local_engine()->activate();
+ world->local_engine()->activate();
- _app->attach(client);
- _app->register_callbacks();
+ _app->attach(client);
+ _app->register_callbacks();
- Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 10);
- }
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(this, &ConnectWindow::gtk_callback), 10);
+ }
}
void
@@ -247,16 +247,16 @@ void
ConnectWindow::activate()
{
_app->engine()->set_property("ingen:driver",
- "ingen:enabled",
- true);
+ "ingen:enabled",
+ _app->forge().make(true));
}
void
ConnectWindow::deactivate()
{
_app->engine()->set_property("ingen:driver",
- "ingen:enabled",
- false);
+ "ingen:enabled",
+ _app->forge().make(false));
}
void
@@ -288,20 +288,27 @@ ConnectWindow::load_widgets()
_xml->get_widget("connect_connect_button", _connect_button);
_xml->get_widget("connect_quit_button", _quit_button);
- _server_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::server_toggled));
- _launch_radio->signal_toggled().connect(sigc::mem_fun(this, &ConnectWindow::launch_toggled));
- _internal_radio->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::internal_toggled));
- _activate_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::activate));
- _deactivate_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::deactivate));
- _disconnect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::disconnect));
- _connect_button->signal_clicked().connect(sigc::bind(
- sigc::mem_fun(this, &ConnectWindow::connect), false));
- _quit_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::quit_clicked));
+ _server_radio->signal_toggled().connect(
+ sigc::mem_fun(this, &ConnectWindow::server_toggled));
+ _launch_radio->signal_toggled().connect(
+ sigc::mem_fun(this, &ConnectWindow::launch_toggled));
+ _internal_radio->signal_clicked().connect(
+ sigc::mem_fun(this, &ConnectWindow::internal_toggled));
+ _activate_button->signal_clicked().connect(
+ sigc::mem_fun(this, &ConnectWindow::activate));
+ _deactivate_button->signal_clicked().connect(
+ sigc::mem_fun(this, &ConnectWindow::deactivate));
+ _disconnect_button->signal_clicked().connect(
+ sigc::mem_fun(this, &ConnectWindow::disconnect));
+ _connect_button->signal_clicked().connect(
+ sigc::bind(sigc::mem_fun(this, &ConnectWindow::connect), false));
+ _quit_button->signal_clicked().connect(
+ sigc::mem_fun(this, &ConnectWindow::quit_clicked));
_progress_bar->set_pulse_step(0.01);
_widgets_loaded = true;
- server_toggled();
+ server_toggled();
}
void
@@ -360,7 +367,7 @@ ConnectWindow::gtk_callback()
// Show if attempted connection goes on for a noticeable amount of time
if (!is_visible()) {
const float ms_since_start = (now.tv_sec - start.tv_sec) * 1000.0f +
- (now.tv_usec - start.tv_usec) * 0.001f;
+ (now.tv_usec - start.tv_usec) * 0.001f;
if (ms_since_start > 500) {
present();
set_connecting_widget_states();
@@ -370,7 +377,7 @@ ConnectWindow::gtk_callback()
if (_connect_stage == 0) {
_attached = false;
_app->client()->signal_response().connect(
- sigc::mem_fun(this, &ConnectWindow::ingen_response));
+ sigc::mem_fun(this, &ConnectWindow::ingen_response));
_ping_id = abs(rand()) / 2 * 2; // avoid -1
_app->engine()->respond_to(_app->client().get(), _ping_id);
@@ -388,7 +395,7 @@ ConnectWindow::gtk_callback()
++_connect_stage;
} else {
const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f +
- (now.tv_usec - last.tv_usec) * 0.001f;
+ (now.tv_usec - last.tv_usec) * 0.001f;
if (ms_since_last > 1000) {
_app->engine()->respond_to(_app->client().get(), _ping_id);
_app->engine()->ping();
diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp
index 3e5aa8b6..4892947c 100644
--- a/src/gui/ControlPanel.hpp
+++ b/src/gui/ControlPanel.hpp
@@ -70,7 +70,7 @@ public:
template <typename T>
void value_changed(SharedPtr<const PortModel> port, T val) {
- this->value_changed_atom(port, Raul::Atom(val));
+ this->value_changed_atom(port, _app->forge().make(val));
}
private:
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index d4a0575b..eba36d1d 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -267,7 +267,7 @@ SliderControl::update_value_from_spinner()
_enable_signal = false;
const float value = _value_spinner->get_value();
- set_value(value);
+ set_value(_app->forge().make(value));
_control_panel->value_changed(_port_model, value);
@@ -391,8 +391,9 @@ void
StringControl::activated()
{
if (_enable_signal)
- _control_panel->value_changed_atom(_port_model,
- Raul::Atom(_entry->get_text().c_str()));
+ _control_panel->value_changed_atom(
+ _port_model,
+ _app->forge().make(_entry->get_text().c_str()));
}
} // namespace GUI
diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index 7a45f9bb..66c64495 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -149,9 +149,9 @@ LoadPatchWindow::ok_clicked()
const URIs& uris = _app->uris();
if (_poly_voices_radio->get_active())
- _initial_data.insert(make_pair(
- uris.ingen_polyphony,
- _poly_spinbutton->get_value_as_int()));
+ _initial_data.insert(
+ make_pair(uris.ingen_polyphony,
+ _app->forge().make(_poly_spinbutton->get_value_as_int())));
if (get_uri() == "")
return;
@@ -173,9 +173,9 @@ LoadPatchWindow::ok_clicked()
for (std::list<Glib::ustring>::iterator i = uri_list.begin(); i != uri_list.end(); ++i) {
// Cascade
Atom& x = _initial_data.find(uris.ingen_canvasX)->second;
- x = Atom(x.get_float() + 20.0f);
+ x = _app->forge().make(x.get_float() + 20.0f);
Atom& y = _initial_data.find(uris.ingen_canvasY)->second;
- y = Atom(y.get_float() + 20.0f);
+ y = _app->forge().make(y.get_float() + 20.0f);
Raul::Symbol symbol(symbol_from_filename(*i));
if (uri_list.size() == 1 && _symbol_entry->get_text() != "")
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index 44add7e8..f6b6e5e9 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -345,7 +345,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
Resource::Properties props = _initial_data;
props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
props.insert(make_pair(uris.rdf_instanceOf, plugin->uri()));
- props.insert(make_pair(uris.ingen_polyphonic, polyphonic));
+ props.insert(make_pair(uris.ingen_polyphonic, _app->forge().make(polyphonic)));
_app->engine()->put(path, props);
if (_selection->get_selected_rows().size() == 1) {
@@ -355,9 +355,9 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
// Cascade next node
Atom& x = _initial_data.find(uris.ingen_canvasX)->second;
- x = Atom(x.get_float() + 20.0f);
+ x = _app->forge().make(x.get_float() + 20.0f);
Atom& y = _initial_data.find(uris.ingen_canvasY)->second;
- y = Atom(y.get_float() + 20.0f);
+ y = _app->forge().make(y.get_float() + 20.0f);
}
}
@@ -373,7 +373,6 @@ LoadPluginWindow::filter_changed()
{
_rows.clear();
_plugins_liststore->clear();
-
string search = _search_entry->get_text();
transform(search.begin(), search.end(), search.begin(), ::toupper);
diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp
index 504bc506..ad0b6e42 100644
--- a/src/gui/NewSubpatchWindow.cpp
+++ b/src/gui/NewSubpatchWindow.cpp
@@ -99,8 +99,8 @@ NewSubpatchWindow::ok_clicked()
// Create patch
Resource::Properties props;
props.insert(make_pair(_app->uris().rdf_type, _app->uris().ingen_Patch));
- props.insert(make_pair(_app->uris().ingen_polyphony, Atom(int32_t(poly))));
- props.insert(make_pair(_app->uris().ingen_enabled, Atom(bool(true))));
+ props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly))));
+ props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true))));
_app->engine()->put(path, props, Resource::INTERNAL);
// Set external (node perspective) properties
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 88674f4f..2ceb4a66 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -144,8 +144,10 @@ NodeMenu::on_menu_randomize()
float min = 0.0f, max = 1.0f;
nm->port_value_range(*i, min, max, _app->sample_rate());
const float val = ((rand() / (float)RAND_MAX) * (max - min) + min);
- _app->engine()->set_property((*i)->path(),
- _app->uris().ingen_value, val);
+ _app->engine()->set_property(
+ (*i)->path(),
+ _app->uris().ingen_value,
+ _app->forge().make(val));
}
}
@@ -192,7 +194,7 @@ NodeMenu::on_preset_activated(const std::string& uri)
_app->engine()->set_property(
node->path().base() + lilv_node_as_string(sym),
_app->uris().ingen_value,
- lilv_node_as_float(val));
+ _app->forge().make(lilv_node_as_float(val)));
}
}
_app->engine()->bundle_end();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index bef84b2d..36c3b67b 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -228,7 +228,9 @@ NodeModule::embed_gui(bool embed)
for (NodeModel::Ports::const_iterator p = _node->ports().begin();
p != _node->ports().end(); ++p)
if ((*p)->is_output() && app().can_control(p->get()))
- app().engine()->set_property((*p)->path(), uris.ingen_broadcast, true);
+ app().engine()->set_property((*p)->path(),
+ uris.ingen_broadcast,
+ app().forge().make(true));
}
} else { // un-embed
@@ -240,8 +242,8 @@ NodeModule::embed_gui(bool embed)
p != _node->ports().end(); ++p)
if ((*p)->is_output() && app().can_control(p->get()))
app().engine()->set_property((*p)->path(),
- uris.ingen_broadcast,
- false);
+ uris.ingen_broadcast,
+ app().forge().make(false));
}
if (embed) {
@@ -372,8 +374,8 @@ NodeModule::on_event(GdkEvent* ev)
void
NodeModule::store_location(double ax, double ay)
{
- const Atom x(static_cast<float>(ax));
- const Atom y(static_cast<float>(ay));
+ const Atom x(app().forge().make(static_cast<float>(ax)));
+ const Atom y(app().forge().make(static_cast<float>(ay)));
const URIs& uris = app().uris();
@@ -442,8 +444,11 @@ NodeModule::set_selected(gboolean b)
}
}
}
- if (app().signal())
- app().engine()->set_property(_node->path(), uris.ingen_selected, b);
+ if (app().signal()) {
+ app().engine()->set_property(_node->path(),
+ uris.ingen_selected,
+ app().forge().make(b));
+ }
}
}
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 10dffa6d..4c3804bd 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -113,9 +113,10 @@ void
ObjectMenu::on_menu_polyphonic()
{
if (_enable_signal)
- _app->engine()->set_property(_object->path(),
- _app->uris().ingen_polyphonic,
- bool(_polyphonic_menuitem->get_active()));
+ _app->engine()->set_property(
+ _object->path(),
+ _app->uris().ingen_polyphonic,
+ _app->forge().make(bool(_polyphonic_menuitem->get_active())));
}
void
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 6690e93f..61e30e04 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -706,7 +706,7 @@ PatchCanvas::paste()
props.insert(make_pair(uris.rdf_type,
uris.ingen_Patch));
props.insert(make_pair(uris.ingen_polyphony,
- Raul::Atom(int32_t(_patch->internal_poly()))));
+ _app.forge().make(int32_t(_patch->internal_poly()))));
clipboard.put(Path(), props);
size_t first_slash;
while (to_create != "/" && !to_create.empty()
@@ -739,14 +739,17 @@ PatchCanvas::paste()
GraphObject::Properties::iterator x = props.find(uris.ingen_canvasX);
if (x != i->second->properties().end())
- x->second = x->second.get_float() + (20.0f * _paste_count);
+ x->second = _app.forge().make(
+ x->second.get_float() + (20.0f * _paste_count));
GraphObject::Properties::iterator y = props.find(uris.ingen_canvasY);
if (y != i->second->properties().end())
- y->second = y->second.get_float() + (20.0f * _paste_count);
+ y->second = _app.forge().make(
+ y->second.get_float() + (20.0f * _paste_count));
if (i->first.parent().is_root())
- i->second->set_property(uris.ingen_selected, true);
+ i->second->set_property(uris.ingen_selected,
+ _app.forge().make(true));
builder.build(i->second);
}
@@ -793,9 +796,9 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base,
props.insert(make_pair(uris.rdf_type,
is_output ? uris.lv2_OutputPort : uris.lv2_InputPort));
props.insert(make_pair(uris.lv2_index,
- Atom(int32_t(_patch->num_ports()))));
+ _app.forge().make(int32_t(_patch->num_ports()))));
props.insert(make_pair(uris.lv2_name,
- Atom(name.c_str())));
+ _app.forge().make(name.c_str())));
_app.engine()->put(path, props);
}
@@ -841,10 +844,14 @@ PatchCanvas::get_initial_data(Resource::Graph ctx)
{
GraphObject::Properties result;
const URIs& uris = _app.uris();
- result.insert(make_pair(uris.ingen_canvasX,
- Resource::Property((float)_last_click_x, ctx)));
- result.insert(make_pair(uris.ingen_canvasY,
- Resource::Property((float)_last_click_y, ctx)));
+ result.insert(
+ make_pair(uris.ingen_canvasX,
+ Resource::Property(_app.forge().make((float)_last_click_x),
+ ctx)));
+ result.insert(
+ make_pair(uris.ingen_canvasY,
+ Resource::Property(_app.forge().make((float)_last_click_y),
+ ctx)));
return result;
}
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 991103ac..be8008da 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -88,8 +88,8 @@ PatchPortModule::show_menu(GdkEventButton* ev)
void
PatchPortModule::store_location(double ax, double ay)
{
- const Atom x(static_cast<float>(ax));
- const Atom y(static_cast<float>(ay));
+ const Atom x(app().forge().make(static_cast<float>(ax)));
+ const Atom y(app().forge().make(static_cast<float>(ay)));
const URIs& uris = app().uris();
@@ -166,8 +166,10 @@ PatchPortModule::set_selected(gboolean b)
if (b != get_selected()) {
Module::set_selected(b);
if (app().signal())
- app().engine()->set_property(_model->path(),
- app().uris().ingen_selected, b);
+ app().engine()->set_property(
+ _model->path(),
+ app().uris().ingen_selected,
+ app().forge().make(b));
}
}
diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp
index c728fd2b..36bc78ea 100644
--- a/src/gui/PatchTreeWindow.cpp
+++ b/src/gui/PatchTreeWindow.cpp
@@ -186,8 +186,10 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
assert(pm);
if (_enable_signal)
- _app->engine()->set_property(pm->path(),
- _app->uris().ingen_enabled, (bool)!pm->enabled());
+ _app->engine()->set_property(
+ pm->path(),
+ _app->uris().ingen_enabled,
+ _app->forge().make((bool)!pm->enabled()));
}
void
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 4b920368..e2a650fa 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -188,17 +188,19 @@ PatchView::process_toggled()
if (!_enable_signal)
return;
- _app->engine()->set_property(_patch->path(),
- _app->uris().ingen_enabled,
- (bool)_process_but->get_active());
+ _app->engine()->set_property(
+ _patch->path(),
+ _app->uris().ingen_enabled,
+ _app->forge().make((bool)_process_but->get_active()));
}
void
PatchView::poly_changed()
{
- _app->engine()->set_property(_patch->path(),
- _app->uris().ingen_polyphony,
- _poly_spin->get_value_as_int());
+ _app->engine()->set_property(
+ _patch->path(),
+ _app->uris().ingen_polyphony,
+ _app->forge().make(_poly_spin->get_value_as_int()));
}
void
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index bdda7b54..748bec74 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -533,7 +533,9 @@ more files and/or directories, recursively. Existing files will be overwritten.
const Glib::ustring uri = Glib::filename_to_uri(filename);
_app->loader()->save_patch(_patch, uri);
const_cast<PatchModel*>(_patch.get())->set_property(
- uris.ingen_document, Atom(Atom::URI, uri.c_str()), Resource::EXTERNAL);
+ uris.ingen_document,
+ _app->forge().alloc(Atom::URI, uri.c_str()),
+ Resource::EXTERNAL);
_status_bar->push(
(boost::format("Saved %1% to %2%") % _patch->path().chop_scheme()
% filename).str(),
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 06d79c11..7c9de28b 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -152,11 +152,11 @@ Port::on_value_changed(const Glib::VariantBase& value)
Ingen::Shared::World* const world = _app.world();
_app.engine()->set_property(model()->path(),
world->uris()->ingen_value,
- Atom(fval));
+ _app.forge().make(fval));
PatchWindow* pw = get_patch_window();
if (pw) {
- pw->show_port_status(model().get(), fval);
+ pw->show_port_status(model().get(), _app.forge().make(fval));
}
}
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index 3656a97d..c757d917 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -128,10 +128,14 @@ PortMenu::on_menu_reset_range()
parent->default_port_value_range(model, min, max);
if (!std::isnan(min))
- _app->engine()->set_property(_object->path(), uris.lv2_minimum, min);
+ _app->engine()->set_property(_object->path(),
+ uris.lv2_minimum,
+ _app->forge().make(min));
if (!std::isnan(max))
- _app->engine()->set_property(_object->path(), uris.lv2_maximum, max);
+ _app->engine()->set_property(_object->path(),
+ uris.lv2_maximum,
+ _app->forge().make(max));
}
} // namespace GUI
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index cca61ecd..13dd4781 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -153,8 +153,12 @@ PortPropertiesWindow::ok()
{
const Shared::URIs& uris = _app->uris();
Resource::Properties props;
- props.insert(make_pair(uris.lv2_minimum, float(_min_spinner->get_value())));
- props.insert(make_pair(uris.lv2_maximum, float(_max_spinner->get_value())));
+ props.insert(
+ make_pair(uris.lv2_minimum,
+ _app->forge().make(float(_min_spinner->get_value()))));
+ props.insert(
+ make_pair(uris.lv2_maximum,
+ _app->forge().make(float(_max_spinner->get_value()))));
_app->engine()->put(_port_model->path(), props);
hide();
}
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 6e4841d0..1543398b 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -247,23 +247,23 @@ PropertiesWindow::value_edited(const Raul::URI& predicate)
if (type == Atom::INT) {
Gtk::SpinButton* widget = dynamic_cast<Gtk::SpinButton*>(record.value_widget->get_child());
if (!widget) goto bad_type;
- record.value = Atom(widget->get_value_as_int());
+ record.value = _app->forge().make(widget->get_value_as_int());
} else if (type == Atom::FLOAT) {
Gtk::SpinButton* widget = dynamic_cast<Gtk::SpinButton*>(record.value_widget->get_child());
if (!widget) goto bad_type;
- record.value = Atom(static_cast<float>(widget->get_value()));
+ record.value = _app->forge().make(static_cast<float>(widget->get_value()));
} else if (type == Atom::BOOL) {
Gtk::CheckButton* widget = dynamic_cast<Gtk::CheckButton*>(record.value_widget->get_child());
if (!widget) goto bad_type;
- record.value = Atom(widget->get_active());
+ record.value = _app->forge().make(widget->get_active());
} else if (type == Atom::URI) {
Gtk::Entry* widget = dynamic_cast<Gtk::Entry*>(record.value_widget->get_child());
if (!widget) goto bad_type;
- record.value = Atom(Atom::URI, widget->get_text());
+ record.value = _app->forge().alloc(Atom::URI, widget->get_text());
} else if (type == Atom::STRING) {
Gtk::Entry* widget = dynamic_cast<Gtk::Entry*>(record.value_widget->get_child());
if (!widget) goto bad_type;
- record.value = Atom(Atom::URI, widget->get_text());
+ record.value = _app->forge().alloc(Atom::URI, widget->get_text());
}
return;
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index 7e5d8ed2..6b3a5f20 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -131,7 +131,9 @@ RenameWindow::ok_clicked()
}
if (!label.empty() && (!name_atom.is_valid() || label != name_atom.get_string())) {
- _app->engine()->set_property(path, uris.lv2_name, Atom(label));
+ _app->engine()->set_property(path,
+ uris.lv2_name,
+ _app->forge().alloc(label));
}
hide();
diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp
index 21ad0dd8..e71dcbc8 100644
--- a/src/gui/SubpatchModule.cpp
+++ b/src/gui/SubpatchModule.cpp
@@ -63,8 +63,8 @@ SubpatchModule::on_double_click(GdkEventButton* event)
void
SubpatchModule::store_location(double ax, double ay)
{
- const Atom x(static_cast<float>(ax));
- const Atom y(static_cast<float>(ay));
+ const Atom x(app().forge().make(static_cast<float>(ax)));
+ const Atom y(app().forge().make(static_cast<float>(ay)));
const URIs& uris = app().uris();
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 433a77bc..57e7b658 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -84,7 +84,8 @@ ingen_try(bool cond, const char* msg)
int
main(int argc, char** argv)
{
- Shared::Configuration conf;
+ Raul::Forge forge;
+ Shared::Configuration conf(&forge);
// Parse command line options
try {
diff --git a/src/osc/OSCEngineReceiver.cpp b/src/osc/OSCEngineReceiver.cpp
index 0f9ab151..ad505b76 100644
--- a/src/osc/OSCEngineReceiver.cpp
+++ b/src/osc/OSCEngineReceiver.cpp
@@ -323,8 +323,9 @@ OSCEngineReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, i
const char* ctx = &argv[2]->s;
Resource::Properties prop;
for (int i = 3; i < argc-1; i += 2)
- prop.insert(make_pair(&argv[i]->s,
- AtomLiblo::lo_arg_to_atom(types[i+1], argv[i+1])));
+ prop.insert(
+ make_pair(&argv[i]->s,
+ AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[i+1], argv[i+1])));
_interface->put(obj_path, prop, Resource::uri_to_graph(ctx));
return 0;
}
@@ -342,16 +343,18 @@ OSCEngineReceiver::_delta_begin_cb(const char* path, const char* types, lo_arg**
int
OSCEngineReceiver::_delta_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- _delta_remove.insert(make_pair(&argv[1]->s,
- AtomLiblo::lo_arg_to_atom(types[2], argv[2])));
+ _delta_remove.insert(
+ make_pair(&argv[1]->s,
+ AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[2], argv[2])));
return 0;
}
int
OSCEngineReceiver::_delta_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- _delta_add.insert(make_pair(&argv[1]->s,
- AtomLiblo::lo_arg_to_atom(types[2], argv[2])));
+ _delta_add.insert(
+ make_pair(&argv[1]->s,
+ AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[2], argv[2])));
return 0;
}
@@ -541,7 +544,7 @@ OSCEngineReceiver::_set_property_cb(const char* path, const char* types, lo_arg*
const char* object_path = &argv[1]->s;
const char* key = &argv[2]->s;
- Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(types[3], argv[3]);
+ Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[3], argv[3]);
_interface->set_property(object_path, key, value);
return 0;
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index dfd5bdf6..1477e167 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -102,7 +102,8 @@ skip_property(const Sord::Node& predicate)
}
static Resource::Properties
-get_properties(Sord::Model& model,
+get_properties(Raul::Forge& forge,
+ Sord::Model& model,
const Sord::Node& subject)
{
Resource::Properties props;
@@ -110,7 +111,7 @@ get_properties(Sord::Model& model,
if (!skip_property(i.get_predicate())) {
props.insert(
make_pair(i.get_predicate().to_string(),
- AtomRDF::node_to_atom(model, i.get_object())));
+ AtomRDF::node_to_atom(forge, model, i.get_object())));
}
}
return props;
@@ -128,7 +129,7 @@ get_port(Ingen::Shared::World* world,
const URIs& uris = *world->uris().get();
// Get all properties
- Resource::Properties props = get_properties(model, subject);
+ Resource::Properties props = get_properties(world->forge(), model, subject);
// Get index
Resource::Properties::const_iterator i = props.find(uris.lv2_index);
@@ -252,7 +253,7 @@ parse_node(Ingen::Shared::World* world,
parse_patch(world, target, model, subject,
path.parent(), Raul::Symbol(path.symbol()));
} else {
- Resource::Properties props = get_properties(model, subject);
+ Resource::Properties props = get_properties(world->forge(), model, subject);
props.insert(make_pair(uris.rdf_type,
Raul::URI(uris.ingen_Node)));
target->put(path, props);
@@ -273,6 +274,7 @@ parse_patch(Ingen::Shared::World* world,
const Sord::URI ingen_polyphony(*world->rdf_world(), NS_INGEN "polyphony");
const Sord::URI lv2_port(*world->rdf_world(), NS_LV2 "port");
+ Raul::Forge& forge = world->forge();
const URIs& uris = *world->uris().get();
const Sord::Node& patch = subject_node;
@@ -321,7 +323,7 @@ parse_patch(Ingen::Shared::World* world,
// Create patch
Path patch_path(patch_path_str);
- Resource::Properties props = get_properties(model, subject_node);
+ Resource::Properties props = get_properties(forge, model, subject_node);
target->put(patch_path, props);
// For each node in this patch
@@ -440,8 +442,9 @@ parse_properties(Ingen::Shared::World* world,
const Sord::Node& key = i.get_predicate();
const Sord::Node& val = i.get_object();
if (!skip_property(key)) {
- properties.insert(make_pair(key.to_string(),
- AtomRDF::node_to_atom(model, val)));
+ properties.insert(
+ make_pair(key.to_string(),
+ AtomRDF::node_to_atom(world->forge(), model, val)));
}
}
@@ -531,6 +534,7 @@ parse(Ingen::Shared::World* world,
}
Parser::Parser(Ingen::Shared::World& world)
+ : _world(world)
{
}
@@ -614,7 +618,7 @@ Parser::parse_file(Ingen::Shared::World* world,
if (parsed_path) {
target->set_property(*parsed_path, "http://drobilla.net/ns/ingen#document",
- Atom(Atom::URI, uri.c_str()));
+ world->forge().alloc(Atom::URI, uri.c_str()));
} else {
LOG(warn) << "Document URI lost" << endl;
}
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 1e608806..7f9b8cc3 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -453,7 +453,8 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch,
// Ensure lv2:name always exists so Patch is a valid LV2 plugin
if (p->properties().find(NS_LV2 "name") == p->properties().end())
- p->set_property(NS_LV2 "name", Atom(p->symbol().c_str()));
+ p->set_property(NS_LV2 "name",
+ _world.forge().make(p->symbol().c_str()));
_model->add_statement(patch_id,
Sord::URI(world, NS_LV2 "port"),
@@ -521,7 +522,7 @@ Serialiser::Impl::serialise_port(const Port* port,
_model->add_statement(
port_id,
Sord::Curie(world, "lv2:index"),
- AtomRDF::atom_to_node(*_model, Atom((int)port->index())));
+ AtomRDF::atom_to_node(*_model, _world.forge().make((int)port->index())));
}
}
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);
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp
index fff40f3f..3672e388 100644
--- a/src/shared/Builder.cpp
+++ b/src/shared/Builder.cpp
@@ -47,8 +47,9 @@ Builder::build(SharedPtr<const GraphObject> object)
if (patch) {
if (!object->path().is_root()) {
Resource::Properties props;
- props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
- props.insert(make_pair(uris.ingen_polyphony, Atom(int32_t(patch->internal_poly()))));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
+ props.insert(make_pair(uris.ingen_polyphony,
+ _uris->forge.make(int32_t(patch->internal_poly()))));
_interface.put(object->path(), props);
}
diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp
index d2d1e9dc..300c7f1d 100644
--- a/src/shared/Configuration.cpp
+++ b/src/shared/Configuration.cpp
@@ -15,8 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "raul/Atom.hpp"
-
#include "ingen/shared/Configuration.hpp"
using namespace Raul;
@@ -24,8 +22,9 @@ using namespace Raul;
namespace Ingen {
namespace Shared {
-Configuration::Configuration()
- : Raul::Configuration("A realtime modular audio processor.",
+Configuration::Configuration(Raul::Forge* forge)
+ : Raul::Configuration(forge,
+ "A realtime modular audio processor.",
"Ingen is a flexible modular system that be used in various ways.\n"
"The engine can run as a stand-alone server controlled via a network protocol\n"
"(e.g. OSC), or internal to another process (e.g. the GUI). The GUI, or other\n"
@@ -38,21 +37,21 @@ Configuration::Configuration()
" ingen -eg patch.ttl # Run an engine and a GUI and load a patch file\n"
" ingen -eg patch.ingen # Run an engine and a GUI and load a patch bundle")
{
- add("client-port", 'C', "Client OSC port", Atom::INT, Atom())
- .add("connect", 'c', "Connect to engine URI", Atom::STRING, "osc.udp://localhost:16180")
- .add("engine", 'e', "Run (JACK) engine", Atom::BOOL, false)
- .add("engine-port", 'E', "Engine listen port", Atom::INT, 16180)
- .add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, false)
- .add("help", 'h', "Print this help message", Atom::BOOL, false)
- .add("jack-client", 'n', "JACK client name", Atom::STRING, "ingen")
- .add("jack-server", 's', "JACK server name", Atom::STRING, "")
- .add("uuid", 'u', "JACK session UUID", Atom::STRING, "")
- .add("load", 'l', "Load patch", Atom::STRING, Atom())
- .add("packet-size", 'k', "Maximum UDP packet size", Atom::INT, 4096)
- .add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, 1)
- .add("path", 'L', "Target path for loaded patch", Atom::STRING, Atom())
- .add("queue-size", 'q', "Event queue size", Atom::INT, 4096)
- .add("run", 'r', "Run script", Atom::STRING, Atom());
+ add("client-port", 'C', "Client OSC port", Atom::INT, forge->make());
+ add("connect", 'c', "Connect to engine URI", Atom::STRING, forge->make("osc.udp://localhost:16180"));
+ add("engine", 'e', "Run (JACK) engine", Atom::BOOL, forge->make(false));
+ add("engine-port", 'E', "Engine listen port", Atom::INT, forge->make(16180));
+ add("gui", 'g', "Launch the GTK graphical interface", Atom::BOOL, forge->make(false));
+ add("help", 'h', "Print this help message", Atom::BOOL, forge->make(false));
+ add("jack-client", 'n', "JACK client name", Atom::STRING, forge->make("ingen"));
+ add("jack-server", 's', "JACK server name", Atom::STRING, forge->make(""));
+ add("uuid", 'u', "JACK session UUID", Atom::STRING, forge->make(""));
+ add("load", 'l', "Load patch", Atom::STRING, forge->make());
+ add("packet-size", 'k', "Maximum UDP packet size", Atom::INT, forge->make(4096));
+ add("parallelism", 'p', "Number of concurrent process threads", Atom::INT, forge->make(1));
+ add("path", 'L', "Target path for loaded patch", Atom::STRING, forge->make());
+ add("queue-size", 'q', "Event queue size", Atom::INT, forge->make(4096));
+ add("run", 'r', "Run script", Atom::STRING, forge->make());
}
} // namespace Shared
diff --git a/src/shared/LV2Atom.cpp b/src/shared/LV2Atom.cpp
index 931ed9ab..991c4f7c 100644
--- a/src/shared/LV2Atom.cpp
+++ b/src/shared/LV2Atom.cpp
@@ -31,19 +31,22 @@ namespace Shared {
namespace LV2Atom {
bool
-to_atom(const Shared::URIs& uris, const LV2_Atom* object, Raul::Atom& atom)
+to_atom(Raul::Forge* forge,
+ const Shared::URIs& uris,
+ const LV2_Atom* object,
+ Raul::Atom& atom)
{
if (object->type == uris.atom_String.id) {
- atom = Raul::Atom((char*)(object + 1));
+ atom = forge->make((char*)(object + 1));
return true;
} else if (object->type == uris.atom_Bool.id) {
- atom = Raul::Atom((bool)(int32_t*)(object + 1));
+ atom = forge->make((bool)(int32_t*)(object + 1));
return true;
} else if (object->type == uris.atom_Int32.id) {
- atom = Raul::Atom((int32_t*)(object + 1));
+ atom = forge->make((int32_t*)(object + 1));
return true;
} else if (object->type == uris.atom_Float.id) {
- atom = Raul::Atom((float*)(object + 1));
+ atom = forge->make((float*)(object + 1));
return true;
}
return false;
diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp
index 8c40705f..bb2142e1 100644
--- a/src/shared/URIs.cpp
+++ b/src/shared/URIs.cpp
@@ -53,8 +53,9 @@ URIs::Quark::c_str() const
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#"
-URIs::URIs()
- : atom_Bool (LV2_ATOM__Bool)
+URIs::URIs(Raul::Forge& f)
+ : forge(f)
+ , atom_Bool (LV2_ATOM__Bool)
, atom_Float (LV2_ATOM__Float)
, atom_Int32 (LV2_ATOM__Int32)
, atom_MessagePort (LV2_ATOM__MessagePort)
diff --git a/src/shared/World.cpp b/src/shared/World.cpp
index 59207939..cf21cd44 100644
--- a/src/shared/World.cpp
+++ b/src/shared/World.cpp
@@ -23,6 +23,7 @@
#include "lilv/lilv.h"
#include "raul/log.hpp"
+#include "raul/Atom.hpp"
#include "sord/sordmm.hpp"
#include "ingen/EngineBase.hpp"
@@ -102,8 +103,9 @@ public:
, argv(a_argv)
, conf(conf)
, lv2_features(NULL)
+ , forge(new Raul::Forge())
, rdf_world(new Sord::World())
- , uris(new Shared::URIs())
+ , uris(new Shared::URIs(*forge))
, lv2_uri_map(new Ingen::Shared::LV2URIMap(*uris.get()))
, lilv_world(lilv_world_new())
{
@@ -144,6 +146,8 @@ public:
delete lv2_features;
lv2_features = NULL;
+ delete forge;
+
uris.reset();
}
@@ -161,6 +165,7 @@ public:
char**& argv;
Raul::Configuration* conf;
LV2Features* lv2_features;
+ Raul::Forge* forge;
Sord::World* rdf_world;
SharedPtr<URIs> uris;
SharedPtr<LV2URIMap> lv2_uri_map;
@@ -199,6 +204,7 @@ SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->seria
SharedPtr<Serialisation::Parser> World::parser() { return _impl->parser; }
SharedPtr<Store> World::store() { return _impl->store; }
Raul::Configuration* World::conf() { return _impl->conf; }
+Raul::Forge& World::forge() { return *_impl->forge; }
LV2Features* World::lv2_features() { return _impl->lv2_features; }
LilvWorld* World::lilv_world() { return _impl->lilv_world; }