summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-03-09 22:28:33 +0000
committerDavid Robillard <d@drobilla.net>2007-03-09 22:28:33 +0000
commit8b6b314cce7a721e828ecb022f2b5400aa05c07c (patch)
treebef7ba6a7208d3006b790733dfc6f881c27eab8b /tests
parentb2aae23b3443a75cf163c3ee7a1c1477394fbc80 (diff)
downloadraul-8b6b314cce7a721e828ecb022f2b5400aa05c07c.tar.gz
raul-8b6b314cce7a721e828ecb022f2b5400aa05c07c.tar.bz2
raul-8b6b314cce7a721e828ecb022f2b5400aa05c07c.zip
SMF reading/writing fixes.
git-svn-id: http://svn.drobilla.net/lad/raul@345 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/smf_test.cpp41
2 files changed, 44 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9e8e6c8..cbc3582 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@ 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 time_test quantize_test
+bin_PROGRAMS = path_test thread_test queue_test atomic_test list_test time_test quantize_test smf_test
thread_test_LDADD = $(ALL_LIBS)
path_test_LDADD = $(ALL_LIBS)
@@ -12,6 +12,7 @@ atomic_test_LDADD = $(ALL_LIBS)
list_test_LDADD = $(ALL_LIBS)
time_test_LDADD = $(ALL_LIBS)
quantize_test_LDADD = $(ALL_LIBS)
+smf_test_LDADD = $(ALL_LIBS)
path_test_SOURCES = path_test.cpp
thread_test_SOURCES = thread_test.cpp
@@ -20,5 +21,6 @@ atomic_test_SOURCES = atomic_test.cpp
list_test_SOURCES = list_test.cpp
time_test_SOURCES = time_test.cpp
quantize_test_SOURCES = quantize_test.cpp
+smf_test_SOURCES = smf_test.cpp
endif
diff --git a/tests/smf_test.cpp b/tests/smf_test.cpp
new file mode 100644
index 0000000..84f61cc
--- /dev/null
+++ b/tests/smf_test.cpp
@@ -0,0 +1,41 @@
+#include <iostream>
+#include <string>
+#include <raul/SMFReader.h>
+#include <raul/SMFWriter.h>
+
+using namespace std;
+using namespace Raul;
+
+
+int
+main(int argc, char** argv)
+{
+ char* filename = NULL;
+
+ if (argc < 2) {
+ filename = "./test.mid";
+ SMFWriter writer(32768);
+ writer.start(string(filename));
+ writer.finish();
+ cout << "Wrote " << filename << " with PPQN = " << writer.ppqn() << endl;
+
+ } else {
+ filename = argv[1];
+ }
+
+
+ SMFReader reader;
+ bool opened = reader.open(filename);
+
+ if (!opened) {
+ cerr << "Unable to open SMF file " << filename << endl;
+ return -1;
+ }
+
+ cout << "Opened SMF file " << filename << endl;
+
+ cout << "Num tracks: " << reader.num_tracks() << endl;
+ cout << "PPQN: " << reader.ppqn() << endl;
+
+ return 0;
+}