aboutsummaryrefslogtreecommitdiff
path: root/engines/testbed/midi.cpp
diff options
context:
space:
mode:
authorNeeraj Kumar2010-08-10 20:20:28 +0000
committerNeeraj Kumar2010-08-10 20:20:28 +0000
commit32553308cffd5d2f936f6143e89db703afeb0036 (patch)
tree2a3dd7d9278bf7ab404a88c774ddccdcbb968be8 /engines/testbed/midi.cpp
parentacb32580ce440aa687309999ed11ee6e5ca1fa72 (diff)
downloadscummvm-rg350-32553308cffd5d2f936f6143e89db703afeb0036.tar.gz
scummvm-rg350-32553308cffd5d2f936f6143e89db703afeb0036.tar.bz2
scummvm-rg350-32553308cffd5d2f936f6143e89db703afeb0036.zip
TESTBED: basic template for midi tests
svn-id: r51957
Diffstat (limited to 'engines/testbed/midi.cpp')
-rw-r--r--engines/testbed/midi.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/engines/testbed/midi.cpp b/engines/testbed/midi.cpp
new file mode 100644
index 0000000000..bdc1314804
--- /dev/null
+++ b/engines/testbed/midi.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "sound/mididrv.h"
+#include "sound/midiparser.h"
+#include "testbed/midi.h"
+
+namespace Testbed {
+
+TestExitStatus MidiTests::playMidiMusic() {
+ MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
+ // Create a driver instance
+ MidiDriver *driver = MidiDriver::createMidi(dev);
+ // Create a SMF parser
+ MidiParser *smfParser = MidiParser::createParser_SMF();
+ smfParser->setMidiDriver(driver);
+ smfParser->setTimerRate(driver->getBaseTempo());
+ // Open the driver
+ int errCode = driver->open();
+
+ if (errCode) {
+ Testsuite::logPrintf("Error! %s", driver->getErrorName(errCode));
+ return kTestFailed;
+ }
+
+ Testsuite::logDetailedPrintf("Midi: Succesfully opened the driver\n");
+ return kTestPassed;
+}
+
+MidiTestSuite::MidiTestSuite() {
+ addTest("MidiTests", &MidiTests::playMidiMusic);
+}
+
+}