/* This file is part of Machina. Copyright 2007-2013 David Robillard Machina 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. Machina 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 Machina. If not, see . */ #include "machina_config.h" #include #include #include #include "sord/sordmm.hpp" #include "machina/Engine.hpp" #include "machina/Loader.hpp" #include "machina/Machine.hpp" #include "machina/URIs.hpp" #include "MachinaGUI.hpp" using namespace std; using namespace machina; int main(int argc, char** argv) { if (!Glib::thread_supported()) { Glib::thread_init(); } Sord::World rdf_world; machina::URIs::init(); SPtr machine; // Load machine, if given #if 0 if (argc >= 2) { const string filename = argv[1]; cout << "Building machine from MIDI file " << filename << endl; SPtr file_driver(new machina::SMFDriver()); if (argc >= 3) { float q = strtof(argv[2], NULL); cout << "Quantization: " << q << endl; machine = file_driver->learn(filename, q); } else { cout << "No quantization." << endl; machine = file_driver->learn(filename); } if (!machine) { cout << "Not MIDI, attempting to load machine" << endl; machine = Loader(rdf_world).load(filename); } } #endif Raul::Forge forge; if (!machine) { machine = SPtr(new Machine(TimeUnit(TimeUnit::BEATS, 19200))); } std::string driver_name = "smf"; #ifdef HAVE_JACK driver_name = "jack"; #endif // Build engine SPtr driver(Engine::new_driver(forge, driver_name, machine)); SPtr engine(new Engine(forge, driver, rdf_world)); Gtk::Main app(argc, argv); driver->activate(); gui::MachinaGUI gui(engine); app.run(*gui.window()); return 0; }