[Scummvm-cvs-logs] SF.net SVN: scummvm:[51515] scummvm/branches/gsoc2010-testbed/engines/ testbed
sud03r at users.sourceforge.net
sud03r at users.sourceforge.net
Fri Jul 30 22:10:31 CEST 2010
Revision: 51515
http://scummvm.svn.sourceforge.net/scummvm/?rev=51515&view=rev
Author: sud03r
Date: 2010-07-30 20:10:30 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
TESTBED: added code to enable the mixer to simultaneously play channels, pause/unpause some of them using GUI, couple of fixes as well
Modified Paths:
--------------
scummvm/branches/gsoc2010-testbed/engines/testbed/fs.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h
scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/fs.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/fs.cpp 2010-07-30 18:45:28 UTC (rev 51514)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/fs.cpp 2010-07-30 20:10:30 UTC (rev 51515)
@@ -88,6 +88,7 @@
dirName.toLowercase();
fileName.toLowercase();
+ delete directory;
directory = gameRoot.getSubDirectory(dirName);
if (!readDataFromFile(directory, fileName.c_str())) {
@@ -97,12 +98,14 @@
dirName.toUppercase();
fileName.toUppercase();
+ delete directory;
directory = gameRoot.getSubDirectory(dirName);
if (!readDataFromFile(directory, fileName.c_str())) {
Testsuite::logDetailedPrintf("Reading from %s/%s failed\n", dirName.c_str(), fileName.c_str());
numFailed++;
}
+ delete directory;
}
Testsuite::logDetailedPrintf("Failed %d out of 15\n", numFailed);
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp 2010-07-30 18:45:28 UTC (rev 51514)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp 2010-07-30 20:10:30 UTC (rev 51515)
@@ -22,10 +22,10 @@
* $Id$
*/
-#include "sound/mixer.h"
-#include "testbed/sound.h"
#include "sound/softsynth/pcspk.h"
+#include "testbed/sound.h"
+
namespace Testbed {
enum {
@@ -46,54 +46,109 @@
addButton(200, 20, "Play Channel #2", kPlayChannel2);
addButton(200, 20, "Play Channel #3", kPlayChannel3);
addButton(50, 20, "Close", GUI::kCloseCmd, 160, 15);
+
+ _mixer = g_system->getMixer();
+
+ // the three streams to be mixed
+ Audio::PCSpeaker *s1 = new Audio::PCSpeaker();
+ Audio::PCSpeaker *s2 = new Audio::PCSpeaker();
+ Audio::PCSpeaker *s3 = new Audio::PCSpeaker();
+
+ s1->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
+ s2->play(Audio::PCSpeaker::kWaveFormSquare, 500, -1);
+ s3->play(Audio::PCSpeaker::kWaveFormSaw, 200, -1);
+
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_h1, s1);
+ _mixer->pauseHandle(_h1, true);
+
+ _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_h2, s2);
+ _mixer->pauseHandle(_h2, true);
+
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_h3, s3);
+ _mixer->pauseHandle(_h3, true);
+
}
void SoundSubsystemDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
+
switch (cmd) {
case kPlayChannel1:
_buttonArray[0]->setLabel("Pause Channel #1");
_buttonArray[0]->setCmd(kPauseChannel1);
- // TODO: Play music #1 here
+ _mixer->pauseHandle(_h1, false);
break;
case kPlayChannel2:
_buttonArray[1]->setLabel("Pause Channel #2");
_buttonArray[1]->setCmd(kPauseChannel2);
+ _mixer->pauseHandle(_h2, false);
break;
case kPlayChannel3:
_buttonArray[2]->setLabel("Pause Channel #3");
_buttonArray[2]->setCmd(kPauseChannel3);
+ _mixer->pauseHandle(_h3, false);
break;
case kPauseChannel1:
_buttonArray[0]->setLabel("Play Channel #1");
_buttonArray[0]->setCmd(kPlayChannel1);
+ _mixer->pauseHandle(_h1, true);
break;
case kPauseChannel2:
_buttonArray[1]->setLabel("Play Channel #2");
_buttonArray[1]->setCmd(kPlayChannel2);
+ _mixer->pauseHandle(_h2, true);
break;
case kPauseChannel3:
_buttonArray[2]->setLabel("Play Channel #3");
_buttonArray[2]->setCmd(kPlayChannel3);
+ _mixer->pauseHandle(_h3, true);
break;
default:
+ _mixer->stopAll();
GUI::Dialog::handleCommand(sender, cmd, data);
}
}
-bool SoundSubsystem::playPCSpkSound() {
+bool SoundSubsystem::playBeeps() {
+ Testsuite::clearScreen();
+ bool passed = true;
+ Common::String info = "Testing Sound Output by generating beeps\n"
+ "You should hear a left beep followed by a right beep\n";
+
+ if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+ Testsuite::logPrintf("Info! Skipping test : Play Beeps\n");
+ return true;
+ }
+
Audio::PCSpeaker *speaker = new Audio::PCSpeaker();
Audio::Mixer *mixer = g_system->getMixer();
Audio::SoundHandle handle;
mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, speaker);
+
+ // Left Beep
+ Testsuite::writeOnScreen("Left Beep", Common::Point(0, 100));
+ mixer->setChannelBalance(handle, -127);
speaker->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
- g_system->delayMillis(1000);
- mixer->setChannelBalance(handle, -127);
- g_system->delayMillis(1000);
+ g_system->delayMillis(500);
+ mixer->pauseHandle(handle, true);
+
+ if (Testsuite::handleInteractiveInput("Were you able to hear the left beep?", "Yes", "No", kOptionRight)) {
+ Testsuite::logDetailedPrintf("Error! Left Beep couldn't be detected : Error with Mixer::setChannelBalance()\n");
+ passed = false;
+ }
+
+ // Right Beep
+ Testsuite::writeOnScreen("Right Beep", Common::Point(0, 100));
mixer->setChannelBalance(handle, 127);
- g_system->delayMillis(1000);
+ mixer->pauseHandle(handle, false);
+ g_system->delayMillis(500);
mixer->stopAll();
- return true;
+
+ if (Testsuite::handleInteractiveInput("Were you able to hear the right beep?", "Yes", "No", kOptionRight)) {
+ Testsuite::logDetailedPrintf("Error! Right Beep couldn't be detected : Error with Mixer::setChannelBalance()\n");
+ passed = false;
+ }
+ return passed;
}
bool SoundSubsystem::mixSounds() {
@@ -103,7 +158,7 @@
}
SoundSubsystemTestSuite::SoundSubsystemTestSuite() {
- addTest("PCSpkrSound", &SoundSubsystem::playPCSpkSound, true);
+ addTest("SimpleBeeps", &SoundSubsystem::playBeeps, true);
addTest("MixSounds", &SoundSubsystem::mixSounds, true);
}
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h 2010-07-30 18:45:28 UTC (rev 51514)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h 2010-07-30 20:10:30 UTC (rev 51515)
@@ -26,6 +26,7 @@
#define TESTBED_SOUND_H
#include "gui/dialog.h"
+#include "sound/mixer.h"
#include "testbed/config.h"
#include "testbed/testsuite.h"
@@ -36,6 +37,8 @@
SoundSubsystemDialog();
~SoundSubsystemDialog() {}
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _h1, _h2, _h3;
};
namespace SoundSubsystem {
@@ -43,7 +46,7 @@
// Helper functions for SoundSubsystem tests
// will contain function declarations for SoundSubsystem tests
-bool playPCSpkSound();
+bool playBeeps();
bool mixSounds();
}
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp 2010-07-30 18:45:28 UTC (rev 51514)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp 2010-07-30 20:10:30 UTC (rev 51515)
@@ -296,6 +296,7 @@
}
g_system->copyRectToScreen(buffer, wRect, pt.x, pt.y, wRect, lRect);
g_system->updateScreen();
+ delete[] buffer;
}
bool Testsuite::enableTest(const Common::String &testName, bool toEnable) {
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