aboutsummaryrefslogtreecommitdiff
path: root/engines/testbed
diff options
context:
space:
mode:
authorNeeraj Kumar2010-08-05 21:36:17 +0000
committerNeeraj Kumar2010-08-05 21:36:17 +0000
commit6c0855f3d3efc52478ba9ce019fbd4c9287f4691 (patch)
treedd0e4a302be50f89d693d045dc758b48480c11f5 /engines/testbed
parentfee1bb28bd54f77edbe1e85135384ba9d1af9fa2 (diff)
downloadscummvm-rg350-6c0855f3d3efc52478ba9ce019fbd4c9287f4691.tar.gz
scummvm-rg350-6c0855f3d3efc52478ba9ce019fbd4c9287f4691.tar.bz2
scummvm-rg350-6c0855f3d3efc52478ba9ce019fbd4c9287f4691.zip
TESTBED: playing audio output with variable sample rates
svn-id: r51766
Diffstat (limited to 'engines/testbed')
-rw-r--r--engines/testbed/detection.cpp2
-rw-r--r--engines/testbed/sound.cpp45
-rw-r--r--engines/testbed/sound.h1
3 files changed, 47 insertions, 1 deletions
diff --git a/engines/testbed/detection.cpp b/engines/testbed/detection.cpp
index b0e3c4693b..6267be7f06 100644
--- a/engines/testbed/detection.cpp
+++ b/engines/testbed/detection.cpp
@@ -43,7 +43,7 @@ static const ADGameDescription testbedDescriptions[] = {
"",
AD_ENTRY1(NULL, 0), // No data files required
Common::EN_ANY,
- Common::kPlatformLinux,
+ Common::kPlatformPC,
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
index c2e0d434c0..89aede7ef8 100644
--- a/engines/testbed/sound.cpp
+++ b/engines/testbed/sound.cpp
@@ -210,10 +210,55 @@ bool SoundSubsystem::audiocdOutput() {
return passed;
}
+bool SoundSubsystem::sampleRates() {
+ bool passed = true;
+ Audio::Mixer *mixer = g_system->getMixer();
+
+ Audio::PCSpeaker *s1 = new Audio::PCSpeaker();
+ // Stream at half sampling rate
+ Audio::PCSpeaker *s2 = new Audio::PCSpeaker(s1->getRate() - 10000);
+ // Stream at twice sampling rate
+ Audio::PCSpeaker *s3 = new Audio::PCSpeaker(s1->getRate() + 10000);
+
+ s1->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
+ s2->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
+ s3->play(Audio::PCSpeaker::kWaveFormSine, 1000, -1);
+
+ Audio::SoundHandle handle;
+ Common::Point pt(0, 100);
+
+ mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, s1);
+ Testsuite::writeOnScreen(Common::String::printf("Playing at smaple rate: %d", s1->getRate()), pt);
+ g_system->delayMillis(1000);
+ mixer->stopHandle(handle);
+ g_system->delayMillis(1000);
+
+ mixer->playStream(Audio::Mixer::kSpeechSoundType, &handle, s2);
+ Testsuite::writeOnScreen(Common::String::printf("Playing at sample rate : %d", s2->getRate()), pt);
+ g_system->delayMillis(1000);
+ mixer->stopHandle(handle);
+ g_system->delayMillis(1000);
+
+ mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, s3);
+ Testsuite::writeOnScreen(Common::String::printf("Playing at sample rate : %d", s3->getRate()), pt);
+ g_system->delayMillis(1000);
+ mixer->stopHandle(handle);
+ g_system->delayMillis(1000);
+
+ Testsuite::clearScreen();
+ if (Testsuite::handleInteractiveInput("Was the mixer able to play beeps with variable sample rates?", "Yes", "No", kOptionRight)) {
+ Testsuite::logDetailedPrintf("Error! Error with variable sample rates\n");
+ passed = false;
+ }
+
+ return passed;
+}
+
SoundSubsystemTestSuite::SoundSubsystemTestSuite() {
addTest("SimpleBeeps", &SoundSubsystem::playBeeps, true);
addTest("MixSounds", &SoundSubsystem::mixSounds, true);
addTest("AudiocdOutput", &SoundSubsystem::audiocdOutput, true);
+ addTest("SampleRates", &SoundSubsystem::sampleRates, true);
}
} // End of namespace Testbed
diff --git a/engines/testbed/sound.h b/engines/testbed/sound.h
index 1507c4543d..53ff96cedb 100644
--- a/engines/testbed/sound.h
+++ b/engines/testbed/sound.h
@@ -49,6 +49,7 @@ namespace SoundSubsystem {
bool playBeeps();
bool mixSounds();
bool audiocdOutput();
+bool sampleRates();
}
class SoundSubsystemTestSuite : public Testsuite {