From 6c61c79d43d1d4715ce04b46e459279d0fa6c854 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 11 Jan 2013 22:15:55 +0000 Subject: Move MIDISink from Machine state to Context parameter. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4925 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/JackDriver.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/engine/JackDriver.cpp') diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index bc1e38e..f863bae 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -50,6 +50,7 @@ JackDriver::JackDriver(Raul::Forge& forge, SharedPtr machine) , _recording(false) , _is_activated(false) { + _context.set_sink(this); } JackDriver::~JackDriver() @@ -313,8 +314,7 @@ 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(_last_machine->time()); // Exit all active states + _last_machine->reset(_context.sink(), _last_machine->time()); // Exit all active states _last_machine.reset(); // Cut our reference } _machine_changed.post(); // Signal we're done with it @@ -325,10 +325,8 @@ JackDriver::on_process(jack_nframes_t nframes) return; } - machine->set_sink(shared_from_this()); - if (_stop_flag) - machine->reset(_context.time().start_beats()); + machine->reset(_context.sink(), _context.time().start_beats()); process_input(machine, _context.time()); @@ -340,14 +338,14 @@ JackDriver::on_process(jack_nframes_t nframes) if (run_dur_frames == 0) { // Machine didn't run at all (machine has no initial states) - machine->reset(machine->time()); // Try again next cycle + machine->reset(_context.sink(), machine->time()); // Try again next cycle _context.time().set_slice(TimeStamp(_frames_unit, 0, 0), TimeStamp(_frames_unit, 0, 0)); break; } else if (machine->is_finished()) { // Machine ran for portion of cycle and is finished - machine->reset(machine->time()); + machine->reset(_context.sink(), machine->time()); _context.time().set_slice(TimeStamp(_frames_unit, 0, 0), TimeStamp(_frames_unit, nframes - run_dur_frames, 0)); -- cgit v1.2.1