[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.138.2.4,2.138.2.5 script_v6he.cpp,2.15.2.5,2.15.2.6 sound.cpp,1.320.2.5,1.320.2.6 sound.h,1.62,1.62.2.1
Travis Howell
kirben at users.sourceforge.net
Wed Jul 14 22:45:06 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25708/scumm
Modified Files:
Tag: branch-0-6-0
intern.h script_v6he.cpp sound.cpp sound.h
Log Message:
Back port HE game sound fixes.
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.138.2.4
retrieving revision 2.138.2.5
diff -u -d -r2.138.2.4 -r2.138.2.5
--- intern.h 7 Jul 2004 10:09:28 -0000 2.138.2.4
+++ intern.h 15 Jul 2004 05:43:55 -0000 2.138.2.5
@@ -597,7 +597,7 @@
void o6_readFile();
void o6_rename();
void o6_writeFile();
- void o6_setVolume();
+ void o6_soundOps();
void o6_seekFilePos();
void o6_localizeArray();
void o6_unknownEE();
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.15.2.5
retrieving revision 2.15.2.6
diff -u -d -r2.15.2.5 -r2.15.2.6
--- script_v6he.cpp 10 Jul 2004 04:29:42 -0000 2.15.2.5
+++ script_v6he.cpp 15 Jul 2004 05:43:55 -0000 2.15.2.6
@@ -327,7 +327,7 @@
OPCODE(o6_deleteFile),
OPCODE(o6_rename),
/* E0 */
- OPCODE(o6_setVolume),
+ OPCODE(o6_soundOps),
OPCODE(o6_unknownE1),
OPCODE(o6_localizeArray),
OPCODE(o6_pickVarRandom),
@@ -1240,20 +1240,18 @@
debug(1, "o6_writeFile(%d, %d)", slot, resID);
}
-void ScummEngine_v6he::o6_setVolume() {
+void ScummEngine_v6he::o6_soundOps() {
byte subOp = fetchScriptByte();
- int soundVolumeMaster;
- int volume = pop();
+ int arg = pop();
switch (subOp) {
- case 222:
- if (_imuse)
- _imuse->set_music_volume(volume);
- else
- _mixer->setMusicVolume(volume);
+ case 0xde:
+ _imuse->set_music_volume(arg);
break;
- case 224:
- soundVolumeMaster = ConfMan.getInt("master_volume");
- _mixer->setVolume(volume * soundVolumeMaster / 255);
+ case 0xe0:
+ // Fatty Bear's Birthday surprise uses this when playing the
+ // piano, but only when using one of the digitized instruments.
+ // See also o6_startSound().
+ _sound->setOverrideFreq(arg);
break;
}
}
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.320.2.5
retrieving revision 1.320.2.6
diff -u -d -r1.320.2.5 -r1.320.2.6
--- sound.cpp 7 Jul 2004 10:09:32 -0000 1.320.2.5
+++ sound.cpp 15 Jul 2004 05:43:55 -0000 1.320.2.6
@@ -53,6 +53,7 @@
memset(this,0,sizeof(Sound)); // palmos
_vm = parent;
+ _overrideFreq = 0;
_currentCDSound = 0;
_sfxFile = 0;
@@ -121,6 +122,10 @@
_soundQuePos = 0;
}
+void Sound::setOverrideFreq(int freq) {
+ _overrideFreq = freq;
+}
+
void Sound::playSound(int soundID) {
byte *ptr;
char *sound;
@@ -157,13 +162,18 @@
else if (READ_UINT32(ptr) == MKID('DIGI')) {
// TODO - discover what data the first chunk, HSHD, contains
// it might be useful here.
+ rate = READ_LE_UINT16(ptr + 22);
+
ptr += 8 + READ_BE_UINT32(ptr+12);
if (READ_UINT32(ptr) != MKID('SDAT'))
return; // abort
size = READ_BE_UINT32(ptr+4) - 8;
- // FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000
- rate = 11025;
+ if (_overrideFreq) {
+ // Used by the piano in Fatty Bear's Birthday Surprise
+ rate = _overrideFreq;
+ _overrideFreq = 0;
+ }
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
@@ -522,16 +532,19 @@
return;
}
- // FIXME hack until more is known
- // the size of the data after the sample isn't known
- // 64 is just a guess
if (_vm->_features & GF_HUMONGOUS) {
- // SKIP TLKB (8) TALK (8) HSHD (24) and SDAT (8)
_sfxMode |= mode;
- _sfxFile->seek(offset + 48, SEEK_SET);
- sound = (byte *)malloc(b - 64);
- _sfxFile->read(sound, b - 64);
- _vm->_mixer->playRaw(handle, sound, b - 64, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+
+ // SKIP TALK (8) HSHD (14)
+ _sfxFile->seek(offset + 22, SEEK_SET);
+ int rate = _sfxFile->readUint16LE();
+ // SKIP HSHD (8) and SDAT (8)
+ _sfxFile->seek(+16, SEEK_CUR);
+
+ size = b - 40;
+ sound = (byte *)malloc(size);
+ _sfxFile->read(sound, size);
+ _vm->_mixer->playRaw(handle, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
return;
}
@@ -632,7 +645,7 @@
if (_vm->_features & GF_HUMONGOUS) {
if (sound == -2) {
- return isSfxFinished();
+ return !isSfxFinished();
} else if (sound == -1) {
// getSoundStatus(), with a -1, will return the
// ID number of the first active music it finds.
@@ -714,6 +727,7 @@
// Stop current sfx
} else if (a == -1) {
// Stop current music
+ _vm->_imuse->stopSound(_vm->_imuse->getSoundStatus(-1));
}
}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.62
retrieving revision 1.62.2.1
diff -u -d -r1.62 -r1.62.2.1
--- sound.h 8 Jan 2004 20:37:25 -0000 1.62
+++ sound.h 15 Jul 2004 05:43:55 -0000 1.62.2.1
@@ -54,6 +54,8 @@
int num_sound_effects; // SO3 MP3 compressed audio
bool _vorbis_mode; // true if using SOG, false if using SO3
+ int _overrideFreq;
+
int _currentCDSound;
ScummEngine *_vm;
@@ -69,6 +71,7 @@
void addSoundToQueue(int sound);
void addSoundToQueue2(int sound);
void processSoundQues();
+ void setOverrideFreq(int freq);
void playSound(int sound);
void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
void stopTalkSound();
More information about the Scummvm-git-logs
mailing list