*/
#include <cmath>
+#include <cassert>
#include "timecode/bbt_time.h"
using namespace Timecode;
+/* This defines the smallest division of a "beat".
+
+ The number is intended to have as many integer factors as possible so that
+ 1/Nth divisions are integer numbers of ticks.
+
+ 1920 has many factors, though going up to 3840 gets a couple more.
+*/
+
const double BBT_Time::ticks_per_beat = 1920.0;
BBT_Time::BBT_Time (double dbeats)
always be zero.
*/
+ assert (dbeats >= 0);
+
bars = 0;
- beats = rint (floor (dbeats));
- ticks = rint (floor (BBT_Time::ticks_per_beat * fmod (dbeats, 1.0)));
+ beats = lrint (floor (dbeats));
+ ticks = lrint (floor (BBT_Time::ticks_per_beat * fmod (dbeats, 1.0)));
}