summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-13 20:22:15 +0000
committerDavid Robillard <d@drobilla.net>2012-08-13 20:22:15 +0000
commit905cd5e70f449738c953ff84a0c935f9c0e4828e (patch)
treef5b4833233451aa8f01b88666b88e64df32ffa7e /test
parent5186e3ec711248ae356cac2785a245c063236239 (diff)
downloadraul-905cd5e70f449738c953ff84a0c935f9c0e4828e.tar.gz
raul-905cd5e70f449738c953ff84a0c935f9c0e4828e.tar.bz2
raul-905cd5e70f449738c953ff84a0c935f9c0e4828e.zip
Move SMF stuff from Raul to Machina.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4683 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/smf_test.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/test/smf_test.cpp b/test/smf_test.cpp
deleted file mode 100644
index 680f66b..0000000
--- a/test/smf_test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- This file is part of Raul.
- Copyright 2007-2012 David Robillard <http://drobilla.net>
-
- Raul is free software: you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or any later version.
-
- Raul is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Raul. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <iostream>
-#include <string>
-#include "raul/log.hpp"
-#include "raul/SMFReader.hpp"
-#include "raul/SMFWriter.hpp"
-
-using namespace std;
-using namespace Raul;
-
-int
-main(int argc, char** argv)
-{
-#define CHECK(cond) \
- do { if (!(cond)) { \
- error << "Test at " << __FILE__ << ":" << __LINE__ << " failed: " << __STRING(cond) << endl; \
- return 1; \
- } } while (0)
-
- static const uint16_t ppqn = 19200;
-
- const char* filename = NULL;
-
- if (argc < 2) {
- filename = "./test.mid";
- SMFWriter writer(TimeUnit(TimeUnit::BEATS, ppqn));
- writer.start(string(filename), TimeStamp(writer.unit(), 0, 0));
- writer.finish();
- } else {
- filename = argv[1];
- }
-
- SMFReader reader;
- bool opened = reader.open(filename);
-
- if (!opened) {
- cerr << "Unable to open SMF file " << filename << endl;
- return -1;
- }
-
- CHECK(reader.type() == 0);
- CHECK(reader.num_tracks() == 1);
- CHECK(reader.ppqn() == ppqn);
-
- for (unsigned t=1; t <= reader.num_tracks(); ++t) {
- reader.seek_to_track(t);
-
- unsigned char buf[4];
- uint32_t ev_size;
- uint32_t ev_delta_time;
- while (reader.read_event(4, buf, &ev_size, &ev_delta_time) >= 0) {
-
- cout << t << ": Event, size = " << ev_size << ", time = " << ev_delta_time;
- cout << ":\t";
- cout.flags(ios::hex);
- for (uint32_t i=0; i < ev_size; ++i) {
- cout << "0x" << static_cast<int>(buf[i]) << " ";
- }
- cout.flags(ios::dec);
- cout << endl;
- }
- }
-
- return 0;
-}