[Scummvm-git-logs] scummvm master -> 4e7723f77df9b2a6f00197cc55515b83969b0957

sev- sev at scummvm.org
Thu Nov 11 11:26:38 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4e7723f77d TESTBED: Added test for MOD playback. Added XM and IT files from SLUDGE's "Out Of Order"


Commit: 4e7723f77df9b2a6f00197cc55515b83969b0957
    https://github.com/scummvm/scummvm/commit/4e7723f77df9b2a6f00197cc55515b83969b0957
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-11T12:26:08+01:00

Commit Message:
TESTBED: Added test for MOD playback. Added XM and IT files from SLUDGE's "Out Of Order"

Changed paths:
  A dists/engine-data/testbed-audiocd-files/music0077.it
  A dists/engine-data/testbed-audiocd-files/music0078.it
  A dists/engine-data/testbed-audiocd-files/music0167.xm
  A dists/engine-data/testbed-audiocd-files/music0360.xm
    engines/testbed/sound.cpp
    engines/testbed/sound.h


diff --git a/dists/engine-data/testbed-audiocd-files/music0077.it b/dists/engine-data/testbed-audiocd-files/music0077.it
new file mode 100644
index 0000000000..7dcb69db2f
Binary files /dev/null and b/dists/engine-data/testbed-audiocd-files/music0077.it differ
diff --git a/dists/engine-data/testbed-audiocd-files/music0078.it b/dists/engine-data/testbed-audiocd-files/music0078.it
new file mode 100644
index 0000000000..7a2bab0a1f
Binary files /dev/null and b/dists/engine-data/testbed-audiocd-files/music0078.it differ
diff --git a/dists/engine-data/testbed-audiocd-files/music0167.xm b/dists/engine-data/testbed-audiocd-files/music0167.xm
new file mode 100644
index 0000000000..f01dbee582
Binary files /dev/null and b/dists/engine-data/testbed-audiocd-files/music0167.xm differ
diff --git a/dists/engine-data/testbed-audiocd-files/music0360.xm b/dists/engine-data/testbed-audiocd-files/music0360.xm
new file mode 100644
index 0000000000..ea509fc468
Binary files /dev/null and b/dists/engine-data/testbed-audiocd-files/music0360.xm differ
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
index 998afbf7db..62d36354cc 100644
--- a/engines/testbed/sound.cpp
+++ b/engines/testbed/sound.cpp
@@ -21,10 +21,13 @@
  */
 
 #include "audio/softsynth/pcspk.h"
+#include "audio/mods/mod_xm_s3m.h"
 
 #include "backends/audiocd/audiocd.h"
 
 #include "common/config-manager.h"
+#include "common/events.h"
+#include "common/file.h"
 
 #include "testbed/sound.h"
 
@@ -173,6 +176,79 @@ TestExitStatus SoundSubsystem::mixSounds() {
 	return passed;
 }
 
+const char *music[] = {
+	"music0167.xm",
+	"music0360.xm",
+	"music0077.it",
+	"music0078.it",
+	0
+};
+
+TestExitStatus SoundSubsystem::modPlayback() {
+	Testsuite::clearScreen();
+	TestExitStatus passed = kTestPassed;
+	Common::String info = "Testing Module Playback\n"
+			"You should hear 4 melodies\n";
+
+	if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+		Testsuite::logPrintf("Info! Skipping test : Mod Playback\n");
+		return kTestSkipped;
+	}
+
+	Common::FSNode gameRoot(ConfMan.get("path"));
+	SearchMan.addSubDirectoryMatching(gameRoot, "audiocd-files");
+
+	Common::File f;
+	Audio::Mixer *mixer = g_system->getMixer();
+	Common::Point pt(0, 100);
+	Common::Point pt2(0, 110);
+
+	for (int i = 0; music[i]; i++) {
+		f.open(music[i]);
+
+		if (!f.isOpen())
+			continue;
+
+		Audio::RewindableAudioStream *mod = Audio::makeModXmS3mStream(&f, DisposeAfterUse::NO);
+		if (!mod) {
+			Testsuite::displayMessage(Common::String::format("Could not load MOD file '%s'", music[i]));
+			f.close();
+
+			continue;
+		}
+
+		Audio::SoundHandle handle;
+
+		mixer->playStream(Audio::Mixer::kMusicSoundType, &handle, mod);
+
+		Common::EventManager *eventMan = g_system->getEventManager();
+		Common::Event event;
+
+		while (mixer->isSoundHandleActive(handle)) {
+			g_system->delayMillis(10);
+			Testsuite::writeOnScreen(Common::String::format("Playing Now: %s", music[i]), pt);
+			Testsuite::writeOnScreen("Press 'S' to stop", pt2);
+
+			if (eventMan->pollEvent(event)) {
+				if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_s)
+					break;
+			}
+		}
+		g_system->delayMillis(10);
+
+		mixer->stopAll();
+		f.close();
+	}
+
+	mixer->stopAll();
+
+	if (Testsuite::handleInteractiveInput("Were you able to hear the music?", "Yes", "No", kOptionRight)) {
+		Testsuite::logDetailedPrintf("Error! No MOD playback\n");
+		passed = kTestFailed;
+	}
+	return passed;
+}
+
 TestExitStatus SoundSubsystem::audiocdOutput() {
 	Testsuite::clearScreen();
 	TestExitStatus passed = kTestPassed;
@@ -264,6 +340,7 @@ TestExitStatus SoundSubsystem::sampleRates() {
 SoundSubsystemTestSuite::SoundSubsystemTestSuite() {
 	addTest("SimpleBeeps", &SoundSubsystem::playBeeps, true);
 	addTest("MixSounds", &SoundSubsystem::mixSounds, true);
+	addTest("MODPlayback", &SoundSubsystem::modPlayback, true);
 
 	// Make audio-files discoverable
 	Common::FSNode gameRoot(ConfMan.get("path"));
diff --git a/engines/testbed/sound.h b/engines/testbed/sound.h
index 1dd479acfe..f6a155da01 100644
--- a/engines/testbed/sound.h
+++ b/engines/testbed/sound.h
@@ -45,6 +45,7 @@ namespace SoundSubsystem {
 // will contain function declarations for SoundSubsystem tests
 TestExitStatus playBeeps();
 TestExitStatus mixSounds();
+TestExitStatus modPlayback();
 TestExitStatus audiocdOutput();
 TestExitStatus sampleRates();
 }




More information about the Scummvm-git-logs mailing list