[Scummvm-cvs-logs] CVS: scummvm/scumm script_v100he.cpp,2.186,2.187 script_v7he.cpp,2.175,2.176 scumm.cpp,1.689,1.690 scumm.h,1.665,1.666 sound.h,1.97,1.98 sound_he.cpp,2.11,2.12 vars.cpp,1.161,1.162
kirben
kirben at users.sourceforge.net
Sun Jan 15 00:38:40 CET 2006
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v72he.cpp,2.321,2.322 sound.h,1.96,1.97 sound_he.cpp,2.10,2.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v7he.cpp,2.176,2.177 sound_he.cpp,2.12,2.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25039/scumm
Modified Files:
script_v100he.cpp script_v7he.cpp scumm.cpp scumm.h sound.h
sound_he.cpp vars.cpp
Log Message:
Fix sound channel selection in HE95+ games.
Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.186
retrieving revision 2.187
diff -u -d -r2.186 -r2.187
--- script_v100he.cpp 10 Jan 2006 21:39:13 -0000 2.186
+++ script_v100he.cpp 15 Jan 2006 08:37:00 -0000 2.187
@@ -1702,7 +1702,7 @@
_heSndSoundId = pop();
_heSndOffset = 0;
_heSndSoundFreq = 11025;
- _heSndChannel = VAR(VAR_MUSIC_CHANNEL);
+ _heSndChannel = VAR(VAR_SOUND_CHANNEL);
_heSndFlags = 0;
break;
case 133:
Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.175
retrieving revision 2.176
diff -u -d -r2.175 -r2.176
--- script_v7he.cpp 6 Jan 2006 03:49:02 -0000 2.175
+++ script_v7he.cpp 15 Jan 2006 08:37:00 -0000 2.176
@@ -463,7 +463,7 @@
_heSndSoundId = pop();
_heSndOffset = 0;
_heSndSoundFreq = 11025;
- _heSndChannel = VAR(VAR_MUSIC_CHANNEL);
+ _heSndChannel = VAR(VAR_SOUND_CHANNEL);
break;
case 245:
_heSndFlags |= 1;
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.689
retrieving revision 1.690
diff -u -d -r1.689 -r1.690
--- scumm.cpp 14 Jan 2006 10:09:50 -0000 1.689
+++ scumm.cpp 15 Jan 2006 08:37:00 -0000 1.690
@@ -1357,10 +1357,10 @@
VAR_REDRAW_ALL_ACTORS = 0xFF;
VAR_SKIP_RESET_TALK_ACTOR = 0xFF;
- VAR_MUSIC_CHANNEL = 0xFF;
VAR_SOUND_CHANNEL = 0xFF;
+ VAR_TALK_CHANNEL = 0xFF;
VAR_SOUNDCODE_TMR = 0xFF;
- VAR_DEFAULT_SOUND_CHANNEL = 0xFF;
+ VAR_RESERVED_SOUND_CHANNELS = 0xFF;
VAR_MAIN_SCRIPT = 0xFF;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.665
retrieving revision 1.666
diff -u -d -r1.665 -r1.666
--- scumm.h 14 Jan 2006 10:09:50 -0000 1.665
+++ scumm.h 15 Jan 2006 08:37:01 -0000 1.666
@@ -1332,10 +1332,10 @@
byte VAR_REDRAW_ALL_ACTORS;
byte VAR_SKIP_RESET_TALK_ACTOR;
- byte VAR_MUSIC_CHANNEL;
byte VAR_SOUND_CHANNEL;
+ byte VAR_TALK_CHANNEL;
byte VAR_SOUNDCODE_TMR;
- byte VAR_DEFAULT_SOUND_CHANNEL;
+ byte VAR_RESERVED_SOUND_CHANNELS;
byte VAR_MAIN_SCRIPT;
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- sound.h 15 Jan 2006 06:54:31 -0000 1.97
+++ sound.h 15 Jan 2006 08:37:01 -0000 1.98
@@ -102,7 +102,7 @@
int priority;
int sbngBlock;
int soundVars[27];
- } _heChannel[9];
+ } _heChannel[8];
public:
Audio::SoundHandle _talkChannelHandle; // Handle of mixer channel actor is talking on
@@ -143,6 +143,7 @@
// HE specific
bool getHEMusicDetails(int id, int &musicOffs, int &musicSize);
+ int findFreeSoundChannel();
int isSoundCodeUsed(int sound);
int getSoundPos(int sound);
int getSoundVar(int sound, int var);
Index: sound_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound_he.cpp,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -d -r2.11 -r2.12
--- sound_he.cpp 15 Jan 2006 06:54:31 -0000 2.11
+++ sound_he.cpp 15 Jan 2006 08:37:01 -0000 2.12
@@ -43,6 +43,27 @@
namespace Scumm {
+int Sound::findFreeSoundChannel() {
+ int chan, min;
+
+ min = _vm->VAR(_vm->VAR_RESERVED_SOUND_CHANNELS);
+ if (min == 0) {
+ _vm->VAR(_vm->VAR_RESERVED_SOUND_CHANNELS) = 8;
+ return 1;
+ }
+
+ if (min < 8) {
+ for (chan = min; min < ARRAYSIZE(_heChannel); chan++) {
+ if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[chan]) == 0)
+ return chan;
+ }
+ } else {
+ return 1;
+ }
+
+ return min;
+}
+
int Sound::isSoundCodeUsed(int sound) {
int chan = -1;
for (int i = 0; i < ARRAYSIZE(_heChannel); i ++) {
@@ -290,20 +311,16 @@
}
void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
- debug(0,"playHESound: soundID %d heOffset %d heChannel %d heFlags %d", soundID, heOffset, heChannel, heFlags);
byte *ptr, *spoolPtr;
char *sound;
int size = -1;
int priority, rate;
byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
- if (heChannel == -1) {
- if (_vm->_heversion >= 95 && _vm->VAR(_vm->VAR_DEFAULT_SOUND_CHANNEL) != 0) {
- heChannel = _vm->VAR(_vm->VAR_DEFAULT_SOUND_CHANNEL);
- } else {
- heChannel = 1;
- }
- }
+ if (heChannel == -1)
+ heChannel = (_vm->VAR_RESERVED_SOUND_CHANNELS != 0xFF) ? findFreeSoundChannel() : 1;
+
+ debug(0,"playHESound: soundID %d heOffset %d heChannel %d heFlags %d", soundID, heOffset, heChannel, heFlags);
if (soundID > _vm->_numSounds) {
if (soundID >= 10000) {
@@ -360,10 +377,19 @@
return;
}
+ // TODO: Extra sound flags
+ if (heFlags & 1) {
+ //flags |= Audio::Mixer::FLAG_LOOP;
+ }
+
// Support for sound in later Backyard sports games
- if (READ_UINT32(ptr) == MKID('RIFF')) {
+ if (READ_UINT32(ptr) == MKID('RIFF') || READ_UINT32(ptr) == MKID('WSOU')) {
uint16 type;
int blockAlign;
+
+ if (READ_UINT32(ptr) == MKID('WSOU'))
+ ptr += 8;
+
size = READ_LE_UINT32(ptr + 4);
Common::MemoryReadStream stream(ptr, size);
@@ -382,6 +408,7 @@
sound = (char *)malloc(size);
memcpy(sound, ptr + stream.pos(), size);
}
+ _vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
_vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID);
}
// Support for sound in Humongous Entertainment games
@@ -392,12 +419,11 @@
rate = READ_LE_UINT16(ptr + 22);
ptr += 8 + READ_BE_UINT32(ptr + 12);
- // TODO
- /* if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[heChannel])) {
+ if (_vm->_mixer->isSoundHandleActive(_heSoundChannels[heChannel])) {
int curSnd = _heChannel[heChannel].sound;
if (curSnd != 0 && curSnd != 1 && soundID != 1 && _heChannel[heChannel].priority > priority)
return;
- } */
+ }
int codeOffs = -1;
if (READ_UINT32(ptr) == MKID('SBNG')) {
@@ -420,14 +446,10 @@
_overrideFreq = 0;
}
- // TODO
- if (heFlags & 1) {
- //flags |= Audio::Mixer::FLAG_LOOP;
- }
-
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + heOffset + 8, size);
+ _vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
_vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID);
_vm->setHETimer(heChannel + 4);
@@ -485,7 +507,7 @@
ptr = _vm->getResourceAddress(rtSound, 1);
_sfxFile->read(ptr, size);
- int channel = (_vm->VAR_SOUND_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_SOUND_CHANNEL) : 0;
+ int channel = (_vm->VAR_TALK_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_TALK_CHANNEL) : 0;
addSoundToQueue2(1, 0, channel, 0);
}
Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- vars.cpp 14 Jan 2006 10:09:50 -0000 1.161
+++ vars.cpp 15 Jan 2006 08:37:01 -0000 1.162
@@ -214,8 +214,8 @@
VAR_MUSIC_TIMER = 0xFF;
VAR_NUM_SOUND_CHANNELS = 9;
- VAR_SOUND_CHANNEL = 10;
- VAR_MUSIC_CHANNEL = 14;
+ VAR_TALK_CHANNEL = 10;
+ VAR_SOUND_CHANNEL = 14;
}
void ScummEngine_v72he::setupScummVars() {
@@ -266,8 +266,8 @@
VAR_CHARINC = 48;
VAR_TALK_ACTOR = 49;
VAR_LAST_SOUND = 50;
- VAR_SOUND_CHANNEL = 51;
- VAR_MUSIC_CHANNEL = 52;
+ VAR_TALK_CHANNEL = 51;
+ VAR_SOUND_CHANNEL = 52;
VAR_MEMORY_PERFORMANCE = 57;
VAR_VIDEO_PERFORMANCE = 58;
@@ -312,7 +312,7 @@
VAR_U32_VERSION = 107;
VAR_U32_ARRAY_UNK = 116;
VAR_WIZ_TCOLOR = 117;
- VAR_DEFAULT_SOUND_CHANNEL = 120;
+ VAR_RESERVED_SOUND_CHANNELS = 120;
}
if (_heversion >= 98) {
VAR_SKIP_RESET_TALK_ACTOR = 125;
@@ -581,8 +581,8 @@
VAR(VAR_MACHINE_SPEED) = 13;
VAR(VAR_NUM_SOUND_CHANNELS) = 8;
- VAR(VAR_MUSIC_CHANNEL) = 1;
- VAR(VAR_SOUND_CHANNEL) = 2;
+ VAR(VAR_SOUND_CHANNEL) = 1;
+ VAR(VAR_TALK_CHANNEL) = 2;
}
void ScummEngine_v72he::initScummVars() {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v72he.cpp,2.321,2.322 sound.h,1.96,1.97 sound_he.cpp,2.10,2.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v7he.cpp,2.176,2.177 sound_he.cpp,2.12,2.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list