Skip to content

Commit

Permalink
KYRA: (AdLib Driver) - allow sound trigger query
Browse files Browse the repository at this point in the history
  • Loading branch information
athrxx authored and Johannes Schickel committed Dec 26, 2011
1 parent f2a1ff3 commit 4098fef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions engines/kyra/sound.h
Expand Up @@ -217,6 +217,16 @@ class Sound {
* Stops playback of the current voice.
*/
void voiceStop(const Audio::SoundHandle *handle = 0);

/**
* Receive notifications from a song at certain points.
*/
virtual int checkTrigger() { return 0; }

/**
* Reset sound trigger.
*/
virtual void resetTrigger() {}
protected:
const char *fileListEntry(int file) const { return (_soundDataList != 0 && file >= 0 && file < _soundDataList->fileListLen) ? _soundDataList->fileList[file] : ""; }
int fileListLen() const { return _soundDataList->fileListLen; }
Expand Down
9 changes: 9 additions & 0 deletions engines/kyra/sound_adlib.cpp
Expand Up @@ -66,6 +66,7 @@ class AdLibDriver : public Audio::AudioStream {
bool isChannelPlaying(int channel) const;
void stopAllChannels();
int getSoundTrigger() const { return _soundTrigger; }
void resetSoundTrigger() { _soundTrigger = 0; }

void callback();

Expand Down Expand Up @@ -2345,6 +2346,14 @@ void SoundAdLibPC::beginFadeOut() {
play(1, 0xff);
}

int SoundAdLibPC::checkTrigger() {
return _driver->getSoundTrigger();
}

void SoundAdLibPC::resetTrigger() {
_driver->resetSoundTrigger();
}

void SoundAdLibPC::loadSoundFile(uint file) {
internalLoadFile(fileListEntry(file));
}
Expand Down
3 changes: 3 additions & 0 deletions engines/kyra/sound_adlib.h
Expand Up @@ -79,6 +79,9 @@ class SoundAdLibPC : public Sound {
virtual void playSoundEffect(uint8 track, uint8 volume = 0xff);

virtual void beginFadeOut();

virtual int checkTrigger();
virtual void resetTrigger();
private:
void internalLoadFile(Common::String file);

Expand Down

0 comments on commit 4098fef

Please sign in to comment.