- 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
This commit is contained in:
Johannes Schickel 2006-03-09 20:50:19 +00:00
parent a5e0c392ba
commit f0106cd59c
4 changed files with 26 additions and 9 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -114,6 +114,9 @@ public:
private:
void loadSoundFile(const char *file);
void unk1();
void unk2();
AdlibDriver *_driver;
uint8 _trackEntries[120];

View File

@ -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