aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
committerDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
commitcfce5f86e3ce1572299bd62e7047e0cb985a4358 (patch)
treecb0768b308a20af399acecd7e6c12965fe1279ad
parentf11d9299afca21e52e0093784bed0b5ef8a506d0 (diff)
downloadmachina-cfce5f86e3ce1572299bd62e7047e0cb985a4358.tar.gz
machina-cfce5f86e3ce1572299bd62e7047e0cb985a4358.tar.bz2
machina-cfce5f86e3ce1572299bd62e7047e0cb985a4358.zip
Converted Raul (and thus Ingen and Machina) to use Redland over Raptor/Rasqal independently.
Fixed patch loading for Ingen (local only, still something wrong with remote...). git-svn-id: http://svn.drobilla.net/lad/machina@486 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/Action.cpp15
-rw-r--r--src/engine/Edge.cpp27
-rw-r--r--src/engine/Engine.cpp4
-rw-r--r--src/engine/Loader.cpp64
-rw-r--r--src/engine/Machine.cpp32
-rw-r--r--src/engine/MidiAction.cpp16
-rw-r--r--src/engine/Node.cpp37
-rw-r--r--src/engine/machina/Action.hpp2
-rw-r--r--src/engine/machina/Edge.hpp2
-rw-r--r--src/engine/machina/Engine.hpp11
-rw-r--r--src/engine/machina/Loader.hpp10
-rw-r--r--src/engine/machina/Machine.hpp4
-rw-r--r--src/engine/machina/MidiAction.hpp2
-rw-r--r--src/engine/machina/Node.hpp2
-rw-r--r--src/gui/MachinaGUI.cpp16
-rw-r--r--src/gui/main.cpp7
-rw-r--r--src/machina.cpp3
-rw-r--r--src/midi2machina.cpp11
18 files changed, 136 insertions, 129 deletions
diff --git a/src/engine/Action.cpp b/src/engine/Action.cpp
index a8a7db1..a9de1ee 100644
--- a/src/engine/Action.cpp
+++ b/src/engine/Action.cpp
@@ -15,22 +15,23 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <raul/RDFWriter.h>
+#include <raul/RDFWorld.h>
+#include <raul/RDFModel.h>
#include "machina/Action.hpp"
namespace Machina {
void
-Action::write_state(Raul::RDFWriter& writer)
+Action::write_state(Raul::RDF::Model& model)
{
- using Raul::RdfId;
+ using namespace Raul;
if (!_id)
- set_id(writer.blank_id());
+ set_id(model.world().blank_id());
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:Action"));
+ model.add_statement(_id,
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Action"));
}
diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp
index 3ad1bfc..710629c 100644
--- a/src/engine/Edge.cpp
+++ b/src/engine/Edge.cpp
@@ -15,7 +15,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <raul/RDFWriter.h>
+#include <raul/RDFWorld.h>
+#include <raul/RDFModel.h>
#include "machina/Node.hpp"
#include "machina/Edge.hpp"
@@ -23,16 +24,16 @@ namespace Machina {
void
-Edge::write_state(Raul::RDFWriter& writer)
+Edge::write_state(Raul::RDF::Model& model)
{
- using Raul::RdfId;
+ using namespace Raul;
if (!_id)
- set_id(writer.blank_id());
+ set_id(model.world().blank_id());
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:Edge"));
+ model.add_statement(_id,
+ "rdf:type",
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Edge"));
SharedPtr<Node> tail = _tail.lock();
SharedPtr<Node> head = _head;
@@ -42,16 +43,16 @@ Edge::write_state(Raul::RDFWriter& writer)
assert(tail->id() && head->id());
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:tail"),
+ model.add_statement(_id,
+ "machina:tail",
tail->id());
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:head"),
+ model.add_statement(_id,
+ "machina:head",
head->id());
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:probability"),
+ model.add_statement(_id,
+ "machina:probability",
_probability.get());
}
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 9135d43..1417e6e 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -32,7 +32,7 @@ Engine::load_machine(const Glib::ustring& uri)
{
SharedPtr<Machine> old_machine = _driver->machine(); // Hold a reference to current machine..
- SharedPtr<Machine> m = Loader().load(uri);
+ SharedPtr<Machine> m = _loader.load(uri);
if (m) {
m->activate();
_driver->set_machine(m);
@@ -50,7 +50,7 @@ Engine::load_machine(const Glib::ustring& uri)
SharedPtr<Machine>
Engine::import_machine(const Glib::ustring& uri)
{
- SharedPtr<Machine> m = Loader().load(uri);
+ SharedPtr<Machine> m = _loader.load(uri);
if (m) {
m->activate();
_driver->machine()->nodes().append(m->nodes());
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp
index 7085ec1..34f29d2 100644
--- a/src/engine/Loader.cpp
+++ b/src/engine/Loader.cpp
@@ -18,8 +18,6 @@
#include <iostream>
#include <map>
#include <cmath>
-#include <raptor.h>
-#include <rasqal.h>
#include <glibmm/ustring.h>
#include <raul/RDFQuery.h>
#include "machina/Loader.hpp"
@@ -34,14 +32,11 @@ using std::cerr; using std::cout; using std::endl;
namespace Machina {
-Loader::Loader(SharedPtr<Namespaces> namespaces)
- : _namespaces(namespaces)
+Loader::Loader(Raul::RDF::World& rdf_world)
+ : _rdf_world(rdf_world)
{
- if (!_namespaces)
- _namespaces = SharedPtr<Namespaces>(new Namespaces());
-
- (*_namespaces)[""] = "http://drobilla.net/ns/machina#";
- (*_namespaces)["xsd"] = "http://www.w3.org/2001/XMLSchema#";
+ _rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
+ _rdf_world.add_prefix("", "http://drobilla.net/ns/machina#");
}
@@ -53,11 +48,9 @@ Loader::Loader(SharedPtr<Namespaces> namespaces)
SharedPtr<Machine>
Loader::load(const Glib::ustring& uri)
{
- using Raul::RDFQuery;
+ using Raul::RDF::Query;
SharedPtr<Machine> machine;
- rasqal_init();
-
Glib::ustring document_uri = uri;
// If "URI" doesn't contain a colon, try to resolve as a filename
@@ -84,23 +77,24 @@ Loader::load(const Glib::ustring& uri)
typedef std::map<string, SharedPtr<Node> > Created;
Created created;
+ Raul::RDF::Model model(_rdf_world, document_uri);
/* Get initial nodes */
- Raul::RDFQuery query = Raul::RDFQuery(*_namespaces, Glib::ustring(
+ Query query = Query(_rdf_world, Glib::ustring(
"SELECT DISTINCT ?initialNode ?duration FROM <")
+ document_uri + "> WHERE {\n" +
machine_uri + " :initialNode ?initialNode .\n"
"?initialNode :duration ?duration .\n"
"}\n");
- RDFQuery::Results results = query.run(document_uri);
+ Query::Results results = query.run(_rdf_world, model);
- for (RDFQuery::Results::iterator i = results.begin(); i != results.end(); ++i) {
- const Glib::ustring& node_id = (*i)["initialNode"];
- const Glib::ustring& duration = (*i)["duration"];
+ for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ Glib::ustring node_id = (*i)["initialNode"].to_string();
+ float duration = (*i)["duration"].to_float();
- SharedPtr<Node> node(new Node(strtod(duration.c_str(), NULL), true));
+ SharedPtr<Node> node(new Node(duration, true));
machine->add_node(node);
created.insert(std::make_pair(node_id.collate_key(), node));
}
@@ -108,21 +102,21 @@ Loader::load(const Glib::ustring& uri)
/* Get remaining (non-initial) nodes */
- query = Raul::RDFQuery(*_namespaces, Glib::ustring(
+ query = Query(_rdf_world, Glib::ustring(
"SELECT DISTINCT ?node ?duration FROM <")
+ document_uri + "> WHERE {\n" +
machine_uri + " :node ?node .\n"
"?node :duration ?duration .\n"
"}\n");
- results = query.run(document_uri);
+ results = query.run(_rdf_world, model);
- for (RDFQuery::Results::iterator i = results.begin(); i != results.end(); ++i) {
- const Glib::ustring& node_id = (*i)["node"];
- const Glib::ustring& duration = (*i)["duration"];
+ for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ Glib::ustring node_id = (*i)["initialNode"].to_string();
+ float duration = (*i)["duration"].to_float();
if (created.find(node_id.collate_key()) == created.end()) {
- SharedPtr<Node> node(new Node(strtod(duration.c_str(), NULL), false));
+ SharedPtr<Node> node(new Node(duration, false));
machine->add_node(node);
created.insert(std::make_pair(node_id.collate_key(), node));
} else {
@@ -133,18 +127,18 @@ Loader::load(const Glib::ustring& uri)
/* Get note actions */
- query = Raul::RDFQuery(*_namespaces, Glib::ustring(
+ query = Query(_rdf_world, Glib::ustring(
"SELECT DISTINCT ?node ?note FROM <")
+ document_uri + "> WHERE {\n" +
"?node :enterAction [ a :MidiAction; :midiNote ?note ] ;\n"
" :exitAction [ a :MidiAction; :midiNote ?note ] .\n"
"}\n");
- results = query.run(document_uri);
+ results = query.run(_rdf_world, model);
- for (RDFQuery::Results::iterator i = results.begin(); i != results.end(); ++i) {
- const Glib::ustring& node_id = (*i)["node"];
- const Glib::ustring& note = (*i)["note"];
+ for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ Glib::ustring node_id = (*i)["initialNode"].to_string();
+ Glib::ustring note = (*i)["note"].to_string();
Created::iterator node_i = created.find(node_id);
if (node_i != created.end()) {
@@ -164,7 +158,7 @@ Loader::load(const Glib::ustring& uri)
/* Get edges */
- query = Raul::RDFQuery(*_namespaces, Glib::ustring(
+ query = Query(_rdf_world, Glib::ustring(
"SELECT DISTINCT ?edge ?src ?dst ?prob FROM <")
+ document_uri + "> WHERE {\n" +
machine_uri + " :edge ?edge .\n"
@@ -172,12 +166,12 @@ Loader::load(const Glib::ustring& uri)
" :head ?dst ;\n"
" :probability ?prob .\n }");
- results = query.run(document_uri);
+ results = query.run(_rdf_world, model);
- for (RDFQuery::Results::iterator i = results.begin(); i != results.end(); ++i) {
- const Glib::ustring& src_uri = (*i)["src"];
- const Glib::ustring& dst_uri = (*i)["dst"];
- double prob = strtod((*i)["prob"].c_str(), NULL);
+ for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ Glib::ustring src_uri = (*i)["src"].to_string();
+ Glib::ustring dst_uri = (*i)["dst"].to_string();
+ float prob = (*i)["prob"].to_float();
Created::iterator src_i = created.find(src_uri.collate_key());
Created::iterator dst_i = created.find(dst_uri.collate_key());
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index d4a3425..815ba5b 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -16,7 +16,9 @@
*/
#include <cstdlib>
-#include "raul/SharedPtr.h"
+#include <raul/RDFWorld.h>
+#include <raul/RDFModel.h>
+#include <raul/SharedPtr.h>
#include "machina/Machine.hpp"
#include "machina/Node.hpp"
#include "machina/Edge.hpp"
@@ -292,29 +294,29 @@ Machine::learn(SharedPtr<LearnRequest> learn)
void
-Machine::write_state(Raul::RDFWriter& writer)
+Machine::write_state(Raul::RDF::Model& model)
{
- using Raul::RdfId;
+ using namespace Raul;
- writer.add_prefix("machina", "http://drobilla.net/ns/machina#");
+ model.world().add_prefix("machina", "http://drobilla.net/ns/machina#");
- writer.write(RdfId(RdfId::RESOURCE, ""),
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:Machine"));
+ model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Machine"));
size_t count = 0;
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
- (*n)->write_state(writer);
+ (*n)->write_state(model);
if ((*n)->is_initial()) {
- writer.write(RdfId(RdfId::RESOURCE, ""),
- RdfId(RdfId::RESOURCE, "machina:initialNode"),
+ model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:initialNode"),
(*n)->id());
} else {
- writer.write(RdfId(RdfId::RESOURCE, ""),
- RdfId(RdfId::RESOURCE, "machina:node"),
+ model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:node"),
(*n)->id());
}
}
@@ -326,10 +328,10 @@ Machine::write_state(Raul::RDFWriter& writer)
for (Node::Edges::const_iterator e = (*n)->outgoing_edges().begin();
e != (*n)->outgoing_edges().end(); ++e) {
- (*e)->write_state(writer);
+ (*e)->write_state(model);
- writer.write(RdfId(RdfId::RESOURCE, ""),
- RdfId(RdfId::RESOURCE, "machina:edge"),
+ model.add_statement(RDF::Node(model.world(), RDF::Node::RESOURCE, ""),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:edge"),
(*e)->id());
}
diff --git a/src/engine/MidiAction.cpp b/src/engine/MidiAction.cpp
index 969e53a..38a5d6f 100644
--- a/src/engine/MidiAction.cpp
+++ b/src/engine/MidiAction.cpp
@@ -91,19 +91,19 @@ MidiAction::execute(SharedPtr<Raul::MIDISink> sink, Raul::BeatTime time)
void
-MidiAction::write_state(Raul::RDFWriter& writer)
+MidiAction::write_state(Raul::RDF::Model& model)
{
- using Raul::RdfId;
+ using namespace Raul;
- Action::write_state(writer);
+ Action::write_state(model);
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:MidiAction"));
+ model.add_statement(_id,
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "rdf:type"),
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:MidiAction"));
// FIXME: Assumes note on/note off
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:midiNote"),
+ model.add_statement(_id,
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:midiNote"),
(int)(_event.get()[1]));
}
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index dfbfb4b..73a2059 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -16,7 +16,8 @@
*/
#include <cassert>
-#include <raul/RDFWriter.h>
+#include <raul/RDFWorld.h>
+#include <raul/RDFModel.h>
#include <machina/Node.hpp>
#include <machina/Edge.hpp>
@@ -134,39 +135,39 @@ Node::remove_outgoing_edges_to(SharedPtr<Node> node)
void
-Node::write_state(Raul::RDFWriter& writer)
+Node::write_state(Raul::RDF::Model& model)
{
- using Raul::RdfId;
+ using namespace Raul;
if (!_id)
- set_id(writer.blank_id());
+ set_id(model.world().blank_id());
if (_is_selector)
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:SelectorNode"));
+ model.add_statement(_id,
+ "rdf:type",
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:SelectorNode"));
else
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "rdf:type"),
- RdfId(RdfId::RESOURCE, "machina:Node"));
+ model.add_statement(_id,
+ "rdf:type",
+ RDF::Node(model.world(), RDF::Node::RESOURCE, "machina:Node"));
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:duration"),
+ model.add_statement(_id,
+ "machina:duration",
Raul::Atom((float)_duration));
if (_enter_action) {
- _enter_action->write_state(writer);
+ _enter_action->write_state(model);
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:enterAction"),
+ model.add_statement(_id,
+ "machina:enterAction",
_enter_action->id());
}
if (_exit_action) {
- _exit_action->write_state(writer);
+ _exit_action->write_state(model);
- writer.write(_id,
- RdfId(RdfId::RESOURCE, "machina:exitAction"),
+ model.add_statement(_id,
+ "machina:exitAction",
_exit_action->id());
}
}
diff --git a/src/engine/machina/Action.hpp b/src/engine/machina/Action.hpp
index 888f639..d3c47cb 100644
--- a/src/engine/machina/Action.hpp
+++ b/src/engine/machina/Action.hpp
@@ -34,7 +34,7 @@ namespace Machina {
struct Action : public Raul::Deletable, public Raul::Stateful {
virtual void execute(SharedPtr<Raul::MIDISink> sink, Raul::BeatTime time) = 0;
- virtual void write_state(Raul::RDFWriter& writer);
+ virtual void write_state(Raul::RDF::Model& model);
};
diff --git a/src/engine/machina/Edge.hpp b/src/engine/machina/Edge.hpp
index 51314c4..4681b38 100644
--- a/src/engine/machina/Edge.hpp
+++ b/src/engine/machina/Edge.hpp
@@ -40,7 +40,7 @@ public:
, _head(head)
{}
- void write_state(Raul::RDFWriter& writer);
+ void write_state(Raul::RDF::Model& model);
WeakPtr<Node> tail() { return _tail; }
SharedPtr<Node> head() { return _head; }
diff --git a/src/engine/machina/Engine.hpp b/src/engine/machina/Engine.hpp
index 4263ef3..2cae36d 100644
--- a/src/engine/machina/Engine.hpp
+++ b/src/engine/machina/Engine.hpp
@@ -21,7 +21,8 @@
#include <glibmm/ustring.h>
#include <raul/SharedPtr.h>
#include <raul/types.h>
-#include "machina/Driver.hpp"
+#include "machina/Driver.hpp"
+#include "machina/Loader.hpp"
namespace Machina {
@@ -30,10 +31,14 @@ class Machine;
class Engine {
public:
- Engine(SharedPtr<Driver> driver)
+ Engine(SharedPtr<Driver> driver, Raul::RDF::World& rdf_world)
: _driver(driver)
+ , _rdf_world(rdf_world)
+ , _loader(_rdf_world)
{ }
+ Raul::RDF::World& rdf_world() { return _rdf_world; }
+
SharedPtr<Driver> driver() { return _driver; }
SharedPtr<Machine> machine() { return _driver->machine(); }
@@ -46,6 +51,8 @@ public:
private:
SharedPtr<Driver> _driver;
+ Raul::RDF::World& _rdf_world;
+ Loader _loader;
};
diff --git a/src/engine/machina/Loader.hpp b/src/engine/machina/Loader.hpp
index af35c56..eb7deac 100644
--- a/src/engine/machina/Loader.hpp
+++ b/src/engine/machina/Loader.hpp
@@ -19,9 +19,9 @@
#define MACHINA_LOADER_HPP
#include <glibmm/ustring.h>
-#include "raul/SharedPtr.h"
-#include "raul/Path.h"
-#include "raul/Namespaces.h"
+#include <raul/SharedPtr.h>
+#include <raul/Path.h>
+#include <raul/RDFWorld.h>
using Raul::Namespaces;
@@ -32,12 +32,12 @@ class Machine;
class Loader {
public:
- Loader(SharedPtr<Namespaces> = SharedPtr<Namespaces>());
+ Loader(Raul::RDF::World& rdf_world);
SharedPtr<Machine> load(const Glib::ustring& filename);
private:
- SharedPtr<Namespaces> _namespaces;
+ Raul::RDF::World& _rdf_world;
};
diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp
index c2f081d..ff32930 100644
--- a/src/engine/machina/Machine.hpp
+++ b/src/engine/machina/Machine.hpp
@@ -21,7 +21,7 @@
#include <boost/utility.hpp>
#include <raul/SharedPtr.h>
#include <raul/List.h>
-#include <raul/RDFWriter.h>
+#include <raul/RDFModel.h>
#include <raul/TimeSlice.h>
#include "types.hpp"
#include "LearnRequest.hpp"
@@ -47,7 +47,7 @@ public:
void remove_node(SharedPtr<Node> node);
void learn(SharedPtr<LearnRequest> learn);
- void write_state(Raul::RDFWriter& writer);
+ void write_state(Raul::RDF::Model& model);
// Audio context
void reset();
diff --git a/src/engine/machina/MidiAction.hpp b/src/engine/machina/MidiAction.hpp
index 510c0d0..c019ca9 100644
--- a/src/engine/machina/MidiAction.hpp
+++ b/src/engine/machina/MidiAction.hpp
@@ -53,7 +53,7 @@ public:
void execute(SharedPtr<Raul::MIDISink> driver, Raul::BeatTime time);
- virtual void write_state(Raul::RDFWriter& writer);
+ virtual void write_state(Raul::RDF::Model& model);
private:
diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp
index 23fb4ec..6c275a8 100644
--- a/src/engine/machina/Node.hpp
+++ b/src/engine/machina/Node.hpp
@@ -62,7 +62,7 @@ public:
void remove_outgoing_edge(SharedPtr<Edge> edge);
void remove_outgoing_edges_to(SharedPtr<Node> node);
- void write_state(Raul::RDFWriter& writer);
+ void write_state(Raul::RDF::Model& model);
bool is_initial() const { return _is_initial; }
void set_initial(bool i) { _is_initial = i; }
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index b55c445..6e6c7b9 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -22,7 +22,7 @@
#include <pthread.h>
#include <libgnomecanvasmm.h>
#include <libglademm/xml.h>
-#include <raul/RDFWriter.h>
+#include <raul/RDFModel.h>
#include <machina/Machine.hpp>
#include <machina/SMFDriver.hpp>
#include "GladeXml.hpp"
@@ -273,11 +273,10 @@ MachinaGUI::menu_file_save()
cerr << "ERROR: Unable to create filename from \"" << _save_uri << "\"" << endl;
menu_file_save_as();
}
- Raul::RDFWriter writer;
+ Raul::RDF::Model model(_engine->rdf_world());
cout << "Writing machine to " << save_filename << endl;
- writer.start_to_filename(save_filename);
- machine()->write_state(writer);
- writer.finish();
+ machine()->write_state(model);
+ model.serialize_to_file(save_filename);
free(save_filename);
}
}
@@ -325,10 +324,9 @@ MachinaGUI::menu_file_save_as()
fin.close();
if (confirm) {
- Raul::RDFWriter writer;
- writer.start_to_filename(filename);
- _engine->machine()->write_state(writer);
- writer.finish();
+ Raul::RDF::Model model(_engine->rdf_world());
+ _engine->machine()->write_state(model);
+ model.serialize_to_file(filename);
_save_uri = dialog.get_uri();
}
}
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 25b2aa9..791aa2d 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -19,6 +19,7 @@
#include <iostream>
#include <string>
#include <libgnomecanvasmm.h>
+#include <raul/RDFWorld.h>
#include "../config.h"
#include "machina/Loader.hpp"
#include "machina/SMFDriver.hpp"
@@ -35,6 +36,8 @@ using namespace Machina;
int
main(int argc, char** argv)
{
+ Raul::RDF::World rdf_world;
+
SharedPtr<Machina::Machine> machine;
// Load machine, if given
@@ -54,7 +57,7 @@ main(int argc, char** argv)
if (!machine) {
cout << "Not a MIDI file. Attempting to load as Machina file." << endl;
- machine = Loader().load(filename);
+ machine = Loader(rdf_world).load(filename);
}
}
@@ -70,7 +73,7 @@ main(int argc, char** argv)
if (!driver)
driver = SharedPtr<Driver>(new SMFDriver(machine));
- SharedPtr<Engine> engine(new Engine(driver));
+ SharedPtr<Engine> engine(new Engine(driver, rdf_world));
Gnome::Canvas::init();
Gtk::Main app(argc, argv);
diff --git a/src/machina.cpp b/src/machina.cpp
index 9ea8304..edbd884 100644
--- a/src/machina.cpp
+++ b/src/machina.cpp
@@ -54,7 +54,8 @@ main(int argc, char** argv)
SharedPtr<JackDriver> driver(new JackDriver());
- Engine engine(driver);
+ Raul::RDF::World rdf_world;
+ Engine engine(driver, rdf_world);
/*// FIXME: Would be nice if this could take URIs on the cmd line
char* uri = (char*)calloc(6 + strlen(argv[1]), sizeof(char));
diff --git a/src/midi2machina.cpp b/src/midi2machina.cpp
index 23179bb..3493c06 100644
--- a/src/midi2machina.cpp
+++ b/src/midi2machina.cpp
@@ -17,7 +17,7 @@
#include <iostream>
#include <signal.h>
-#include <raul/RDFWriter.h>
+#include <raul/RDFModel.h>
#include "machina/Engine.hpp"
#include "machina/Machine.hpp"
#include "machina/Node.hpp"
@@ -76,11 +76,10 @@ main(int argc, char** argv)
cout << "Writing output to " << out_filename << endl;
*/
- Raul::RDFWriter writer;
- //writer.start_to_filename(out_filename);
- writer.start_to_file_handle(stdout);
- machine->write_state(writer);
- writer.finish();
+ Raul::RDF::World world;
+ Raul::RDF::Model model(world);
+ machine->write_state(model);
+ model.serialize_to_file_handle(stdout);
return 0;
}