mirror of
https://github.com/TomHarte/CLK.git
synced 2025-10-25 09:27:01 +00:00
Made very first attempt at closing the loop on this. But it's time for work.
This commit is contained in:
@@ -29,6 +29,18 @@ void TimedEventLoop::reset_timer()
|
||||
_stepper.reset();
|
||||
}
|
||||
|
||||
void TimedEventLoop::reset_timer_to_offset(Time offset)
|
||||
{
|
||||
unsigned int common_clock_rate = NumberTheory::least_common_multiple(offset.clock_rate, _event_interval.clock_rate);
|
||||
_time_into_interval = offset.length * (common_clock_rate / offset.clock_rate);
|
||||
_event_interval.length *= common_clock_rate / _event_interval.clock_rate;
|
||||
_event_interval.clock_rate = common_clock_rate;
|
||||
if(common_clock_rate != _stepper->get_output_rate())
|
||||
{
|
||||
_stepper.reset(new SignalProcessing::Stepper(_event_interval.clock_rate, _input_clock_rate));
|
||||
}
|
||||
}
|
||||
|
||||
void TimedEventLoop::jump_to_next_event()
|
||||
{
|
||||
reset_timer();
|
||||
|
||||
Reference in New Issue
Block a user