diff options
-rw-r--r-- | src/engine/Makefile.am | 8 | ||||
-rw-r--r-- | src/engine/Problem.cpp | 2 | ||||
-rw-r--r-- | src/engine/machina/Problem.hpp | 3 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 7 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 11 | ||||
-rw-r--r-- | src/machina.cpp | 14 |
6 files changed, 29 insertions, 16 deletions
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index e79502e..ccfae64 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -10,7 +10,6 @@ libmachina_la_SOURCES = \ ActionFactory.cpp \ Edge.cpp \ Engine.cpp \ - Evolver.cpp \ LearnRequest.cpp \ Loader.cpp \ Machine.cpp \ @@ -18,10 +17,13 @@ libmachina_la_SOURCES = \ MidiAction.cpp \ Mutation.cpp \ Node.cpp \ - Problem.cpp \ Recorder.cpp \ SMFDriver.cpp if WITH_JACK -libmachina_la_SOURCES += JackDriver.cpp jack_compat.h +libmachina_la_SOURCES += JackDriver.cpp +endif + +if WITH_EUGENE +libmachina_la_SOURCES += Evolver.cpp Problem.cpp endif diff --git a/src/engine/Problem.cpp b/src/engine/Problem.cpp index 83f9d51..dfbe038 100644 --- a/src/engine/Problem.cpp +++ b/src/engine/Problem.cpp @@ -27,7 +27,7 @@ #include <machina/Edge.hpp> #include <raul/SMFReader.hpp> #include <raul/midi_events.h> -#include <eugene/core/Problem.hpp> + #include <eugene/core/Problem.hpp> using namespace std; diff --git a/src/engine/machina/Problem.hpp b/src/engine/machina/Problem.hpp index 067be51..b6f3bdc 100644 --- a/src/engine/machina/Problem.hpp +++ b/src/engine/machina/Problem.hpp @@ -18,9 +18,10 @@ #ifndef MACHINA_PROBLEM_HPP #define MACHINA_PROBLEM_HPP +#include CONFIG_H_PATH + #include <map> #include <raul/MIDISink.hpp> -#include <eugene/core/Problem.hpp> #include <machina/Machine.hpp> namespace Machina { diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 4fdc6fa..c6ecfc0 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -179,7 +179,8 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine) _evolve_button->signal_clicked().connect(sigc::mem_fun(this, &MachinaGUI::evolve_toggled)); Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::evolve_callback), 1000); #else - _evolve_button->hide(); + _evolve_button->set_sensitive(false); + _load_target_button->set_sensitive(false); #endif _canvas->build(engine->machine(), _menu_view_labels->get_active()); @@ -191,6 +192,7 @@ MachinaGUI::~MachinaGUI() } +#ifdef HAVE_EUGENE bool MachinaGUI::evolve_callback() { @@ -203,6 +205,7 @@ MachinaGUI::evolve_callback() return true; } +#endif bool @@ -274,6 +277,7 @@ MachinaGUI::load_target_clicked() } +#ifdef HAVE_EUGENE void MachinaGUI::evolve_toggled() { @@ -293,6 +297,7 @@ MachinaGUI::evolve_toggled() _engine->driver()->activate(); } } +#endif void diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 26cfad4..b0d379e 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -64,14 +64,19 @@ protected: void menu_help_help(); void arrange(); void load_target_clicked(); - void evolve_toggled(); + void random_mutation(SharedPtr<Machina::Machine> machine); void mutate(SharedPtr<Machina::Machine> machine, unsigned mutation); void zoom(double z); void update_toolbar(); - bool evolve_callback(); - bool idle_callback(); + bool scrolled_window_event(GdkEvent* ev); + bool idle_callback(); + +#ifdef HAVE_EUGENE + void evolve_toggled(); + bool evolve_callback(); +#endif void record_toggled(); void stop_clicked(); diff --git a/src/machina.cpp b/src/machina.cpp index ae75313..dfbd20c 100644 --- a/src/machina.cpp +++ b/src/machina.cpp @@ -15,6 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include CONFIG_H_PATH + #include <iostream> #include <signal.h> #include "machina/Action.hpp" @@ -24,7 +26,9 @@ #include "machina/Machine.hpp" #include "machina/MidiAction.hpp" #include "machina/Node.hpp" -#include "machina/Problem.hpp" +#ifdef HAVE_EUGENE + #include "machina/Problem.hpp" +#endif using namespace std; using namespace Machina; @@ -61,19 +65,15 @@ main(int argc, char** argv) Redland::World rdf_world; Engine engine(driver, rdf_world); - /*// FIXME: Would be nice if this could take URIs on the cmd line + /* FIXME: Would be nice if this could take URIs on the cmd line char* uri = (char*)calloc(6 + strlen(argv[1]), sizeof(char)); strcpy(uri, "file:"); strcat(uri, argv[1]); engine.load_machine(uri); free(uri); -*/ + */ engine.load_machine(argv[1]); - // FIXME: temporary hack - SharedPtr<Problem> problem(new Problem("./gui/target.mid")); - cout << "Fitness: " << problem->fitness(*engine.machine().get()) << endl; - driver->attach("machina"); signal(SIGINT, catch_int); |