From 69945fa9fa97081136127104c450c6018568a1e5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 11 Feb 2023 01:31:11 +0100 Subject: [PATCH] EFH: reduce sound lengths --- engines/efh/efh.cpp | 5 ++++- engines/efh/sound.cpp | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/engines/efh/efh.cpp b/engines/efh/efh.cpp index 616917d9fb1..7a546fef0bb 100644 --- a/engines/efh/efh.cpp +++ b/engines/efh/efh.cpp @@ -217,7 +217,10 @@ Common::Error EfhEngine::run() { generateSound(10); break; case Common::KEYCODE_6: - generateSound1(20, 888, 3000); + generateSound(9); + break; + case Common::KEYCODE_7: + generateSound(16); break; default: if (retVal != Common::KEYCODE_INVALID) diff --git a/engines/efh/sound.cpp b/engines/efh/sound.cpp index 757cc4268b7..7f611d502a2 100644 --- a/engines/efh/sound.cpp +++ b/engines/efh/sound.cpp @@ -143,9 +143,9 @@ void EfhEngine::generateSound2(int startFreq, int endFreq, int speed) { int delta; // The original is using -/+1 but it takes ages even with speed / 10, so I switched to -/+5 if (startFreq > endFreq) - delta = -5; + delta = -50; else - delta = 5; + delta = 50; _speakerStream = new Audio::PCSpeaker(_mixer->getOutputRate()); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, @@ -157,7 +157,7 @@ void EfhEngine::generateSound2(int startFreq, int endFreq, int speed) { _speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, curFreq, -1); // The original is just looping, making the sound improperly timed as the length of a loop is directly related to the speed of the CPU // Dividing by 10 is just a guess based on how it sounds. I suspect it may be still too much - songDelay(speed / 10); + songDelay(speed); _speakerStream->stop(); curFreq += delta; } while (curFreq < endFreq && !shouldQuit()); @@ -196,7 +196,7 @@ void EfhEngine::generateSound5(int repeat) { debugC(3, kDebugEngine, "generateSound5 %d", repeat); for (int i = 0; i < repeat; ++i) //It looks identical, so I'm reusing generateSound2 - generateSound2(256, 4096, 10); + generateSound2(256, 4096, 2); } void EfhEngine::generateSound(int16 soundType) { @@ -207,20 +207,20 @@ void EfhEngine::generateSound(int16 soundType) { generateSound3(); break; case 9: - generateSound1(20, 888, 3000); - generateSound1(20, 888, 3000); + generateSound1(20, 888, 500); + generateSound1(20, 888, 500); break; case 10: generateSound5(1); break; case 13: - generateSound2(256, 4096, 18); + generateSound2(256, 4096, 2); break; case 14: - generateSound2(20, 400, 100); + generateSound2(20, 400, 20); break; case 15: - generateSound2(100, 888, 88); + generateSound2(100, 888, 10); break; case 16: generateSound1(2000, 6096, 1500);