[Scummvm-cvs-logs] SF.net SVN: scummvm:[51766] scummvm/branches/gsoc2010-testbed/engines/ testbed
sud03r at users.sourceforge.net
sud03r at users.sourceforge.net
Thu Aug 5 23:36:17 CEST 2010
Revision: 51766
http://scummvm.svn.sourceforge.net/scummvm/?rev=51766&view=rev
Author: sud03r
Date: 2010-08-05 21:36:17 +0000 (Thu, 05 Aug 2010)
Log Message:
-----------
TESTBED: playing audio output with variable sample rates
Modified Paths:
--------------
scummvm/branches/gsoc2010-testbed/engines/testbed/detection.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/detection.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/detection.cpp 2010-08-05 20:54:48 UTC (rev 51765)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/detection.cpp 2010-08-05 21:36:17 UTC (rev 51766)
@@ -43,7 +43,7 @@
"",
AD_ENTRY1(NULL, 0), // No data files required
Common::EN_ANY,
- Common::kPlatformLinux,
+ Common::kPlatformPC,
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp 2010-08-05 20:54:48 UTC (rev 51765)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp 2010-08-05 21:36:17 UTC (rev 51766)
@@ -210,10 +210,55 @@
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
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h 2010-08-05 20:54:48 UTC (rev 51765)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h 2010-08-05 21:36:17 UTC (rev 51766)
@@ -49,6 +49,7 @@
bool playBeeps();
bool mixSounds();
bool audiocdOutput();
+bool sampleRates();
}
class SoundSubsystemTestSuite : public Testsuite {
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