[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.14,2.15 imuse.h,1.25,1.26 saveload.cpp,1.55,1.56 script_v6.cpp,1.81,1.82 scummvm.cpp,2.63,2.64 sound.cpp,1.96,1.97

Max Horn fingolfin at users.sourceforge.net
Tue Mar 18 08:14:11 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv13024

Modified Files:
	imuse.cpp imuse.h saveload.cpp script_v6.cpp scummvm.cpp 
	sound.cpp 
Log Message:
cleanup

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -d -r2.14 -r2.15
--- imuse.cpp	6 Mar 2003 21:45:59 -0000	2.14
+++ imuse.cpp	18 Mar 2003 16:13:46 -0000	2.15
@@ -106,7 +106,7 @@
 	// Player part
 	void hook_clear();
 	void clear();
-	bool start_sound(int sound);
+	bool startSound(int sound);
 	void uninit_parts();
 	byte *parse_midi(byte *s);
 	void key_off(uint8 chan, byte data);
@@ -455,12 +455,12 @@
 	int set_master_volume(uint vol);
 	int get_master_volume();
 	byte get_channel_program (byte channel) { return _driver->get_channel_program (channel); }
-	bool start_sound(int sound);
-	int stop_sound(int sound);
+	bool startSound(int sound);
+	int stopSound(int sound);
 	int stop_all_sounds();
 	int get_sound_status(int sound);
 	bool get_sound_active(int sound);
-	int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h);
+	int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
 	int clear_queue();
 	void setBase(byte **base);
 
@@ -676,7 +676,7 @@
 	return false;
 }
 
-bool IMuseInternal::start_sound(int sound) {
+bool IMuseInternal::startSound(int sound) {
 	Player *player;
 	void *mdhd;
 
@@ -697,7 +697,7 @@
 	if (!mdhd) {
 		mdhd = findTag(sound, MDPG_TAG, 0);
 		if (!mdhd) {
-			warning("SE::start_sound failed: Couldn't find sound %d", sound);
+			warning("SE::startSound failed: Couldn't find sound %d", sound);
 			return false;
 		}
 	}
@@ -720,7 +720,7 @@
 		return false;
 
 	player->clear();
-	return player->start_sound(sound);
+	return player->startSound(sound);
 }
 
 
@@ -789,7 +789,7 @@
 	}
 }
 
-int IMuseInternal::stop_sound(int sound) {
+int IMuseInternal::stopSound(int sound) {
 	Player *player = _players;
 	int i;
 	int r = -1;
@@ -865,7 +865,7 @@
 			break;
 		_queue_end = pos;
 
-		do_command(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
+		doCommand(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
 
 		if (_queue_cleared)
 			return;
@@ -1242,7 +1242,7 @@
 	return 0;
 }
 
-int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g, int h) {
+int32 IMuseInternal::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) {
 	int i;
 	byte cmd = a & 0xFF;
 	byte param = a >> 8;
@@ -1261,9 +1261,9 @@
 		case 7:
 			return _master_volume >> 1; // Convert from 0-255 to 0-127
 		case 8:
-			return start_sound(b) ? 0 : -1;
+			return startSound(b) ? 0 : -1;
 		case 9:
-			return stop_sound(b);
+			return stopSound(b);
 		case 10: // FIXME: Sam and Max - Not sure if this is correct
 			return stop_all_sounds();
 		case 11:
@@ -1282,7 +1282,7 @@
 				// Set player volume.
 				return player->set_vol (e);
 			default:
-				warning("IMuseInternal::do_command (6) unsupported sub-command %d", d);
+				warning("IMuseInternal::doCommand (6) unsupported sub-command %d", d);
 			}
 			return -1;
 		case 13:
@@ -1348,13 +1348,13 @@
 			// Sam & Max: Deferred Command
 			// FIXME: Right now this acts as an immediate command.
 			// The significance of parameter b is unknown.
-			warning ("Incomplete support for iMuse::do_command(20)");
-			return do_command (c, d, e, f, g, h, 0, 0);
+			warning ("Incomplete support for iMuse::doCommand(20)");
+			return doCommand (c, d, e, f, g, h, 0, 0);
 		case 2:
 		case 3:
 			return 0;
 		default:
-			warning("do_command (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
+			warning("doCommand (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
 		}
 	} else if (param == 1) {
 		if ((1 << cmd) & (0x783FFF)) {
@@ -1435,7 +1435,7 @@
 		case 24:
 			return 0;
 		default:
-			warning("do_command (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
+			warning("doCommand (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
 			return -1;
 		}
 	}
@@ -1446,7 +1446,7 @@
 int32 IMuseInternal::ImSetTrigger (int sound, int id, int a, int b, int c, int d) {
 	// Sam & Max: ImSetTrigger.
 	// Sets a trigger for a particular player and
-	// marker ID, along with do_command parameters
+	// marker ID, along with doCommand parameters
 	// to invoke at the marker. The marker is
 	// represented by MIDI SysEx block 00 xx (F7)
 	// where "xx" is the marker ID.
@@ -1491,7 +1491,7 @@
 	// If the command is to start a sound, stop that sound if it's already playing.
 	// This fixes some carnival music problems.
 	if (trig->command [0] == 8 && get_sound_status (trig->command [1]))
-		stop_sound (trig->command [1]);
+		stopSound (trig->command [1]);
 	return 0;
 }
 
@@ -1754,14 +1754,14 @@
 	_ticks_per_beat = TICKS_PER_BEAT;
 }
 
-bool Player::start_sound(int sound) {
+bool Player::startSound(int sound) {
 	void *mdhd;
 
 	mdhd = _se->findTag(sound, MDHD_TAG, 0);
 	if (mdhd == NULL) {
 		mdhd = _se->findTag(sound, MDPG_TAG, 0);
 		if (mdhd == NULL) {
-				warning("P::start_sound failed: Couldn't find %s", MDHD_TAG);
+				warning("P::startSound failed: Couldn't find %s", MDHD_TAG);
 				return false;
 		}
 	}
@@ -2062,7 +2062,7 @@
 			}
 		} else {
 			// Sam & Max: Trigger Event
-			// Triggers are set by do_command (ImSetTrigger).
+			// Triggers are set by doCommand (ImSetTrigger).
 			// When a SysEx marker is encountered whose sound
 			// ID and marker ID match what was set by ImSetTrigger,
 			// something magical is supposed to happen....
@@ -2071,7 +2071,7 @@
 				    _se->_snm_triggers [a].id == *p)
 				{
 					_se->_snm_triggers [a].sound = _se->_snm_triggers [a].id = 0;
-					_se->do_command (_se->_snm_triggers [a].command [0],
+					_se->doCommand (_se->_snm_triggers [a].command [0],
 					                 _se->_snm_triggers [a].command [1],
 					                 _se->_snm_triggers [a].command [2],
 					                 _se->_snm_triggers [a].command [3],
@@ -3551,12 +3551,12 @@
 int IMuse::get_music_volume() { in(); int ret = _target->get_music_volume(); out(); return ret; }
 int IMuse::set_master_volume(uint vol) { in(); int ret = _target->set_master_volume (vol); out(); return ret; }
 int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
-bool IMuse::start_sound(int sound) { in(); bool ret = _target->start_sound (sound); out(); return ret; }
-int IMuse::stop_sound(int sound) { in(); int ret = _target->stop_sound (sound); out(); return ret; }
+bool IMuse::startSound(int sound) { in(); bool ret = _target->startSound (sound); out(); return ret; }
+int IMuse::stopSound(int sound) { in(); int ret = _target->stopSound (sound); out(); return ret; }
 int IMuse::stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
 int IMuse::get_sound_status(int sound) { in(); int ret = _target->get_sound_status (sound); out(); return ret; }
 bool IMuse::get_sound_active(int sound) { in(); bool ret = _target->get_sound_active (sound); out(); return ret; }
-int32 IMuse::do_command(int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->do_command (a,b,c,d,e,f,g,h); out(); return ret; }
+int32 IMuse::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->doCommand (a,b,c,d,e,f,g,h); out(); return ret; }
 int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
 void IMuse::setBase(byte **base) { in(); _target->setBase (base); out(); }
 uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property (prop, value); out(); return ret; }

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- imuse.h	6 Mar 2003 21:46:01 -0000	1.25
+++ imuse.h	18 Mar 2003 16:13:50 -0000	1.26
@@ -23,8 +23,6 @@
 #ifndef IMUSE_H
 #define IMUSE_H
 
-#include "imuse_digi.h"
-
 class IMuseInternal;
 class MidiDriver;
 class OSystem;
@@ -56,12 +54,12 @@
 	int get_music_volume();
 	int set_master_volume(uint vol);
 	int get_master_volume();
-	bool start_sound(int sound);
-	int stop_sound(int sound);
+	bool startSound(int sound);
+	int stopSound(int sound);
 	int stop_all_sounds();
 	int get_sound_status(int sound);
 	bool get_sound_active(int sound);
-	int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h);
+	int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
 	int clear_queue();
 	void setBase(byte **base);
 	uint32 property(int prop, uint32 value);

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- saveload.cpp	6 Mar 2003 21:46:12 -0000	1.55
+++ saveload.cpp	18 Mar 2003 16:13:50 -0000	1.56
@@ -24,13 +24,13 @@
 #include "actor.h"
 #include "charset.h"
 #include "imuse.h"
+#include "imuse_digi.h"
 #include "resource.h"
 #include "saveload.h"
 #include "scumm.h"
 #include "sound.h"
 #include "verbs.h"
 #include "common/config-file.h"
-#include "sound/mididrv.h"
 
 struct SaveGameHeader {
 	uint32 type;

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- script_v6.cpp	17 Mar 2003 12:32:45 -0000	1.81
+++ script_v6.cpp	18 Mar 2003 16:13:51 -0000	1.82
@@ -2604,8 +2604,7 @@
 		case 122:
 
 			_vars[VAR_SOUNDRESULT] =
-				(short)_imuse->do_command(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]
-				);
+				(short)_imuse->doCommand(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
 			break;
 
 		case 123:

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.63
retrieving revision 2.64
diff -u -d -r2.63 -r2.64
--- scummvm.cpp	18 Mar 2003 06:53:47 -0000	2.63
+++ scummvm.cpp	18 Mar 2003 16:13:51 -0000	2.64
@@ -28,6 +28,7 @@
 #include "debugger.h"
 #include "dialogs.h"
 #include "imuse.h"
+#include "imuse_digi.h"
 #include "intern.h"
 #include "object.h"
 #include "resource.h"

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- sound.cpp	8 Mar 2003 00:05:27 -0000	1.96
+++ sound.cpp	18 Mar 2003 16:13:51 -0000	1.97
@@ -25,6 +25,7 @@
 #include "sound.h"
 #include "sound/mididrv.h"
 #include "imuse.h"
+#include "imuse_digi.h"
 #include "actor.h"
 #include "bundle.h"
 #include "common/config-file.h"
@@ -71,10 +72,8 @@
 
 void Sound::processSoundQues() {
 	int d;
-	int i, j;
 	int num;
 	int16 data[16];
-	IMuse *se;
 
 	processSfxQueues();
 
@@ -84,21 +83,18 @@
 			playSound(d);
 	}
 
-	for (i = 0; i < _soundQuePos;) {
+	for (int i = 0; i < _soundQuePos;) {
 		num = _soundQue[i++];
 		if (i + num > _soundQuePos) {
 			warning("processSoundQues: invalid num value");
 			break;
 		}
-		for (j = 0; j < 16; j++)
-			data[j] = 0;
+		memset(data, 0, sizeof(data));
 		if (num > 0) {
-			for (j = 0; j < num; j++)
+			for (int j = 0; j < num; j++)
 				data[j] = _soundQue[i + j];
 			i += num;
 
-			se = _scumm->_imuse;
-
 #if 0
 			debug(1, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
 						data[0] >> 8,
@@ -108,15 +104,15 @@
 #endif
 			
 			if (!(_scumm->_features & GF_AFTER_V7)) {
-				if (se)
+				if (_scumm->_imuse)
 					_scumm->_vars[_scumm->VAR_SOUNDRESULT] =
-						(short)se->do_command(data[0], data[1], data[2], data[3], data[4],
+						(short)_scumm->_imuse->doCommand(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]);
+																	data[5], data[6], data[7]);
 			}
 		}
 	}
@@ -180,8 +176,7 @@
 	int size;
 	int rate;
 	
-	debug(3,"playSound #%d (room %d)",
-		soundID, _scumm->getResourceRoomNr(rtSound, soundID));
+	debug(3,"playSound #%d (room %d)", soundID, _scumm->getResourceRoomNr(rtSound, soundID));
 	ptr = _scumm->getResourceAddress(rtSound, soundID);
 	if (ptr) {
 		if (READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')){
@@ -396,10 +391,9 @@
 	
 	}
 
-	IMuse *se = _scumm->_imuse;
-	if (se) {
+	if (_scumm->_imuse) {
 		_scumm->getResourceAddress(rtSound, soundID);
-		se->start_sound(soundID);
+		_scumm->_imuse->startSound(soundID);
 	}
 }
 
@@ -457,7 +451,7 @@
 	}
 }
 
-static int compar(const void *a, const void *b) {
+static int compareMP3OffsetTable(const void *a, const void *b) {
 	return ((MP3OffsetTable *)a)->org_offset - ((MP3OffsetTable *)b)->org_offset;
 }
 
@@ -510,7 +504,7 @@
 
 		key.org_offset = offset;
 		result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
-																				sizeof(MP3OffsetTable), compar);
+												sizeof(MP3OffsetTable), compareMP3OffsetTable);
 
 		if (result == NULL) {
 			warning("startTalkSound: did not find sound at offset %d !", offset);
@@ -573,7 +567,6 @@
 
 
 int Sound::isSoundRunning(int sound) {
-	IMuse *se;
 	int i;
 
 	if (sound == _scumm->current_cd_sound)
@@ -595,10 +588,9 @@
 		return _scumm->_imuseDigital->getSoundStatus(sound);
 	}
 
-	se = _scumm->_imuse;
-	if (!se)
+	if (!_scumm->_imuse)
 		return 0;
-	return se->get_sound_status(sound);
+	return _scumm->_imuse->get_sound_status(sound);
 }
 
 // This is exactly the same as isSoundRunning except that it
@@ -606,7 +598,6 @@
 // This is necessary when determining what resources to
 // expire from memory.
 bool Sound::isSoundActive(int sound) {
-	IMuse *se;
 	int i;
 
 	if (sound == _scumm->current_cd_sound)
@@ -628,10 +619,9 @@
 		return _scumm->_imuseDigital->getSoundStatus(sound) != 0;
 	}
 
-	se = _scumm->_imuse;
-	if (!se)
+	if (!_scumm->_imuse)
 		return false;
-	return se->get_sound_active(sound);
+	return _scumm->_imuse->get_sound_active(sound);
 }
 
 bool Sound::isSoundInQueue(int sound) {
@@ -655,7 +645,6 @@
 }
 
 void Sound::stopSound(int a) {
-	IMuse *se;
 	int i;
 
 	if (a != 0 && a == _scumm->current_cd_sound) {
@@ -665,10 +654,8 @@
 
 	if (_scumm->_imuseDigital) {
 		_scumm->_imuseDigital->stopSound(a);
-	} else {
-		se = _scumm->_imuse;
-		if (se)
-			se->stop_sound(a);
+	} else if (_scumm->_imuse) {
+		_scumm->_imuse->stopSound(a);
 	}
 
 	for (i = 0; i < 10; i++)
@@ -677,16 +664,14 @@
 }
 
 void Sound::stopAllSounds() {
-	IMuse *se = _scumm->_imuse;
-
 	if (_scumm->current_cd_sound != 0) {
 		_scumm->current_cd_sound = 0;
 		stopCD();
 	}
 
-	if (se) {
-		se->stop_all_sounds();
-		se->clear_queue();
+	if (_scumm->_imuse) {
+		_scumm->_imuse->stop_all_sounds();
+		_scumm->_imuse->clear_queue();
 	}
 	clearSoundQue();
 	stopSfxSound();
@@ -706,7 +691,7 @@
 	}
 
 	if ((_soundQuePos + num) > 0x100) {
-		warning("Sound que buffer overflow");
+		warning("Sound que buffer overflow (%d + %d = %d)", _soundQuePos, num, _soundQuePos+num);
 		return;
 	}
 
@@ -754,9 +739,8 @@
 }
 
 void Sound::pauseSounds(bool pause) {
-	IMuse *se = _scumm->_imuse;
-	if (se)
-		se->pause(pause);
+	if (_scumm->_imuse)
+		_scumm->_imuse->pause(pause);
 
 	// Don't pause sounds if the game isn't active
 	// FIXME - this is quite a nasty hack, replace with something cleaner, and w/o





More information about the Scummvm-git-logs mailing list