diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/JackDriver.cpp | 9 | ||||
-rw-r--r-- | src/gui/main.cpp | 20 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index d19bdeb..7a2b03d 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -179,6 +179,13 @@ JackDriver::write_event(Raul::BeatTime time, size_t size, const byte* event) throw (std::logic_error) { + if (_cycle_time.beats_to_ticks(time) + _cycle_time.offset_ticks() < _cycle_time.start_ticks()) { + std::cerr << "ERROR: Missed event by " + << _cycle_time.start_ticks() - (_cycle_time.beats_to_ticks(time) + _cycle_time.offset_ticks()) + << "ticks." << std::endl; + return; + } + const TickCount nframes = _cycle_time.length_ticks(); const TickCount offset = _cycle_time.beats_to_ticks(time) + _cycle_time.offset_ticks() - _cycle_time.start_ticks(); @@ -221,9 +228,11 @@ JackDriver::on_process(jack_nframes_t nframes) if (machine != _last_machine) { if (_last_machine) { assert(!_last_machine.unique()); // Realtime, can't delete + _last_machine->set_sink(shared_from_this()); _last_machine->reset(); // Exit all active states _last_machine.reset(); // Cut our reference } + _cycle_time.set_start(0); _machine_changed.post(); // Signal we're done with it } diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 741c801..c522898 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char** argv) { SharedPtr<Machina::Machine> machine; - + // Load machine, if given if (argc >= 2) { const string filename = argv[1]; @@ -67,22 +67,14 @@ main(int argc, char** argv) SharedPtr<Engine> engine(new Engine(driver)); - // Launch GUI - try { - - Gnome::Canvas::init(); - Gtk::Main app(argc, argv); + Gnome::Canvas::init(); + Gtk::Main app(argc, argv); - driver->activate(); - MachinaGUI gui(engine); + driver->activate(); + MachinaGUI gui(engine); - app.run(*gui.window()); + app.run(*gui.window()); - } catch (string msg) { - cerr << "Caught exception, aborting. Error message was: " << msg << endl; - return 1; - } - return 0; } |