diff options
-rw-r--r-- | scumm/imuse.cpp | 26 | ||||
-rw-r--r-- | scumm/imuse.h | 34 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 24 | ||||
-rw-r--r-- | scumm/sound.cpp | 27 |
5 files changed, 100 insertions, 13 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 15934101d1..c369012f01 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -4715,3 +4715,29 @@ IMuse *IMuse::create(OSystem *syst, MidiDriver *midi, SoundMixer *mixer) i->_imuse = IMuseInternal::create(syst, midi, mixer); return i; } + +IMuseDigital::IMuseDigital(SoundMixer *mixer, Timer * timer) { + memset(_channel, 0, sizeof(channel) * MAX_DIGITAL_CHANNELS); +} + +IMuseDigital::~IMuseDigital() { +} + +void IMuseDigital::startSound(int sound) { + debug(1, "IMuseDigital::startSound(%d)", sound); +} + +void IMuseDigital::stopSound(int sound) { + debug(1, "IMuseDigital::stopSound(%d)", sound); +} + +int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) { + debug(1, "IMuseDigital::doCommand(%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a >> 8, a & 0xFF, b, c, d, e, f, g, h); + return 0; +} + +int IMuseDigital::getSoundStatus(int sound) { + warning("IMuseDigital::getSoundStatus(%d) stub", sound); + return 0; +} diff --git a/scumm/imuse.h b/scumm/imuse.h index f265f52492..6d6650f02c 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -59,3 +59,37 @@ public: private: IMuseInternal *_imuse; // Pointer to the real imuse object }; + +#define MAX_DIGITAL_CHANNELS 10 + +class IMuseDigital { +private: + + struct channel { + int8 _volumeLeft; + int8 _volumeRight; + bool _isLoop; + uint32 _offsetEnd; + uint32 _offsetJump; + uint32 _offsetRegion; + uint32 _offset; + byte *_data; + uint32 _freq; + byte _channels; + bool _stereo; + byte _bits; + uint32 _size; + uint32 _idSound; + bool _used; + uint32 _mixerTrack; + } _channel[MAX_DIGITAL_CHANNELS]; + +public: + IMuseDigital(SoundMixer *mixer, Timer * timer); + ~IMuseDigital(); + void startSound(int sound); + void stopSound(int sound); + int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h); + int getSoundStatus(int sound); +}; + diff --git a/scumm/scumm.h b/scumm/scumm.h index 6b7298b344..e1bc1c5441 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -33,6 +33,7 @@ class NewGui; class Dialog; class Scumm; class IMuse; +class IMuseDigital; class Actor; class Sound; class Bundle; @@ -329,6 +330,7 @@ public: * That results in a shorter form of the opcode * on some architectures. */ IMuse *_imuse; + IMuseDigital *_imuseDigital; uint32 _features; VerbSlot *_verbs; ObjectData *_objs; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 0d3b2898c7..ca566f968d 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -133,16 +133,21 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _mixer->setVolume(kDefaultSFXVolume); _mixer->setMusicVolume(kDefaultMusicVolume); - // Init iMuse - if (detector->_use_adlib) { - _imuse = IMuse::create_adlib(syst, _mixer); + if (_gameId == GID_DIG) { + _imuseDigital = new IMuseDigital(_mixer, _timer); + _imuse = NULL; } else { - _imuse = IMuse::create_midi(syst, detector->createMidi()); + if (detector->_use_adlib) { + _imuse = IMuse::create_adlib(syst, _mixer); + } else { + _imuse = IMuse::create_midi(syst, detector->createMidi()); + } + _imuseDigital = NULL; + if (detector->_gameTempo != 0) + _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); + _imuse->set_music_volume(_sound->_sound_volume_music); } - if (detector->_gameTempo != 0) - _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); - _imuse->set_music_volume(_sound->_sound_volume_music); // Load game from specified slot, if any @@ -169,7 +174,10 @@ Scumm::~Scumm () delete _bundle; delete _sound; - delete _imuse; + if (_imuse) + delete _imuse; + if (_imuseDigital) + delete _imuseDigital; if (_existLanguageFile) delete _languageBuffer; } diff --git a/scumm/sound.cpp b/scumm/sound.cpp index f4e506c975..8bf1d32da6 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -96,6 +96,7 @@ void Sound::processSoundQues() { i += num; se = _scumm->_imuse; + #if 0 debug(1, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)", data[0] >> 8, @@ -113,8 +114,12 @@ void Sound::processSoundQues() { _scumm->_vars[_scumm->VAR_SOUNDRESULT] = (short)se->do_command(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + } else { + if (_scumm->_imuseDigital) + _scumm->_vars[_scumm->VAR_SOUNDRESULT] = + (short)_scumm->_imuseDigital->doCommand(data[0], data[1], data[2], data[3], data[4], + data[5], data[6], data[7]); } - } } _soundQuePos = 0; @@ -179,7 +184,12 @@ void Sound::playSound(int sound) { sound, _scumm->getResourceRoomNr(rtSound, sound)); ptr = _scumm->getResourceAddress(rtSound, sound); if (ptr) { - if (READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) { + if ((READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')) && (_scumm->_imuseDigital)){ + if (_scumm->_imuseDigital) { + _scumm->_imuseDigital->startSound(sound); + } + } + else if (READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) { ptr += 8; _scumm->_vars[_scumm->VAR_MI1_TIMER] = 0; playCDTrack(ptr[16], ptr[17] == 0xff ? -1 : ptr[17], @@ -541,6 +551,9 @@ int Sound::isSoundRunning(int sound) { if (!_scumm->isResourceLoaded(rtSound, sound)) return 0; + if (_scumm->_imuseDigital) { + return _scumm->_imuseDigital->getSoundStatus(sound); + } se = _scumm->_imuse; if (!se) return 0; @@ -576,9 +589,13 @@ void Sound::stopSound(int a) { stopCD(); } - se = _scumm->_imuse; - if (se) - se->stop_sound(a); + if (_scumm->_imuseDigital) { + _scumm->_imuseDigital->stopSound(a); + } else { + se = _scumm->_imuse; + if (se) + se->stop_sound(a); + } for (i = 0; i < 10; i++) if (_soundQue2[i] == (byte)a) |