aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-03-09 20:50:19 +0000
committerJohannes Schickel2006-03-09 20:50:19 +0000
commitf0106cd59c90d22799bb1517575a2d92a9027abe (patch)
tree478c2b092153fc9e34326bae455d8e683b8b4a18
parenta5e0c392ba3cef688b0525dbdd233c95e1657674 (diff)
downloadscummvm-rg350-f0106cd59c90d22799bb1517575a2d92a9027abe.tar.gz
scummvm-rg350-f0106cd59c90d22799bb1517575a2d92a9027abe.tar.bz2
scummvm-rg350-f0106cd59c90d22799bb1517575a2d92a9027abe.zip
- Removes deleted waitTicks prototype in KyraEngine
- Adds sound fading support to the adlib player - Adds support for stopping running tracks - Changes baseFreq type back to uint8 - corrects octave handling in updateAndOutput1 (Thanks to eriktorbjorn for doing that) svn-id: r21185
-rw-r--r--engines/kyra/kyra.h1
-rw-r--r--engines/kyra/sound.cpp1
-rw-r--r--engines/kyra/sound.h3
-rw-r--r--engines/kyra/sound_adlib.cpp30
4 files changed, 26 insertions, 9 deletions
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index 833877c95d..b90c58dda9 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -303,7 +303,6 @@ public:
void enableTimer(uint8 timer);
void disableTimer(uint8 timer);
- void waitTicks(int ticks);
void delayWithTicks(int ticks);
void saveGame(const char *fileName, const char *saveName);
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index d8cb070aed..b1f685231d 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -445,6 +445,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
if (command != 1) {
if (_lastMusicCommand != command) {
_lastMusicCommand = command;
+ _sound->haltTrack();
_sound->playTrack(soundTable[command*2+1], true);
}
} else {
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 21b99d8056..2baccc0d9a 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -114,6 +114,9 @@ public:
private:
void loadSoundFile(const char *file);
+ void unk1();
+ void unk2();
+
AdlibDriver *_driver;
uint8 _trackEntries[120];
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index d10a5abfeb..a601d457a4 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -115,7 +115,7 @@ private:
uint8 unk38;
uint8 unk26;
uint8 unk7;
- int8 baseFreq;
+ uint8 baseFreq;
int8 unk1;
int8 unk4;
uint8 regAx;
@@ -723,7 +723,7 @@ void AdlibDriver::updateAndOutput1(uint8 rawNote, OutputState &state, bool flag)
state.rawNote = rawNote;
int8 note = (rawNote & 0x0F) + state.baseNote;
- int8 octave = ((rawNote >> 4) & 0x0F) + state.baseOctave;
+ int8 octave = ((rawNote + state.baseOctave) >> 4) & 0x0F;
// There are only twelve notes. If we go outside that, we have to
// adjust the note and octave.
@@ -1946,17 +1946,17 @@ void SoundAdlibPC::playMusic(const char *file) {
}
void SoundAdlibPC::stopMusic() {
- playSoundEffect(0);
+ //playSoundEffect(0);
}
void SoundAdlibPC::playTrack(uint8 track, bool looping) {
- // snd_stopSound();
- // snd_unk1();
playSoundEffect(track);
}
void SoundAdlibPC::haltTrack() {
- playSoundEffect(0);
+ unk1();
+ unk2();
+ _engine->_system->delayMillis(3 * 60);
}
void SoundAdlibPC::startTrack() {
@@ -2002,6 +2002,7 @@ void SoundAdlibPC::playSoundEffect(uint8 track) {
}
void SoundAdlibPC::beginFadeOut() {
+ playSoundEffect(1);
}
bool SoundAdlibPC::fadeOut() {
@@ -2012,6 +2013,10 @@ void SoundAdlibPC::loadSoundFile(const char *file) {
if (_soundFileLoaded == file)
return;
+ if (_soundDataPtr) {
+ haltTrack();
+ }
+
uint8 *file_data = 0; uint32 file_size = 0;
char filename[25];
@@ -2023,8 +2028,8 @@ void SoundAdlibPC::loadSoundFile(const char *file) {
return;
}
- // snd_stopSound();
- // snd_unk1();
+ unk2();
+ unk1();
_driver->callback(8, int(-1));
_soundDataPtr = 0;
@@ -2049,5 +2054,14 @@ void SoundAdlibPC::loadSoundFile(const char *file) {
_soundFileLoaded = file;
}
+void SoundAdlibPC::unk1() {
+ playSoundEffect(0);
+ //_engine->_system->delayMillis(5 * 60);
+}
+
+void SoundAdlibPC::unk2() {
+ playSoundEffect(0);
+}
+
} // end of namespace Kyra