aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/JackDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/JackDriver.cpp')
-rw-r--r--src/engine/JackDriver.cpp12
1 files changed, 5 insertions, 7 deletions
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> 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));