diff options
author | Norbert Lange | 2009-07-19 14:02:19 +0000 |
---|---|---|
committer | Norbert Lange | 2009-07-19 14:02:19 +0000 |
commit | dbe300fc5303028af56a55efeecd99a0992a7928 (patch) | |
tree | a1132a076c484f95b0e596b350cbbe3c18c88251 /engines/kyra | |
parent | 31b6767666c3ed5f3ef0660218941d26eccf2446 (diff) | |
download | scummvm-rg350-dbe300fc5303028af56a55efeecd99a0992a7928.tar.gz scummvm-rg350-dbe300fc5303028af56a55efeecd99a0992a7928.tar.bz2 scummvm-rg350-dbe300fc5303028af56a55efeecd99a0992a7928.zip |
fixed retiring of external Notes
fixed/improved counting DMAs in Paula
added flag for looping songs
rearranged maxtrax.h a bit
svn-id: r42613
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/sound.h | 3 | ||||
-rw-r--r-- | engines/kyra/sound_amiga.cpp | 39 | ||||
-rw-r--r-- | engines/kyra/sound_intern.h | 6 |
3 files changed, 23 insertions, 25 deletions
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 263cd586f7..2f24a264f1 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -55,7 +55,8 @@ public: kMidiGM, kTowns, kPC98, - kPCSpkr + kPCSpkr, + kAmiga }; virtual kType getMusicType() const = 0; diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp index ee4fba5f22..11c28940fd 100644 --- a/engines/kyra/sound_amiga.cpp +++ b/engines/kyra/sound_amiga.cpp @@ -41,7 +41,7 @@ const char *const SoundAmiga::kFilenameTable[3][2] = { }; SoundAmiga::SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer) : - Sound(vm, mixer), _driver(0), _fileLoaded((uint)-1) { + Sound(vm, mixer), _driver(0), _fileLoaded(kFileNone) { } SoundAmiga::~SoundAmiga() { @@ -56,7 +56,7 @@ bool SoundAmiga::init() { void SoundAmiga::loadSoundFile(uint file) { assert(file < ARRAYSIZE(kFilenameTable)); - if (_fileLoaded == file) + if (_fileLoaded == (FileType)file) return; Common::SeekableReadStream *scoreIn = _vm->resource()->createReadStream(kFilenameTable[file][0]); @@ -65,20 +65,17 @@ void SoundAmiga::loadSoundFile(uint file) { if (scoreIn && sampleIn) { _driver->load(*scoreIn, true, false); _driver->load(*sampleIn, false, true); - _fileLoaded = file; + _fileLoaded = (FileType)file; } delete sampleIn; } else { if (scoreIn) { _driver->load(*scoreIn); - _fileLoaded = file; + _fileLoaded = (FileType)file; } } delete scoreIn; } -void SoundAmiga::loadSoundFile(Common::String) { - assert("Dont call me" == 0); -} void SoundAmiga::playTrack(uint8 track) { static const byte tempoIntro[6] = { 0x46, 0x55, 0x3C, 0x41, 0x78, 0x50 }; @@ -96,11 +93,12 @@ void SoundAmiga::playTrack(uint8 track) { // intro if (track >= 2) { track -= 2; - _driver->setVolume(0x40); - _driver->doSong(track); - _driver->setTempo(tempoIntro[track] << 4); - if (!_mixer->isSoundHandleActive(_soundChannels[0])) - _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); + if (_driver->playSong(track)) { + _driver->setVolume(0x40); + _driver->setTempo(tempoIntro[track] << 4); + if (!_mixer->isSoundHandleActive(_soundChannels[0])) + _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); + } } else if (track == 0){ _driver->stopMusic(); } else { // track == 1 @@ -111,13 +109,13 @@ void SoundAmiga::playTrack(uint8 track) { if (false && track < 0x80 && track != 3) { if (track >= 2) { track -= 0xB; - _driver->setVolume(0x40); - if (loopIngame) - ; // TODO: enable looping - _driver->doSong(track); - _driver->setTempo(tempoIngame[track] << 4); - if (!_mixer->isSoundHandleActive(_soundChannels[0])) - _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); + if (_driver->playSong(track, loopIngame[track] != 0)) { + _driver->setVolume(0x40); + + _driver->setTempo(tempoIngame[track] << 4); + if (!_mixer->isSoundHandleActive(_soundChannels[0])) + _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); + } } else if (track == 0){ _driver->stopMusic(); } else { // track == 1 @@ -147,7 +145,7 @@ void SoundAmiga::playSoundEffect(uint8 track) { // intro assert(track < ARRAYSIZE(tableEffectsIntro)); const EffectEntry &entry = tableEffectsIntro[track]; - _driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, entry.pan != 0); + bool success = _driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, entry.pan != 0) >= 0; if (!_mixer->isSoundHandleActive(_soundChannels[0])) _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); @@ -166,7 +164,6 @@ void SoundAmiga::playSoundEffect(uint8 track) { _driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, pan != 0); if (!_mixer->isSoundHandleActive(_soundChannels[0])) _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); - } } } diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index 3c0487d02a..982d370bf8 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -290,13 +290,13 @@ public: SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer); ~SoundAmiga(); - virtual kType getMusicType() const { return kPC98; } //FIXME + virtual kType getMusicType() const { return kAmiga; } //FIXME bool init(); void process() {} void loadSoundFile(uint file); - void loadSoundFile(Common::String); + void loadSoundFile(Common::String) {} void playTrack(uint8 track); void haltTrack(); @@ -307,7 +307,7 @@ public: protected: Audio::MaxTrax *_driver; - uint _fileLoaded; + enum FileType { kFileNone = -1, kFileIntro = 0, kFileGame = 1, kFileFinal = 2 } _fileLoaded; static const char *const kFilenameTable[3][2]; static const struct EffectEntry { |