Skip to content

Commit

Permalink
Reset statuses properly when changing JACK buffer length while running
Browse files Browse the repository at this point in the history
  • Loading branch information
dagargo committed Jul 3, 2022
1 parent cd27155 commit b82ba3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,11 +979,13 @@ run_audio_o2p_midi (void *data)
libusb_handle_events_completed (engine->usb.context, NULL);
}

if (ow_engine_get_status (engine) <= OW_ENGINE_STATUS_STOP)
if (ow_engine_get_status (engine) < OW_ENGINE_STATUS_BOOT)
{
break;
}

//status == OW_ENGINE_STATUS_BOOT

debug_print (1, "Rebooting engine...\n");

rsp2o = engine->context->read_space (engine->context->p2o_audio);
Expand Down
4 changes: 2 additions & 2 deletions src/resampler.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ ow_resampler_reset_dll (struct ow_resampler *resampler,
resampler->dll.ratio =
resampler->dll.last_ratio_avg * new_samplerate /
resampler->samplerate;
ow_engine_set_status (resampler->engine, OW_ENGINE_STATUS_READY);
resampler->log_cycles = 0;
resampler->log_control_cycles =
STARTUP_TIME * new_samplerate / resampler->bufsize;
Expand All @@ -163,9 +162,10 @@ ow_resampler_reset_dll (struct ow_resampler *resampler,
ow_dll_primary_reset (&resampler->dll, new_samplerate, OB_SAMPLE_RATE,
resampler->bufsize,
resampler->engine->frames_per_transfer);
ow_engine_set_status (resampler->engine, OW_ENGINE_STATUS_READY);
}

ow_engine_set_status (resampler->engine, OW_ENGINE_STATUS_BOOT);
resampler->status = OW_RESAMPLER_STATUS_READY;
resampler->o2p_ratio = resampler->dll.ratio;
resampler->samplerate = new_samplerate;
}
Expand Down

0 comments on commit b82ba3d

Please sign in to comment.