From 617fcd660cf661d47ca883f66308a2451412afbe Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 3 Dec 2018 09:05:22 -0500 Subject: [PATCH] add operator% and operator%= to Temporal::Beats (taken from nutempo) --- libs/temporal/temporal/beats.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/temporal/temporal/beats.h b/libs/temporal/temporal/beats.h index 757f0c8771..112da15008 100644 --- a/libs/temporal/temporal/beats.h +++ b/libs/temporal/temporal/beats.h @@ -255,6 +255,17 @@ public: return ticks ((_beats * PPQN + _ticks) / factor); } + Beats operator% (Beats const & b) { + return Beats::ticks (to_ticks() % b.to_ticks()); + } + + Beats operator%= (Beats const & b) { + const Beats B (Beats::ticks (to_ticks() % b.to_ticks())); + _beats = B._beats; + _ticks = B._ticks; + return *this; + } + Beats& operator+=(const Beats& b) { _beats += b._beats; _ticks += b._ticks;