summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-04-16 21:38:33 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-04-16 21:38:33 -0600
commit70e27e0bf218c6d135d6fcf539ea169b9241f545 (patch)
tree8a3a5d424f9dd6c0bf75826ba1eed2da40deaf93
parente4e035c6e2d080fe62d933255c796f741a4a7c10 (diff)
fix Beats::operator-()
-rw-r--r--libs/temporal/temporal/beats.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/temporal/temporal/beats.h b/libs/temporal/temporal/beats.h
index 5c8538641a..a7c8696db3 100644
--- a/libs/temporal/temporal/beats.h
+++ b/libs/temporal/temporal/beats.h
@@ -228,7 +228,14 @@ public:
}
Beats operator-() const {
- return Beats(-_beats, -_ticks);
+ /* must avoid normalization here, which will convert a negative
+ value into a valid beat position before zero, which is not
+ we want here.
+ */
+ Beats b (_beats, _ticks);
+ b._beats = -b._beats;
+ b._ticks = -b._ticks;
+ return b;
}
template<typename Number>