From 2cef260f92785971d7d61489c2278ad7afae0dd7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 21 Feb 2007 02:30:09 +0000 Subject: Tempo based time in Machina (and related utilities added to Raul). git-svn-id: http://svn.drobilla.net/lad/raul@324 a436a847-0d15-0410-975c-d299462d15a1 --- tests/Makefile.am | 4 +++- tests/time_test.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/time_test.cpp (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 9ae9810..05b0f21 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,18 +3,20 @@ if BUILD_TESTS AM_CXXFLAGS = -I.. -lpthread @RASQAL_CFLAGS@ @GLIBMM_CFLAGS@ ALL_LIBS = @RASQAL_LIBS@ @GLIBMM_LIBS@ ../src/libraul.la -bin_PROGRAMS = path_test thread_test queue_test atomic_test list_test +bin_PROGRAMS = path_test thread_test queue_test atomic_test list_test time_test thread_test_LDADD = $(ALL_LIBS) path_test_LDADD = $(ALL_LIBS) queue_test_LDADD = $(ALL_LIBS) atomic_test_LDADD = $(ALL_LIBS) list_test_LDADD = $(ALL_LIBS) +time_test_LDADD = $(ALL_LIBS) path_test_SOURCES = path_test.cpp thread_test_SOURCES = thread_test.cpp queue_test_SOURCES = queue_test.cpp atomic_test_SOURCES = atomic_test.cpp list_test_SOURCES = list_test.cpp +time_test_SOURCES = time_test.cpp endif diff --git a/tests/time_test.cpp b/tests/time_test.cpp new file mode 100644 index 0000000..0eb0a83 --- /dev/null +++ b/tests/time_test.cpp @@ -0,0 +1,29 @@ +#include +#include + +using namespace std; +using namespace Raul; + + +int +main() +{ + TimeSlice ts(1/48000.0, 120); + + string in_string; + double in_double = 0; + + cout << "Beats: "; + cin >> in_double; + + cout << "\tSeconds: "; + cout << ts.beats_to_seconds(in_double); + cout << endl; + + cout << "\tTicks: "; + cout << ts.beats_to_ticks(in_double); + cout << endl; + + return 0; +} + -- cgit v1.2.1