From 4a34f4036544c9cb137237dbf5f23d8a5d2eafa1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Feb 2012 21:17:12 +1100 Subject: MORTEVIELLE: Replace timer chip frequency values with a constant --- engines/mortevielle/sound.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 08dbe0ba02..0a6e7e8d8d 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -129,6 +129,9 @@ int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; +// The PC timer chip works at a frequency of 1.19318Mhz +#define TIMER_FREQUENCY 1193180 + SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; _speakerStream = new PCSpeaker(mixer->getOutputRate()); @@ -177,13 +180,13 @@ void SoundManager::musyc(tablint &tb, int nbseg, int att) { const byte *pSrc = &mem[0x5000 * 16]; // Convert the countdown amount to a tempo rate, and then to note length in microseconds - int tempo = 1193180 / att; + int tempo = TIMER_FREQUENCY / att; int length = 1000000 / tempo; for (int noteIndex = 0; noteIndex < (nbseg * 16); ++noteIndex) { int lookupValue = *pSrc++; int noteCountdown = tb[lookupValue]; - int noteFrequency = 1193180 / noteCountdown; + int noteFrequency = TIMER_FREQUENCY / noteCountdown; playNote(noteFrequency, length); } -- cgit v1.2.3