[Scummvm-cvs-logs] SF.net SVN: scummvm:[51957] scummvm/branches/gsoc2010-testbed/engines/ testbed

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Tue Aug 10 22:20:28 CEST 2010


Revision: 51957
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51957&view=rev
Author:   sud03r
Date:     2010-08-10 20:20:28 +0000 (Tue, 10 Aug 2010)

Log Message:
-----------
TESTBED: basic template for midi tests

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
    scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp

Added Paths:
-----------
    scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h

Added: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp	2010-08-10 20:20:28 UTC (rev 51957)
@@ -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);
+}
+
+}


Property changes on: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h	2010-08-10 20:20:28 UTC (rev 51957)
@@ -0,0 +1,68 @@
+/* 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$
+ */
+
+#ifndef TESTBED_MIDI_H
+#define TESTBED_MIDI_H
+
+#include "testbed/testsuite.h"
+
+// This file can be used as template for header files of other newer testsuites.
+
+namespace Testbed {
+
+namespace MidiTests {
+
+// Helper functions for MIDI tests
+
+// will contain function declarations for MIDI tests
+// add more here
+TestExitStatus playMidiMusic();
+
+} // End of namespace MIDItests
+
+class MidiTestSuite : public Testsuite {
+public:
+	/**
+	 * The constructor for the XXXTestSuite
+	 * For every test to be executed one must:
+	 * 1) Create a function that would invoke the test
+	 * 2) Add that test to list by executing addTest()
+	 *
+	 * @see addTest()
+	 */
+	MidiTestSuite();
+	~MidiTestSuite() {}
+	const char *getName() const {
+		return "MIDI";
+	}
+	
+	const char *getDescription() const {
+		return "Midi Music";
+	}
+
+};
+
+} // End of namespace Testbed
+
+#endif // TESTBED_MIDI_H


Property changes on: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-08-10 18:05:04 UTC (rev 51956)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-08-10 20:20:28 UTC (rev 51957)
@@ -6,6 +6,7 @@
 	events.o \
 	fs.o \
 	graphics.o \
+	midi.o \
 	misc.o \
 	savegame.o \
 	sound.o \

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-08-10 18:05:04 UTC (rev 51956)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-08-10 20:20:28 UTC (rev 51957)
@@ -31,6 +31,7 @@
 #include "testbed/events.h"
 #include "testbed/fs.h"
 #include "testbed/graphics.h"
+#include "testbed/midi.h"
 #include "testbed/misc.h"
 #include "testbed/savegame.h"
 #include "testbed/sound.h"
@@ -121,6 +122,9 @@
 	// Sound
 	ts = new SoundSubsystemTestSuite();
 	_testsuiteList.push_back(ts);
+	// Midi
+	ts = new MidiTestSuite();
+	_testsuiteList.push_back(ts);
 }
 
 TestbedEngine::~TestbedEngine() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list