aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-23 19:55:13 +0000
committerDavid Robillard <d@drobilla.net>2013-02-23 19:55:13 +0000
commitbb67af535ef57101f6b543c99e9489e984c8f1ec (patch)
treea18aebb32a20ccad6a51f57e5e037f43eb742639
parentb8e54f8f66abaf71927a023e1cfee905842078aa (diff)
downloadmachina-bb67af535ef57101f6b543c99e9489e984c8f1ec.tar.gz
machina-bb67af535ef57101f6b543c99e9489e984c8f1ec.tar.bz2
machina-bb67af535ef57101f6b543c99e9489e984c8f1ec.zip
Move Atom implementation out of Raul so it can depend on LV2.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5076 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/client/ClientModel.cpp2
-rw-r--r--src/client/ClientModel.hpp2
-rw-r--r--src/client/ClientObject.cpp6
-rw-r--r--src/client/ClientObject.hpp11
-rw-r--r--src/engine/Controller.cpp16
-rw-r--r--src/engine/Edge.cpp7
-rw-r--r--src/engine/Edge.hpp2
-rw-r--r--src/engine/Engine.cpp4
-rw-r--r--src/engine/JackDriver.cpp2
-rw-r--r--src/engine/JackDriver.hpp2
-rw-r--r--src/engine/Loader.cpp2
-rw-r--r--src/engine/Machine.cpp3
-rw-r--r--src/engine/MidiAction.cpp2
-rw-r--r--src/engine/Node.cpp5
-rw-r--r--src/engine/Node.hpp2
-rw-r--r--src/engine/Recorder.cpp10
-rw-r--r--src/engine/Recorder.hpp12
-rw-r--r--src/engine/SMFDriver.cpp2
-rw-r--r--src/engine/SMFDriver.hpp2
-rw-r--r--src/engine/Stateful.hpp3
-rw-r--r--src/engine/Updates.cpp11
-rw-r--r--src/engine/machina/Atom.hpp217
-rw-r--r--src/engine/machina/Context.hpp8
-rw-r--r--src/engine/machina/Controller.hpp2
-rw-r--r--src/engine/machina/Driver.hpp4
-rw-r--r--src/engine/machina/Engine.hpp13
-rw-r--r--src/engine/machina/Loader.hpp6
-rw-r--r--src/engine/machina/Machine.hpp2
-rw-r--r--src/engine/machina/URIs.hpp3
-rw-r--r--src/engine/machina/Updates.hpp7
-rw-r--r--src/gui/EdgeView.cpp4
-rw-r--r--src/gui/EdgeView.hpp2
-rw-r--r--src/gui/MachinaCanvas.cpp8
-rw-r--r--src/gui/MachinaGUI.hpp4
-rw-r--r--src/gui/NodeView.cpp12
-rw-r--r--src/gui/NodeView.hpp6
-rw-r--r--src/gui/main.cpp2
37 files changed, 309 insertions, 99 deletions
diff --git a/src/client/ClientModel.cpp b/src/client/ClientModel.cpp
index 5d6674e..17054d4 100644
--- a/src/client/ClientModel.cpp
+++ b/src/client/ClientModel.cpp
@@ -56,7 +56,7 @@ ClientModel::erase_object(uint64_t id)
}
void
-ClientModel::property(uint64_t id, URIInt key, const Raul::Atom& value)
+ClientModel::property(uint64_t id, URIInt key, const Atom& value)
{
SPtr<ClientObject> object = find(id);
if (object) {
diff --git a/src/client/ClientModel.hpp b/src/client/ClientModel.hpp
index a8a66aa..6840c11 100644
--- a/src/client/ClientModel.hpp
+++ b/src/client/ClientModel.hpp
@@ -35,7 +35,7 @@ class ClientModel
public:
void new_object(SPtr<ClientObject> object);
void erase_object(uint64_t id);
- void property(uint64_t id, URIInt key, const Raul::Atom& value);
+ void property(uint64_t id, URIInt key, const Atom& value);
SPtr<ClientObject> find(uint64_t id);
diff --git a/src/client/ClientObject.cpp b/src/client/ClientObject.cpp
index 475d8e3..9481d10 100644
--- a/src/client/ClientObject.cpp
+++ b/src/client/ClientObject.cpp
@@ -33,16 +33,16 @@ ClientObject::ClientObject(const ClientObject& copy, uint64_t id)
{}
void
-ClientObject::set(URIInt key, const Raul::Atom& value)
+ClientObject::set(URIInt key, const Atom& value)
{
_properties[key] = value;
signal_property.emit(key, value);
}
-const Raul::Atom&
+const Atom&
ClientObject::get(URIInt key) const
{
- static const Raul::Atom null_atom;
+ static const Atom null_atom;
Properties::const_iterator i = _properties.find(key);
if (i != _properties.end()) {
return i->second;
diff --git a/src/client/ClientObject.hpp b/src/client/ClientObject.hpp
index 4ad2e0e..cf00a2b 100644
--- a/src/client/ClientObject.hpp
+++ b/src/client/ClientObject.hpp
@@ -21,8 +21,7 @@
#include <sigc++/sigc++.h>
-#include "raul/Atom.hpp"
-
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
namespace machina {
@@ -36,10 +35,10 @@ public:
inline uint64_t id() const { return _id; }
- void set(URIInt key, const Raul::Atom& value);
- const Raul::Atom& get(URIInt key) const;
+ void set(URIInt key, const Atom& value);
+ const Atom& get(URIInt key) const;
- sigc::signal<void, URIInt, Raul::Atom> signal_property;
+ sigc::signal<void, URIInt, Atom> signal_property;
class View
{
@@ -47,7 +46,7 @@ public:
virtual ~View() {}
};
- typedef std::map<URIInt, Raul::Atom> Properties;
+ typedef std::map<URIInt, Atom> Properties;
const Properties& properties() { return _properties; }
View* view() const { return _view; }
diff --git a/src/engine/Controller.cpp b/src/engine/Controller.cpp
index c400043..8c27503 100644
--- a/src/engine/Controller.cpp
+++ b/src/engine/Controller.cpp
@@ -54,7 +54,7 @@ Controller::create(const client::ClientObject& properties)
void
Controller::announce(SPtr<Machine> machine)
{
- Raul::Forge& forge = _engine->forge();
+ Forge& forge = _engine->forge();
for (const auto& n : machine->nodes()) {
// Find or create a new client object if necessary
@@ -135,9 +135,9 @@ Controller::learn(SPtr<Raul::Maid> maid, uint64_t node_id)
}
void
-Controller::set_property(uint64_t object_id,
- URIInt key,
- const Raul::Atom& value)
+Controller::set_property(uint64_t object_id,
+ URIInt key,
+ const Atom& value)
{
SPtr<Stateful> object = find(object_id);
if (object) {
@@ -156,7 +156,7 @@ Controller::connect(uint64_t tail_id, uint64_t head_id)
tail->add_edge(edge);
_objects.insert(edge);
- Raul::Forge& forge = _engine->forge();
+ Forge& forge = _engine->forge();
SPtr<client::ClientObject> obj(new client::ClientObject(edge->id()));
obj->set(URIs::instance().rdf_type,
@@ -207,9 +207,9 @@ Controller::process_updates()
{
const uint32_t read_space = _updates->read_space();
- uint64_t subject;
- URIInt key;
- Raul::Atom value;
+ uint64_t subject;
+ URIInt key;
+ Atom value;
for (uint32_t i = 0; i < read_space; ) {
i += read_set(_updates, &subject, &key, &value);
SPtr<client::ClientObject> obj = _client_model.find(subject);
diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp
index cb2441d..7c206f9 100644
--- a/src/engine/Edge.cpp
+++ b/src/engine/Edge.cpp
@@ -14,18 +14,17 @@
along with Machina. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "raul/Atom.hpp"
-
+#include "machina/Atom.hpp"
+#include "machina/URIs.hpp"
#include "sord/sordmm.hpp"
#include "Edge.hpp"
#include "Node.hpp"
-#include "machina/URIs.hpp"
namespace machina {
void
-Edge::set(URIInt key, const Raul::Atom& value)
+Edge::set(URIInt key, const Atom& value)
{
if (key == URIs::instance().machina_probability) {
_probability = value.get<float>();
diff --git a/src/engine/Edge.hpp b/src/engine/Edge.hpp
index 7795854..a04dd73 100644
--- a/src/engine/Edge.hpp
+++ b/src/engine/Edge.hpp
@@ -37,7 +37,7 @@ public:
, _probability(probability)
{}
- void set(URIInt key, const Raul::Atom& value);
+ void set(URIInt key, const Atom& value);
void write_state(Sord::Model& model);
WPtr<Node> tail() { return _tail; }
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 047abb9..e2f9505 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -27,7 +27,7 @@
namespace machina {
-Engine::Engine(Raul::Forge& forge,
+Engine::Engine(Forge& forge,
SPtr<Driver> driver,
Sord::World& rdf_world)
: _driver(driver)
@@ -37,7 +37,7 @@ Engine::Engine(Raul::Forge& forge,
{}
SPtr<Driver>
-Engine::new_driver(Raul::Forge& forge,
+Engine::new_driver(Forge& forge,
const std::string& name,
SPtr<Machine> machine)
{
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 1c90509..b75a6f5 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -32,7 +32,7 @@ using namespace std;
namespace machina {
-JackDriver::JackDriver(Raul::Forge& forge, SPtr<Machine> machine)
+JackDriver::JackDriver(Forge& forge, SPtr<Machine> machine)
: Driver(forge, machine)
, _client(NULL)
, _machine_changed(0)
diff --git a/src/engine/JackDriver.hpp b/src/engine/JackDriver.hpp
index fefb744..4ebfaa1 100644
--- a/src/engine/JackDriver.hpp
+++ b/src/engine/JackDriver.hpp
@@ -42,7 +42,7 @@ class Node;
class JackDriver : public machina::Driver
{
public:
- JackDriver(Raul::Forge& forge,
+ JackDriver(Forge& forge,
SPtr<Machine> machine = SPtr<Machine>());
~JackDriver();
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp
index 0497268..7b37694 100644
--- a/src/engine/Loader.cpp
+++ b/src/engine/Loader.cpp
@@ -37,7 +37,7 @@ using namespace std;
namespace machina {
-Loader::Loader(Raul::Forge& forge, Sord::World& rdf_world)
+Loader::Loader(Forge& forge, Sord::World& rdf_world)
: _forge(forge)
, _rdf_world(rdf_world)
{}
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index 5858610..b144b6f 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -17,10 +17,9 @@
#include <cstdlib>
#include <map>
-#include "raul/Atom.hpp"
-
#include "sord/sordmm.hpp"
+#include "machina/Atom.hpp"
#include "machina/Context.hpp"
#include "machina/Machine.hpp"
#include "machina/URIs.hpp"
diff --git a/src/engine/MidiAction.cpp b/src/engine/MidiAction.cpp
index 30de67a..b5df155 100644
--- a/src/engine/MidiAction.cpp
+++ b/src/engine/MidiAction.cpp
@@ -15,9 +15,9 @@
*/
#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
+#include "machina/Atom.hpp"
#include "machina/URIs.hpp"
#include "machina/types.hpp"
-#include "raul/Atom.hpp"
#include "MIDISink.hpp"
#include "MidiAction.hpp"
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index 06317ef..7d8a870 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -17,10 +17,9 @@
#include <cassert>
#include <iostream>
-#include "raul/Atom.hpp"
-
#include "sord/sordmm.hpp"
+#include "machina/Atom.hpp"
#include "machina/URIs.hpp"
#include "ActionFactory.hpp"
@@ -222,7 +221,7 @@ Node::remove_edge_to(SPtr<Node> node)
}
void
-Node::set(URIInt key, const Raul::Atom& value)
+Node::set(URIInt key, const Atom& value)
{
if (key == URIs::instance().machina_initial) {
std::cerr << "error: Attempt to change node initial state" << std::endl;
diff --git a/src/engine/Node.hpp b/src/engine/Node.hpp
index 39f23e6..cae75f5 100644
--- a/src/engine/Node.hpp
+++ b/src/engine/Node.hpp
@@ -67,7 +67,7 @@ public:
SPtr<Edge> remove_edge_to(SPtr<Node> node);
bool connected_to(SPtr<Node> node);
- void set(URIInt key, const Raul::Atom& value);
+ void set(URIInt key, const Atom& value);
void write_state(Sord::Model& model);
bool is_initial() const { return _is_initial; }
diff --git a/src/engine/Recorder.cpp b/src/engine/Recorder.cpp
index 6636f1d..96595c3 100644
--- a/src/engine/Recorder.cpp
+++ b/src/engine/Recorder.cpp
@@ -25,11 +25,11 @@ using namespace Raul;
namespace machina {
-Recorder::Recorder(Raul::Forge& forge,
- size_t buffer_size,
- TimeUnit unit,
- double q,
- bool step)
+Recorder::Recorder(Forge& forge,
+ size_t buffer_size,
+ TimeUnit unit,
+ double q,
+ bool step)
: _forge(forge)
, _unit(unit)
, _record_buffer(buffer_size)
diff --git a/src/engine/Recorder.hpp b/src/engine/Recorder.hpp
index 529eec9..1084f17 100644
--- a/src/engine/Recorder.hpp
+++ b/src/engine/Recorder.hpp
@@ -32,11 +32,11 @@ class Recorder
: public Slave
{
public:
- Recorder(Raul::Forge& forge,
- size_t buffer_size,
- TimeUnit unit,
- double q,
- bool step);
+ Recorder(Forge& forge,
+ size_t buffer_size,
+ TimeUnit unit,
+ double q,
+ bool step);
inline void write(Raul::TimeStamp time, size_t size,
const unsigned char* buf) {
@@ -58,7 +58,7 @@ public:
private:
virtual void _whipped();
- Raul::Forge& _forge;
+ Forge& _forge;
TimeUnit _unit;
Raul::RingBuffer _record_buffer;
SPtr<MachineBuilder> _builder;
diff --git a/src/engine/SMFDriver.cpp b/src/engine/SMFDriver.cpp
index 58ff8a0..f7d1460 100644
--- a/src/engine/SMFDriver.cpp
+++ b/src/engine/SMFDriver.cpp
@@ -33,7 +33,7 @@ using namespace std;
namespace machina {
-SMFDriver::SMFDriver(Raul::Forge& forge, Raul::TimeUnit unit)
+SMFDriver::SMFDriver(Forge& forge, Raul::TimeUnit unit)
: Driver(forge, SPtr<Machine>())
{
_writer = SPtr<SMFWriter>(new SMFWriter(unit));
diff --git a/src/engine/SMFDriver.hpp b/src/engine/SMFDriver.hpp
index 6199fc1..d961a19 100644
--- a/src/engine/SMFDriver.hpp
+++ b/src/engine/SMFDriver.hpp
@@ -34,7 +34,7 @@ class Machine;
class SMFDriver : public Driver
{
public:
- SMFDriver(Raul::Forge& forge, Raul::TimeUnit unit);
+ SMFDriver(Forge& forge, Raul::TimeUnit unit);
SPtr<Machine> learn(const std::string& filename,
double q,
diff --git a/src/engine/Stateful.hpp b/src/engine/Stateful.hpp
index 6657aff..b15d863 100644
--- a/src/engine/Stateful.hpp
+++ b/src/engine/Stateful.hpp
@@ -21,6 +21,7 @@
#include "sord/sordmm.hpp"
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
namespace Raul {
@@ -38,7 +39,7 @@ public:
virtual ~Stateful() {}
- virtual void set(URIInt key, const Raul::Atom& value) {}
+ virtual void set(URIInt key, const Atom& value) {}
virtual void write_state(Sord::Model& model) = 0;
uint64_t id() const { return _id; }
diff --git a/src/engine/Updates.cpp b/src/engine/Updates.cpp
index 5d37936..3193d41 100644
--- a/src/engine/Updates.cpp
+++ b/src/engine/Updates.cpp
@@ -16,10 +16,9 @@
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
-#include "raul/Atom.hpp"
-
-#include "machina/types.hpp"
+#include "machina/Atom.hpp"
#include "machina/Updates.hpp"
+#include "machina/types.hpp"
namespace machina {
@@ -27,7 +26,7 @@ void
write_set(SPtr<Raul::RingBuffer> buf,
uint64_t subject,
URIInt key,
- const Raul::Atom& value)
+ const Atom& value)
{
const uint32_t update_type = UPDATE_SET;
buf->write(sizeof(update_type), &update_type);
@@ -43,7 +42,7 @@ uint32_t
read_set(SPtr<Raul::RingBuffer> buf,
uint64_t* subject,
URIInt* key,
- Raul::Atom* value)
+ Atom* value)
{
uint32_t update_type;
buf->read(sizeof(update_type), &update_type);
@@ -56,7 +55,7 @@ read_set(SPtr<Raul::RingBuffer> buf,
LV2_Atom atom;
buf->read(sizeof(LV2_Atom), &atom);
- *value = Raul::Atom(atom.size, atom.type, NULL);
+ *value = Atom(atom.size, atom.type, NULL);
buf->read(atom.size, value->get_body());
return sizeof(update_type) + sizeof(*subject) + sizeof(*key)
diff --git a/src/engine/machina/Atom.hpp b/src/engine/machina/Atom.hpp
new file mode 100644
index 0000000..180fe1c
--- /dev/null
+++ b/src/engine/machina/Atom.hpp
@@ -0,0 +1,217 @@
+/*
+ This file is part of Machina.
+ Copyright 2007-2013 David Robillard <http://drobilla.net>
+
+ Raul is free software: you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation, either version 3 of the License, or any later version.
+
+ Raul is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Raul. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef MACHINA_ATOM_HPP
+#define MACHINA_ATOM_HPP
+
+#include <stdint.h>
+
+#include <cassert>
+#include <cstdlib>
+#include <cstring>
+#include <string>
+
+namespace machina {
+
+class Forge;
+
+/**
+ A generic typed data container.
+
+ An Atom holds a value with some type and size, both specified by a uint32_t.
+ Values with size less than sizeof(void*) are stored inline: no dynamic
+ allocation occurs so Atoms may be created in hard real-time threads.
+ Otherwise, if the size is larger than sizeof(void*), the value will be
+ dynamically allocated in a separate chunk of memory.
+*/
+class Atom {
+public:
+ Atom() : _size(0), _type(0) { _val._blob = NULL; }
+ ~Atom() { dealloc(); }
+
+ typedef uint32_t TypeID;
+
+ /** Contruct a raw atom.
+ *
+ * Typically this is not used directly, use Forge methods to make atoms.
+ */
+ Atom(uint32_t size, TypeID type, const void* body)
+ : _size(size)
+ , _type(type)
+ {
+ if (is_reference()) {
+ _val._blob = malloc(size);
+ }
+ if (body) {
+ memcpy(get_body(), body, size);
+ }
+ }
+
+ Atom(const Atom& copy)
+ : _size(copy._size)
+ , _type(copy._type)
+ {
+ if (is_reference()) {
+ _val._blob = malloc(_size);
+ memcpy(_val._blob, copy._val._blob, _size);
+ } else {
+ memcpy(&_val, &copy._val, _size);
+ }
+ }
+
+ Atom& operator=(const Atom& other) {
+ if (&other == this) {
+ return *this;
+ }
+ dealloc();
+ _size = other._size;
+ _type = other._type;
+ if (is_reference()) {
+ _val._blob = malloc(_size);
+ memcpy(_val._blob, other._val._blob, _size);
+ } else {
+ memcpy(&_val, &other._val, _size);
+ }
+ return *this;
+ }
+
+ inline bool operator==(const Atom& other) const {
+ if (_type == other.type() && _size == other.size()) {
+ if (is_reference()) {
+ return !memcmp(_val._blob, other._val._blob, _size);
+ } else {
+ return !memcmp(&_val, &other._val, _size);
+ }
+ }
+ return false;
+ }
+
+ inline bool operator!=(const Atom& other) const {
+ return !operator==(other);
+ }
+
+ inline bool operator<(const Atom& other) const {
+ if (_type == other.type()) {
+ if (is_reference()) {
+ return memcmp(_val._blob, other._val._blob, _size) < 0;
+ } else {
+ return memcmp(&_val, &other._val, _size) < 0;
+ }
+ }
+ return _type < other.type();
+ }
+
+ inline uint32_t size() const { return _size; }
+ inline bool is_valid() const { return _type; }
+ inline TypeID type() const { return _type; }
+
+ inline const void* get_body() const {
+ return is_reference() ? _val._blob : &_val;
+ }
+
+ inline void* get_body() {
+ return is_reference() ? _val._blob : &_val;
+ }
+
+ template <typename T> const T& get() const {
+ assert(size() == sizeof(T));
+ return *static_cast<const T*>(get_body());
+ }
+
+ template <typename T> const T* ptr() const {
+ return static_cast<const T*>(get_body());
+ }
+
+private:
+ friend class Forge;
+
+ /** Free dynamically allocated value, if applicable. */
+ inline void dealloc() {
+ if (is_reference()) {
+ free(_val._blob);
+ }
+ }
+
+ /** Return true iff this value is dynamically allocated. */
+ inline bool is_reference() const {
+ return _size > sizeof(_val);
+ }
+
+ uint32_t _size;
+ TypeID _type;
+
+ union {
+ intptr_t _val;
+ void* _blob;
+ } _val;
+};
+
+class Forge {
+public:
+ Forge()
+ : Int(1)
+ , Float(2)
+ , Bool(3)
+ , URI(4)
+ , URID(5)
+ , String(6)
+ {}
+
+ virtual ~Forge() {}
+
+ Atom make() { return Atom(); }
+ Atom make(int32_t v) { return Atom(sizeof(v), Int, &v); }
+ Atom make(float v) { return Atom(sizeof(v), Float, &v); }
+ Atom make(bool v) {
+ const int32_t iv = v ? 1 : 0;
+ return Atom(sizeof(int32_t), Bool, &iv);
+ }
+
+ Atom make_urid(int32_t v) { return Atom(sizeof(int32_t), URID, &v); }
+
+ Atom alloc(uint32_t size, uint32_t type, const void* val) {
+ return Atom(size, type, val);
+ }
+
+ Atom alloc(const char* v) {
+ const size_t len = strlen(v);
+ return Atom(len + 1, String, v);
+ }
+
+ Atom alloc(const std::string& v) {
+ return Atom(v.length() + 1, String, v.c_str());
+ }
+
+ Atom alloc_uri(const char* v) {
+ const size_t len = strlen(v);
+ return Atom(len + 1, URI, v);
+ }
+
+ Atom alloc_uri(const std::string& v) {
+ return Atom(v.length() + 1, URI, v.c_str());
+ }
+
+ Atom::TypeID Int;
+ Atom::TypeID Float;
+ Atom::TypeID Bool;
+ Atom::TypeID URI;
+ Atom::TypeID URID;
+ Atom::TypeID String;
+};
+
+} // namespace machina
+
+#endif // MACHINA_ATOM_HPP
diff --git a/src/engine/machina/Context.hpp b/src/engine/machina/Context.hpp
index e0ca423..766975b 100644
--- a/src/engine/machina/Context.hpp
+++ b/src/engine/machina/Context.hpp
@@ -17,8 +17,8 @@
#ifndef MACHINA_CONTEXT_HPP
#define MACHINA_CONTEXT_HPP
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
-#include "raul/Atom.hpp"
#include "raul/TimeSlice.hpp"
namespace machina {
@@ -28,20 +28,20 @@ class MIDISink;
class Context
{
public:
- Context(Raul::Forge& forge, uint32_t rate, uint32_t ppqn, double bpm)
+ Context(Forge& forge, uint32_t rate, uint32_t ppqn, double bpm)
: _forge(forge)
, _time(rate, ppqn, bpm)
{}
void set_sink(MIDISink* sink) { _sink = sink; }
- Raul::Forge& forge() { return _forge; }
+ Forge& forge() { return _forge; }
const Raul::TimeSlice& time() const { return _time; }
Raul::TimeSlice& time() { return _time; }
MIDISink* sink() { return _sink; }
private:
- Raul::Forge& _forge;
+ Forge& _forge;
Raul::TimeSlice _time;
MIDISink* _sink;
};
diff --git a/src/engine/machina/Controller.hpp b/src/engine/machina/Controller.hpp
index 7738f22..e745c9c 100644
--- a/src/engine/machina/Controller.hpp
+++ b/src/engine/machina/Controller.hpp
@@ -52,7 +52,7 @@ public:
uint64_t create(const client::ClientObject& obj);
uint64_t connect(uint64_t tail_id, uint64_t head_id);
- void set_property(uint64_t object_id, URIInt key, const Raul::Atom& value);
+ void set_property(uint64_t object_id, URIInt key, const Atom& value);
void learn(SPtr<Raul::Maid> maid, uint64_t node_id);
void disconnect(uint64_t tail_id, uint64_t head_id);
diff --git a/src/engine/machina/Driver.hpp b/src/engine/machina/Driver.hpp
index d913741..546c4d6 100644
--- a/src/engine/machina/Driver.hpp
+++ b/src/engine/machina/Driver.hpp
@@ -30,7 +30,7 @@ class Machine;
class Driver : public MIDISink
{
public:
- Driver(Raul::Forge& forge, SPtr<Machine> machine)
+ Driver(Forge& forge, SPtr<Machine> machine)
: _forge(forge)
, _machine(machine)
, _play_state(PlayState::STOPPED)
@@ -72,7 +72,7 @@ public:
PlayState play_state() const { return _play_state; }
protected:
- Raul::Forge& _forge;
+ Forge& _forge;
SPtr<Machine> _machine;
SPtr<Raul::RingBuffer> _updates;
PlayState _play_state;
diff --git a/src/engine/machina/Engine.hpp b/src/engine/machina/Engine.hpp
index b3c6010..4bd907b 100644
--- a/src/engine/machina/Engine.hpp
+++ b/src/engine/machina/Engine.hpp
@@ -21,11 +21,10 @@
#include <glibmm/ustring.h>
-#include "raul/Atom.hpp"
-
-#include "machina/types.hpp"
+#include "machina/Atom.hpp"
#include "machina/Driver.hpp"
#include "machina/Loader.hpp"
+#include "machina/types.hpp"
namespace machina {
@@ -34,19 +33,19 @@ class Machine;
class Engine
{
public:
- Engine(Raul::Forge& forge,
+ Engine(Forge& forge,
SPtr<Driver> driver,
Sord::World& rdf_world);
Sord::World& rdf_world() { return _rdf_world; }
- static SPtr<Driver> new_driver(Raul::Forge& forge,
+ static SPtr<Driver> new_driver(Forge& forge,
const std::string& name,
SPtr<Machine> machine);
SPtr<Driver> driver() { return _driver; }
SPtr<Machine> machine() { return _driver->machine(); }
- Raul::Forge& forge() { return _forge; }
+ Forge& forge() { return _forge; }
SPtr<Machine> load_machine(const Glib::ustring& uri);
SPtr<Machine> load_machine_midi(const Glib::ustring& uri,
@@ -63,7 +62,7 @@ private:
SPtr<Driver> _driver;
Sord::World& _rdf_world;
Loader _loader;
- Raul::Forge _forge;
+ Forge _forge;
};
} // namespace machina
diff --git a/src/engine/machina/Loader.hpp b/src/engine/machina/Loader.hpp
index 548e23a..0b1e9ec 100644
--- a/src/engine/machina/Loader.hpp
+++ b/src/engine/machina/Loader.hpp
@@ -19,8 +19,8 @@
#include <glibmm/ustring.h>
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
-#include "raul/Atom.hpp"
#include "raul/TimeStamp.hpp"
#include "sord/sordmm.hpp"
@@ -33,7 +33,7 @@ class Machine;
class Loader
{
public:
- Loader(Raul::Forge& forge, Sord::World& rdf_world);
+ Loader(Forge& forge, Sord::World& rdf_world);
SPtr<Machine> load(const Glib::ustring& filename);
@@ -42,7 +42,7 @@ public:
Raul::TimeDuration dur);
private:
- Raul::Forge& _forge;
+ Forge& _forge;
Sord::World& _rdf_world;
};
diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp
index d712c33..7c9855d 100644
--- a/src/engine/machina/Machine.hpp
+++ b/src/engine/machina/Machine.hpp
@@ -21,7 +21,7 @@
#include <set>
#include "machina/types.hpp"
-#include "raul/Atom.hpp"
+#include "machina/Atom.hpp"
#include "raul/RingBuffer.hpp"
#include "raul/TimeSlice.hpp"
#include "sord/sordmm.hpp"
diff --git a/src/engine/machina/URIs.hpp b/src/engine/machina/URIs.hpp
index eba1692..f770723 100644
--- a/src/engine/machina/URIs.hpp
+++ b/src/engine/machina/URIs.hpp
@@ -19,8 +19,7 @@
#include <stdint.h>
-#include "raul/Atom.hpp"
-
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
#define MACHINA_URI_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
diff --git a/src/engine/machina/Updates.hpp b/src/engine/machina/Updates.hpp
index fe68855..7c0391b 100644
--- a/src/engine/machina/Updates.hpp
+++ b/src/engine/machina/Updates.hpp
@@ -19,8 +19,7 @@
#include <stdint.h>
-#include "raul/Atom.hpp"
-
+#include "machina/Atom.hpp"
#include "machina/types.hpp"
namespace machina {
@@ -33,13 +32,13 @@ void
write_set(SPtr<Raul::RingBuffer> buf,
uint64_t subject,
URIInt key,
- const Raul::Atom& value);
+ const Atom& value);
uint32_t
read_set(SPtr<Raul::RingBuffer> buf,
uint64_t* subject,
URIInt* key,
- Raul::Atom* value);
+ Atom* value);
} // namespace machina
diff --git a/src/gui/EdgeView.cpp b/src/gui/EdgeView.cpp
index a332859..67fc821 100644
--- a/src/gui/EdgeView.cpp
+++ b/src/gui/EdgeView.cpp
@@ -108,7 +108,7 @@ bool
EdgeView::on_event(GdkEvent* ev)
{
MachinaCanvas* canvas = dynamic_cast<MachinaCanvas*>(this->canvas());
- Raul::Forge& forge = canvas->app()->forge();
+ Forge& forge = canvas->app()->forge();
if (ev->type == GDK_BUTTON_PRESS) {
if (ev->button.state & GDK_CONTROL_MASK) {
@@ -131,7 +131,7 @@ EdgeView::on_event(GdkEvent* ev)
}
void
-EdgeView::on_property(machina::URIInt key, const Raul::Atom& value)
+EdgeView::on_property(machina::URIInt key, const Atom& value)
{
if (key == URIs::instance().machina_probability) {
set_color(edge_color(value.get<float>()));
diff --git a/src/gui/EdgeView.hpp b/src/gui/EdgeView.hpp
index bd84ba6..1ad2dd0 100644
--- a/src/gui/EdgeView.hpp
+++ b/src/gui/EdgeView.hpp
@@ -46,7 +46,7 @@ public:
private:
bool on_event(GdkEvent* ev);
- void on_property(machina::URIInt key, const Raul::Atom& value);
+ void on_property(machina::URIInt key, const Atom& value);
float probability() const;
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 2c5e8a0..76c029c 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -108,14 +108,14 @@ void
MachinaCanvas::on_new_object(SPtr<client::ClientObject> object)
{
const machina::URIs& uris = URIs::instance();
- const Raul::Atom& type = object->get(uris.rdf_type);
+ const Atom& type = object->get(uris.rdf_type);
if (!type.is_valid()) {
return;
}
if (type.get<URIInt>() == uris.machina_Node) {
- const Raul::Atom& node_x = object->get(uris.machina_canvas_x);
- const Raul::Atom& node_y = object->get(uris.machina_canvas_y);
+ const Atom& node_x = object->get(uris.machina_canvas_x);
+ const Atom& node_y = object->get(uris.machina_canvas_y);
float x, y;
if (node_x.type() == _app->forge().Float &&
node_y.type() == _app->forge().Float) {
@@ -167,7 +167,7 @@ MachinaCanvas::on_new_object(SPtr<client::ClientObject> object)
void
MachinaCanvas::on_erase_object(SPtr<client::ClientObject> object)
{
- const Raul::Atom& type = object->get(URIs::instance().rdf_type);
+ const Atom& type = object->get(URIs::instance().rdf_type);
if (type.get<URIInt>() == URIs::instance().machina_Node) {
delete object->view();
object->set_view(NULL);
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index c450ebb..bb111a2 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -54,7 +54,7 @@ public:
SPtr<MachinaCanvas> canvas() { return _canvas; }
SPtr<machina::Engine> engine() { return _engine; }
SPtr<machina::Controller> controller() { return _controller; }
- Raul::Forge& forge() { return _forge; }
+ Forge& forge() { return _forge; }
SPtr<Raul::Maid> maid() { return _maid; }
Gtk::Window* window() { return _main_window; }
@@ -132,7 +132,7 @@ protected:
SPtr<Raul::Maid> _maid;
SPtr<machina::Evolver> _evolver;
- Raul::Forge _forge;
+ Forge _forge;
Gtk::Main* _gtk_main;
diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp
index 09ec6a8..f87b74a 100644
--- a/src/gui/NodeView.cpp
+++ b/src/gui/NodeView.cpp
@@ -74,9 +74,9 @@ NodeView::on_double_click(GdkEventButton*)
}
bool
-NodeView::is(Raul::Forge& forge, machina::URIInt key)
+NodeView::is(Forge& forge, machina::URIInt key)
{
- const Raul::Atom& value = _node->get(key);
+ const Atom& value = _node->get(key);
return value.type() == forge.Bool && value.get<int32_t>();
}
@@ -84,7 +84,7 @@ bool
NodeView::on_event(GdkEvent* event)
{
MachinaCanvas* canvas = dynamic_cast<MachinaCanvas*>(this->canvas());
- Raul::Forge& forge = canvas->app()->forge();
+ Forge& forge = canvas->app()->forge();
if (event->type == GDK_BUTTON_PRESS) {
if (event->button.state & GDK_CONTROL_MASK) {
if (event->button.button == 1) {
@@ -131,7 +131,7 @@ void
NodeView::show_label(bool show)
{
if (show && _enter_action) {
- Raul::Atom note_number = _enter_action->get(
+ Atom note_number = _enter_action->get(
URIs::instance().machina_note_number);
if (note_number.is_valid()) {
uint8_t buf[8];
@@ -145,7 +145,7 @@ NodeView::show_label(bool show)
}
void
-NodeView::on_property(machina::URIInt key, const Raul::Atom& value)
+NodeView::on_property(machina::URIInt key, const Atom& value)
{
static const uint32_t active_color = 0x408040FF;
static const uint32_t active_border_color = 0x00FF00FF;
@@ -183,7 +183,7 @@ NodeView::on_property(machina::URIInt key, const Raul::Atom& value)
}
void
-NodeView::on_action_property(machina::URIInt key, const Raul::Atom& value)
+NodeView::on_action_property(machina::URIInt key, const Atom& value)
{
if (key == URIs::instance().machina_note_number) {
show_label(true);
diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp
index d9ea1e8..6e0681c 100644
--- a/src/gui/NodeView.hpp
+++ b/src/gui/NodeView.hpp
@@ -54,10 +54,10 @@ public:
private:
bool on_event(GdkEvent* ev);
bool on_double_click(GdkEventButton* ev);
- void on_property(machina::URIInt key, const Raul::Atom& value);
- void on_action_property(machina::URIInt key, const Raul::Atom& value);
+ void on_property(machina::URIInt key, const Atom& value);
+ void on_action_property(machina::URIInt key, const Atom& value);
- bool is(Raul::Forge& forge, machina::URIInt key);
+ bool is(Forge& forge, machina::URIInt key);
Gtk::Window* _window;
SPtr<machina::client::ClientObject> _node;
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 04d9e6d..407258d 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -42,7 +42,7 @@ main(int argc, char** argv)
rdf_world.add_prefix("", MACHINA_NS);
rdf_world.add_prefix("midi", LV2_MIDI_PREFIX);
- Raul::Forge forge;
+ Forge forge;
SPtr<machina::Machine> machine;
Raul::TimeUnit beats(TimeUnit::BEATS, MACHINA_PPQN);