aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-02-06 21:17:12 +1100
committerStrangerke2012-04-06 08:20:51 +0200
commit4a34f4036544c9cb137237dbf5f23d8a5d2eafa1 (patch)
tree2d6778fe0743da1513e2b0e8c64f60c04d332d6c
parent3a2cd5a223bb7097acddc7acda95298db20bf1f5 (diff)
downloadscummvm-rg350-4a34f4036544c9cb137237dbf5f23d8a5d2eafa1.tar.gz
scummvm-rg350-4a34f4036544c9cb137237dbf5f23d8a5d2eafa1.tar.bz2
scummvm-rg350-4a34f4036544c9cb137237dbf5f23d8a5d2eafa1.zip
MORTEVIELLE: Replace timer chip frequency values with a constant
-rw-r--r--engines/mortevielle/sound.cpp7
1 files 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);
}