summaryrefslogtreecommitdiffstats
path: root/test/quantize_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/quantize_test.cpp')
-rw-r--r--test/quantize_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/quantize_test.cpp b/test/quantize_test.cpp
new file mode 100644
index 0000000..39ba899
--- /dev/null
+++ b/test/quantize_test.cpp
@@ -0,0 +1,25 @@
+#include "raul/Quantizer.hpp"
+#include <iostream>
+
+using namespace std;
+using namespace Raul;
+
+
+int
+main()
+{
+ TimeStamp q(TimeUnit(TimeUnit::BEATS, 19200), 0.25);
+
+ for (double in = 0.0; in < 32; in += 0.23) {
+ TimeStamp beats(TimeUnit(TimeUnit::BEATS, 19200), in);
+
+ cout << "Q(" << in << ", 1/4) = "
+ << Quantizer::quantize(q, beats) << endl;
+
+ if (Quantizer::quantize(q, beats).subticks() % (19200/4) != 0)
+ return 1;
+ }
+
+ return 0;
+}
+