aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-01 15:18:31 +0000
committerDavid Robillard <d@drobilla.net>2007-04-01 15:18:31 +0000
commit719fc353d389b936cc1c064d512453268283b424 (patch)
tree52f8f03f8185c85b3e3bfd56f234374adae390c2
parent9d60d35ca6dc8e2561a1984cbe622325afa55a84 (diff)
downloadmachina-719fc353d389b936cc1c064d512453268283b424.tar.gz
machina-719fc353d389b936cc1c064d512453268283b424.tar.bz2
machina-719fc353d389b936cc1c064d512453268283b424.zip
Fixed exception bug.
git-svn-id: http://svn.drobilla.net/lad/machina@387 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/JackDriver.cpp9
-rw-r--r--src/gui/main.cpp20
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;
}