[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.13,1.14 imuse.h,1.1.1.1,1.2 scumm.h,1.31,1.32 scummvm.cpp,1.40,1.41 sound.cpp,1.16,1.17
Pawe? Ko?odziejski
aquadran at users.sourceforge.net
Sun Sep 29 00:09:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv23621
Modified Files:
imuse.cpp imuse.h scumm.h scummvm.cpp sound.cpp
Log Message:
framework of Imuse sound for The Dig
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- imuse.cpp 24 Sep 2002 23:45:25 -0000 1.13
+++ imuse.cpp 29 Sep 2002 07:08:31 -0000 1.14
@@ -4715,3 +4715,29 @@
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;
+}
Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- imuse.h 21 Aug 2002 16:07:30 -0000 1.1.1.1
+++ imuse.h 29 Sep 2002 07:08:31 -0000 1.2
@@ -59,3 +59,37 @@
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);
+};
+
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- scumm.h 28 Sep 2002 15:19:21 -0000 1.31
+++ scumm.h 29 Sep 2002 07:08:31 -0000 1.32
@@ -33,6 +33,7 @@
class Dialog;
class Scumm;
class IMuse;
+class IMuseDigital;
class Actor;
class Sound;
class Bundle;
@@ -329,6 +330,7 @@
* That results in a shorter form of the opcode
* on some architectures. */
IMuse *_imuse;
+ IMuseDigital *_imuseDigital;
uint32 _features;
VerbSlot *_verbs;
ObjectData *_objs;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- scummvm.cpp 28 Sep 2002 15:19:21 -0000 1.40
+++ scummvm.cpp 29 Sep 2002 07:08:31 -0000 1.41
@@ -133,16 +133,21 @@
_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 @@
delete _bundle;
delete _sound;
- delete _imuse;
+ if (_imuse)
+ delete _imuse;
+ if (_imuseDigital)
+ delete _imuseDigital;
if (_existLanguageFile)
delete _languageBuffer;
}
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- sound.cpp 26 Sep 2002 12:29:10 -0000 1.16
+++ sound.cpp 29 Sep 2002 07:08:31 -0000 1.17
@@ -96,6 +96,7 @@
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 @@
_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 @@
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 @@
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 @@
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)
More information about the Scummvm-git-logs
mailing list