aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeeraj Kumar2010-07-26 20:59:50 +0000
committerNeeraj Kumar2010-07-26 20:59:50 +0000
commit39780f4a6801091fc680c7d55d2a1f7a0a4356be (patch)
treeba86bfb614dbd77e2755c9fe014d30c77b12c136
parenta9941138dadd796ca2a8fbd6e2c9c66436a48c4b (diff)
downloadscummvm-rg350-39780f4a6801091fc680c7d55d2a1f7a0a4356be.tar.gz
scummvm-rg350-39780f4a6801091fc680c7d55d2a1f7a0a4356be.tar.bz2
scummvm-rg350-39780f4a6801091fc680c7d55d2a1f7a0a4356be.zip
TESTBED: implemented some sample beeps using PCSpeaker emulator for testing sound subsystem
svn-id: r51333
-rw-r--r--engines/testbed/module.mk1
-rw-r--r--engines/testbed/sound.cpp50
-rw-r--r--engines/testbed/sound.h65
-rw-r--r--engines/testbed/template.h8
-rw-r--r--engines/testbed/testbed.cpp4
5 files changed, 127 insertions, 1 deletions
diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk
index d66242d37a..4c530e412a 100644
--- a/engines/testbed/module.mk
+++ b/engines/testbed/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
graphics.o \
misc.o \
savegame.o \
+ sound.o \
testbed.o \
testsuite.o
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
new file mode 100644
index 0000000000..671f720be5
--- /dev/null
+++ b/engines/testbed/sound.cpp
@@ -0,0 +1,50 @@
+/* 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/mixer.h"
+#include "testbed/sound.h"
+#include "sound/softsynth/pcspk.h"
+
+namespace Testbed {
+
+bool SoundSubsystem::playPCSpkSound() {
+ Audio::PCSpeaker *speaker = new Audio::PCSpeaker();
+ Audio::Mixer *mixer = g_system->getMixer();
+ Audio::SoundHandle handle;
+ mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, speaker);
+ speaker->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
+ g_system->delayMillis(1000);
+ mixer->setChannelBalance(handle, -127);
+ g_system->delayMillis(1000);
+ mixer->setChannelBalance(handle, 127);
+ g_system->delayMillis(1000);
+ mixer->stopAll();
+ return true;
+}
+
+SoundSubsystemTestSuite::SoundSubsystemTestSuite() {
+ addTest("PCSpkrSound", &SoundSubsystem::playPCSpkSound, true);
+}
+
+} // End of namespace Testbed
diff --git a/engines/testbed/sound.h b/engines/testbed/sound.h
new file mode 100644
index 0000000000..4078bbcac3
--- /dev/null
+++ b/engines/testbed/sound.h
@@ -0,0 +1,65 @@
+/* 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_SOUND_H
+#define TESTBED_SOUND_H
+
+#include "testbed/testsuite.h"
+
+namespace Testbed {
+
+namespace SoundSubsystem {
+
+// Helper functions for SoundSubsystem tests
+
+// will contain function declarations for SoundSubsystem tests
+bool playPCSpkSound();
+}
+
+class SoundSubsystemTestSuite : public Testsuite {
+public:
+ /**
+ * The constructor for the SoundSubsystemTestSuite
+ * 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()
+ */
+ SoundSubsystemTestSuite();
+ ~SoundSubsystemTestSuite() {}
+
+ const char *getName() const {
+ return "SoundSubsystem";
+ }
+
+ const char *getDescription() const {
+ return "Sound Subsystem";
+ }
+
+};
+
+} // End of namespace Testbed
+
+#endif // TESTBED_SOUND_H
diff --git a/engines/testbed/template.h b/engines/testbed/template.h
index 6ce5c78344..a2efca1157 100644
--- a/engines/testbed/template.h
+++ b/engines/testbed/template.h
@@ -52,7 +52,13 @@ public:
*/
XXXTestSuite();
~XXXTestSuite() {}
- const char *getName() const;
+ const char *getName() const {
+ return "Dummy Template";
+ }
+
+ const char *getDescription() const {
+ return "Some Arbit description";
+ }
};
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index bdf8badaa5..7eeb33a70d 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -34,6 +34,7 @@
#include "testbed/graphics.h"
#include "testbed/misc.h"
#include "testbed/savegame.h"
+#include "testbed/sound.h"
#include "testbed/testbed.h"
namespace Testbed {
@@ -72,6 +73,9 @@ TestbedEngine::TestbedEngine(OSystem *syst)
// Events
ts = new EventTestSuite();
_testsuiteList.push_back(ts);
+ // Sound
+ ts = new SoundSubsystemTestSuite();
+ _testsuiteList.push_back(ts);
}
TestbedEngine::~TestbedEngine() {