aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/Loader.cpp7
-rw-r--r--src/engine/wscript12
-rw-r--r--src/gui/MachinaCanvas.cpp9
-rw-r--r--src/gui/MachinaGUI.cpp5
-rw-r--r--src/gui/MachinaGUI.hpp4
-rw-r--r--src/gui/main.cpp3
-rw-r--r--wscript44
7 files changed, 50 insertions, 34 deletions
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp
index 830ef47..07867ad 100644
--- a/src/engine/Loader.cpp
+++ b/src/engine/Loader.cpp
@@ -25,6 +25,7 @@
#include "machina/Edge.hpp"
#include "machina/Machine.hpp"
#include "machina/ActionFactory.hpp"
+#include "wafconfig.h"
using namespace Raul;
using namespace std;
@@ -74,7 +75,7 @@ Loader::load(const Glib::ustring& uri)
cout << "[Loader] Loading " << machine_uri << " from " << document_uri << endl;
- machine = SharedPtr<Machine>(new Machine(TimeUnit::beats(LV2_EVENT_PPQN)));
+ machine = SharedPtr<Machine>(new Machine(TimeUnit::beats(MACHINA_PPQN)));
typedef std::map<string, SharedPtr<Node> > Created;
Created created;
@@ -94,7 +95,7 @@ Loader::load(const Glib::ustring& uri)
for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const char* node_id = (*i)["node"];
SharedPtr<Node> node(new Node(
- TimeStamp(TimeUnit(TimeUnit::BEATS, LV2_EVENT_PPQN), (double)(*i)["duration"]),
+ TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), (double)(*i)["duration"]),
true));
machine->add_node(node);
created[node_id] = node;
@@ -115,7 +116,7 @@ Loader::load(const Glib::ustring& uri)
const char* node_id = (*i)["node"];
if (created.find(node_id) == created.end()) {
SharedPtr<Node> node(new Node(
- TimeStamp(TimeUnit(TimeUnit::BEATS, LV2_EVENT_PPQN), (double)(*i)["duration"]),
+ TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), (double)(*i)["duration"]),
false));
machine->add_node(node);
created[node_id] = node;
diff --git a/src/engine/wscript b/src/engine/wscript
index 84b42a1..902ab78 100644
--- a/src/engine/wscript
+++ b/src/engine/wscript
@@ -7,7 +7,6 @@ def build(bld):
ActionFactory.cpp
Edge.cpp
Engine.cpp
- Evolver.cpp
JackDriver.cpp
LearnRequest.cpp
Loader.cpp
@@ -16,18 +15,23 @@ def build(bld):
MidiAction.cpp
Mutation.cpp
Node.cpp
- Problem.cpp
RaulJackDriver.cpp
Recorder.cpp
SMFDriver.cpp
'''
-
+ if bld.env['HAVE_EUGENE']:
+ core_source += '''
+ Evolver.cpp
+ Problem.cpp
+ '''
obj = bld.new_task_gen('cxx', 'shlib')
obj.source = core_source
obj.export_incdirs = ['.']
obj.includes = '.'
obj.name = 'libmachina_engine'
obj.target = 'machina_engine'
- core_libs = 'GLIBMM GTHREAD RAUL REDLANDMM JACK EUGENE'
+ core_libs = 'GLIBMM GTHREAD RAUL REDLANDMM JACK'
+ if bld.env['HAVE_EUGENE']:
+ core_libs += ' EUGENE '
autowaf.use_lib(bld, obj, core_libs)
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 26c805b..ba43b4e 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -18,11 +18,12 @@
#include <map>
#include "raul/SharedPtr.hpp"
#include "raul/TimeStamp.hpp"
-#include "machina/Node.hpp"
-#include "machina/Machine.hpp"
#include "machina/Action.hpp"
#include "machina/Edge.hpp"
+#include "machina/Engine.hpp"
#include "machina/LearnRequest.hpp"
+#include "machina/Machine.hpp"
+#include "machina/Node.hpp"
#include "MachinaGUI.hpp"
#include "MachinaCanvas.hpp"
#include "NodeView.hpp"
@@ -53,7 +54,7 @@ MachinaCanvas::node_clicked(WeakPtr<NodeView> item, GdkEventButton* event)
// Middle click, learn
if (event->button == 2) {
- _app->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node()));
+ _app->engine()->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node()));
return;
} else if (event->button == 3) {
SharedPtr<NodeView> last = _last_clicked.lock();
@@ -82,7 +83,7 @@ MachinaCanvas::canvas_event(GdkEvent* event)
{
static int last = 0;
- SharedPtr<Machina::Machine> machine = _app->machine();
+ SharedPtr<Machina::Machine> machine = _app->engine()->machine();
if (!machine)
return false;
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index a71a980..2b40b0a 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -25,6 +25,7 @@
#include <libgnomecanvasmm.h>
#include <libglademm/xml.h>
#include "redlandmm/Model.hpp"
+#include "machina/Engine.hpp"
#include "machina/Machine.hpp"
#include "machina/Mutation.hpp"
#include "machina/SMFDriver.hpp"
@@ -240,7 +241,7 @@ MachinaGUI::scrolled_window_event(GdkEvent* event)
i != selection.end(); ++i) {
SharedPtr<NodeView> view = PtrCast<NodeView>(*i);
if (view) {
- machine()->remove_node(view->node());
+ _engine->machine()->remove_node(view->node());
_canvas->remove_item(view);
}
}
@@ -446,7 +447,7 @@ MachinaGUI::menu_file_save()
Redland::Model model(_engine->rdf_world());
model.set_base_uri(_save_uri);
- machine()->write_state(model);
+ _engine->machine()->write_state(model);
model.serialise_to_file(_save_uri);
}
}
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index 28ae5c6..64322d0 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -36,8 +36,8 @@ public:
MachinaGUI(SharedPtr<Machina::Engine> engine);
~MachinaGUI();
- boost::shared_ptr<MachinaCanvas> canvas() { return _canvas; }
- boost::shared_ptr<Machina::Machine> machine() { return _engine->machine(); }
+ boost::shared_ptr<MachinaCanvas> canvas() { return _canvas; }
+ boost::shared_ptr<Machina::Engine> engine() { return _engine; }
SharedPtr<Raul::Maid> maid() { return _maid; }
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 62d47c1..8d9b000 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -21,8 +21,9 @@
#include <string>
#include <libgnomecanvasmm.h>
#include "redlandmm/World.hpp"
-#include "machina/Machine.hpp"
+#include "machina/Engine.hpp"
#include "machina/Loader.hpp"
+#include "machina/Machine.hpp"
#include "machina/SMFDriver.hpp"
#include "MachinaGUI.hpp"
diff --git a/wscript b/wscript
index 0f9bd59..a8634a0 100644
--- a/wscript
+++ b/wscript
@@ -19,33 +19,41 @@ def set_options(opt):
def configure(conf):
autowaf.configure(conf)
autowaf.check_tool(conf, 'compiler_cxx')
- autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=True)
- autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.14.0', mandatory=True)
- autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.11.12', mandatory=False)
- autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.109.0', mandatory=True)
- autowaf.check_pkg(conf, 'raul', uselib_store='RAUL', atleast_version='0.5.1', mandatory=True)
- autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS', atleast_version='0.5.1', mandatory=False)
- autowaf.check_pkg(conf, 'libglademm-2.4', uselib_store='GLADEMM', atleast_version='2.6.0', mandatory=False)
- autowaf.check_pkg(conf, 'redlandmm', uselib_store='REDLANDMM', atleast_version='0.0.0', mandatory=False)
- autowaf.check_pkg(conf, 'eugene', uselib_store='EUGENE', atleast_version='0.0.0', mandatory=True)
+ autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM',
+ atleast_version='2.14.0', mandatory=True)
+ autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
+ atleast_version='2.14.0', mandatory=True)
+ autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
+ atleast_version='2.11.12', mandatory=False)
+ autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
+ atleast_version='0.109.0', mandatory=True)
+ autowaf.check_pkg(conf, 'raul', uselib_store='RAUL',
+ atleast_version='0.5.1', mandatory=True)
+ autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS',
+ atleast_version='0.5.1', mandatory=False)
+ autowaf.check_pkg(conf, 'libglademm-2.4', uselib_store='GLADEMM',
+ atleast_version='2.6.0', mandatory=False)
+ autowaf.check_pkg(conf, 'redlandmm', uselib_store='REDLANDMM',
+ atleast_version='0.0.0', mandatory=False)
+ autowaf.check_pkg(conf, 'eugene', uselib_store='EUGENE',
+ atleast_version='0.0.0', mandatory=False)
# Check for posix_memalign (OSX, amazingly, doesn't have it)
- fe = conf.create_function_enumerator()
- fe.headers = ['stdlib.h']
- fe.function = 'posix_memalign'
- fe.define = 'HAVE_POSIX_MEMALIGN'
- fe.run()
+ conf.check(
+ function_name='posix_memalign',
+ header_name='stdlib.h',
+ define_name='HAVE_POSIX_MEMALIGN')
build_gui = conf.env['HAVE_GLADEMM'] == 1 and conf.env['HAVE_FLOWCANVAS'] == 1
+
+ conf.define('MACHINA_PPQN', 19200)
conf.define('MACHINA_VERSION', MACHINA_VERSION)
conf.define('BUILD_MACHINA_GUI', int(build_gui))
if conf.env['BUNDLE']:
- conf.define('MACHINA_DATA_DIR', os.path.normpath(
- conf.env['DATADIRNAME'] + 'machina'))
+ conf.define('MACHINA_DATA_DIR', os.path.join(conf.env['DATADIRNAME'] + 'machina'))
else:
- conf.define('MACHINA_DATA_DIR', os.path.normpath(
- conf.env['DATADIR'] + 'machina'))
+ conf.define('MACHINA_DATA_DIR', os.path.join(conf.env['DATADIR'], 'machina'))
conf.write_config_header('wafconfig.h')