[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.69,1.70 imuse.cpp,2.89,2.90 imuse.h,1.43,1.44 imuse_digi.cpp,1.43,1.44 imuse_digi.h,1.12,1.13 imuse_internal.h,2.19,2.20 music.h,2.3,2.4 player_v2.cpp,2.26,2.27 player_v2.h,2.13,2.14 player_v3a.cpp,1.4,1.5 player_v3a.h,1.3,1.4 saveload.cpp,1.106,1.107 script_v6.cpp,1.182,1.183 sound.cpp,1.238,1.239 sound.h,1.45,1.46

Max Horn fingolfin at users.sourceforge.net
Sun Sep 7 12:30:02 CEST 2003


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

Modified Files:
	dialogs.cpp imuse.cpp imuse.h imuse_digi.cpp imuse_digi.h 
	imuse_internal.h music.h player_v2.cpp player_v2.h 
	player_v3a.cpp player_v3a.h saveload.cpp script_v6.cpp 
	sound.cpp sound.h 
Log Message:
cleanup/refactoring

Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- dialogs.cpp	20 Aug 2003 14:01:39 -0000	1.69
+++ dialogs.cpp	7 Sep 2003 19:28:45 -0000	1.70
@@ -536,10 +536,10 @@
 		
 		if (_scumm->_imuse) {
 			_scumm->_imuse->set_music_volume(_soundVolumeMusic);
-			_scumm->_imuse->set_master_volume(_soundVolumeMaster);
+			_scumm->_imuse->setMasterVolume(_soundVolumeMaster);
 		}
 		if (_scumm->_playerV2) {
-			_scumm->_playerV2->set_master_volume(_soundVolumeMaster);
+			_scumm->_playerV2->setMasterVolume(_soundVolumeMaster);
 		}
 
 		_scumm->_mixer->setVolume(_soundVolumeSfx * _soundVolumeMaster / 255);

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.89
retrieving revision 2.90
diff -u -d -r2.89 -r2.90
--- imuse.cpp	7 Sep 2003 17:14:55 -0000	2.89
+++ imuse.cpp	7 Sep 2003 19:28:45 -0000	2.90
@@ -588,7 +588,7 @@
 	return 0;
 }
 
-int IMuseInternal::set_master_volume(uint vol) {
+int IMuseInternal::setMasterVolume(uint vol) {
 	if (vol > 255)
 		vol = 255;
 	if (_master_volume == vol)
@@ -689,7 +689,7 @@
 			if (a[1] > 127)
 				return -1;
 			else
-				return set_master_volume((a[1] << 1) |(a[1] ? 0 : 1)); // Convert from 0-127 to 0-255
+				return setMasterVolume((a[1] << 1) |(a[1] ? 0 : 1)); // Convert from 0-127 to 0-255
 		case 7:
 			return _master_volume >> 1; // Convert from 0-255 to 0-127
 		case 8:
@@ -1359,7 +1359,7 @@
 		// Load all sounds that we need
 		fix_players_after_load(scumm);
 		fix_parts_after_load();
-		set_master_volume(_master_volume);
+		setMasterVolume(_master_volume);
 
 		if (_midi_native)
 			reallocateMidiChannels(_midi_native);
@@ -1752,11 +1752,11 @@
 int IMuse::save_or_load(Serializer *ser, Scumm *scumm) { in(); int ret = _target->save_or_load(ser, scumm); out(); return ret; }
 int IMuse::set_music_volume(uint vol) { in(); int ret = _target->set_music_volume(vol); out(); return ret; }
 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::setMasterVolume(uint vol) { in(); int ret = _target->setMasterVolume(vol); out(); return ret; }
 int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
 void IMuse::startSound(int sound) { in(); _target->startSound(sound); out(); }
 void IMuse::stopSound(int sound) { in(); _target->stopSound(sound); out(); }
-int IMuse::stopAllSounds() { in(); int ret = _target->stopAllSounds(); out(); return ret; }
+void IMuse::stopAllSounds() { in(); _target->stopAllSounds(); out(); }
 int IMuse::getSoundStatus(int sound) const { in(); int ret = _target->getSoundStatus(sound, true); out(); return ret; }
 bool IMuse::get_sound_active(int sound) const { in(); bool ret = _target->getSoundStatus(sound, false) ? 1 : 0; out(); return ret; }
 int IMuse::getMusicTimer() { in(); int ret = _target->getMusicTimer(); out(); return ret; }

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- imuse.h	7 Sep 2003 17:14:56 -0000	1.43
+++ imuse.h	7 Sep 2003 19:28:45 -0000	1.44
@@ -61,11 +61,11 @@
 	int save_or_load(Serializer *ser, Scumm *scumm);
 	int set_music_volume(uint vol);
 	int get_music_volume();
-	int set_master_volume(uint vol);
+	int setMasterVolume(uint vol);
 	int get_master_volume();
 	void startSound(int sound);
 	void stopSound(int sound);
-	int stopAllSounds();
+	void stopAllSounds();
 	int getSoundStatus(int sound) const;
 	bool get_sound_active(int sound) const;
 	int getMusicTimer();

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- imuse_digi.cpp	7 Sep 2003 17:14:56 -0000	1.43
+++ imuse_digi.cpp	7 Sep 2003 19:28:45 -0000	1.44
@@ -931,7 +931,7 @@
 	}
 }
 
-void IMuseDigital::stopAll() {
+void IMuseDigital::stopAllSounds() {
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if (_channel[l]._used) {
 			_channel[l]._toBeRemoved = true;
@@ -956,7 +956,7 @@
 	switch (cmd) {
 	case 10:
 		debug(5, "ImuseStopAllSounds()");
-		stopAll();
+		stopAllSounds();
 		return 0;
 	case 12: // ImuseSetParam
 		switch (sub_cmd) {

Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- imuse_digi.h	7 Sep 2003 17:14:56 -0000	1.12
+++ imuse_digi.h	7 Sep 2003 19:28:45 -0000	1.13
@@ -69,7 +69,7 @@
 	void handler();
 	void startSound(int sound);
 	void stopSound(int sound);
-	void stopAll();
+	void stopAllSounds();
 	void pause(bool pause);
 	int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
 	int getSoundStatus(int sound) const;

Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -d -r2.19 -r2.20
--- imuse_internal.h	7 Sep 2003 17:14:56 -0000	2.19
+++ imuse_internal.h	7 Sep 2003 19:28:45 -0000	2.20
@@ -457,7 +457,7 @@
 	int save_or_load(Serializer *ser, Scumm *scumm);
 	int set_music_volume(uint vol);
 	int get_music_volume();
-	int set_master_volume(uint vol);
+	int setMasterVolume(uint vol);
 	int get_master_volume();
 	bool startSound(int sound);
 	int stopSound(int sound);

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/music.h,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -d -r2.3 -r2.4
--- music.h	7 Sep 2003 17:14:56 -0000	2.3
+++ music.h	7 Sep 2003 19:28:45 -0000	2.4
@@ -29,11 +29,14 @@
 class MusicEngine {
 public:
 	virtual ~MusicEngine() {}
-	
+
+//	virtual void setMasterVolume(int vol) = 0;
+
 	virtual void startSound(int sound) = 0;
 	virtual void stopSound(int sound) = 0;
-//	virtual void stopAllSounds() = 0;
-	virtual int getSoundStatus(int sound) const = 0;
+	virtual void stopAllSounds() = 0;
+	virtual int  getSoundStatus(int sound) const = 0;
+//	virtual int  getMusicTimer() const = 0;
 };
 
 #endif

Index: player_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.cpp,v
retrieving revision 2.26
retrieving revision 2.27
diff -u -d -r2.26 -r2.27
--- player_v2.cpp	7 Sep 2003 17:14:56 -0000	2.26
+++ player_v2.cpp	7 Sep 2003 19:28:45 -0000	2.27
@@ -364,7 +364,7 @@
 	_RNG = NG_PRESET;
 
 	set_pcjr(scumm->_midiDriver != MD_PCSPK);
-	set_master_volume(255);
+	setMasterVolume(255);
 
 	_mixer->setupPremix(this, premix_proc);
 }
@@ -406,7 +406,7 @@
 	mutex_down();
 }
 
-void Player_V2::set_master_volume (int vol) {
+void Player_V2::setMasterVolume (int vol) {
 	if (vol > 255)
 		vol = 255;
 

Index: player_v2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.h,v
retrieving revision 2.13
retrieving revision 2.14
diff -u -d -r2.13 -r2.14
--- player_v2.h	7 Sep 2003 17:14:56 -0000	2.13
+++ player_v2.h	7 Sep 2003 19:28:45 -0000	2.14
@@ -76,7 +76,7 @@
 	Player_V2(Scumm *scumm);
 	virtual ~Player_V2();
 
-	virtual void set_master_volume(int vol);
+	virtual void setMasterVolume(int vol);
 
 	virtual void startSound(int nr);
 	virtual void stopSound(int nr);

Index: player_v3a.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- player_v3a.cpp	7 Sep 2003 17:14:56 -0000	1.4
+++ player_v3a.cpp	7 Sep 2003 19:28:45 -0000	1.5
@@ -70,7 +70,7 @@
 	free(_wavetable);
 }
 
-void Player_V3A::set_master_volume (int vol) {
+void Player_V3A::setMasterVolume (int vol) {
 	_maxvol = vol;
 }
 
@@ -132,7 +132,8 @@
 	vol = (vol * _maxvol) / 255;
 	if (looped)
 		_mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP, nr, vol, 0, loopStart, loopEnd);
-	else	_mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE, nr, vol, 0);
+	else
+		_mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE, nr, vol, 0);
 }
 
 void Player_V3A::startSound(int nr) {
@@ -286,7 +287,8 @@
 		if (!_lastSample)
 			_lastSample++;
 		int id = (_curSong << 8) | _lastSample++;
-		playSound(id,data,_wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct],3579545 / _notefreqs[_wavetable[inst]->_oct[oct]][pit],255,dur,(_wavetable[inst]->_ldat[oct] != NULL),_wavetable[inst]->_ilen[oct],_wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]);
+		playSound(id, data, _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct], 3579545 / _notefreqs[_wavetable[inst]->_oct[oct]][pit], 255, dur,
+					(_wavetable[inst]->_ldat[oct] != NULL), _wavetable[inst]->_ilen[oct], _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]);
 	}
 }
 

Index: player_v3a.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- player_v3a.h	7 Sep 2003 17:14:56 -0000	1.3
+++ player_v3a.h	7 Sep 2003 19:28:45 -0000	1.4
@@ -37,7 +37,7 @@
 	Player_V3A(Scumm *scumm);
 	virtual ~Player_V3A();
 
-	virtual void set_master_volume(int vol);
+	virtual void setMasterVolume(int vol);
 
 	virtual void startSound(int nr);
 	virtual void stopSound(int nr);

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- saveload.cpp	5 Sep 2003 07:36:05 -0000	1.106
+++ saveload.cpp	7 Sep 2003 19:28:45 -0000	1.107
@@ -117,7 +117,7 @@
 	memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
 
 	if (_imuseDigital) {
-		_imuseDigital->stopAll();
+		_imuseDigital->stopAllSounds();
 	}
 
 	_sound->stopBundleMusic();
@@ -546,13 +546,6 @@
 
 	if (!s->isSaving() && (_saveSound || !_saveLoadCompatible)) {
 		_sound->stopAllSounds();
-		if (_mixer) {
-			if (_imuseDigital) {
-				_imuseDigital->stopAll();
-			} else {
-				_mixer->stopAll();
-			}
-		}
 	}
 
 	// Because old savegames won't fill the entire gfxUsageBits[] array,
@@ -667,8 +660,8 @@
 	
 	if (_imuse && (_saveSound || !_saveLoadCompatible)) {
 		_imuse->save_or_load(s, this);
-		_imuse->set_master_volume (_sound->_sound_volume_master);
-		_imuse->set_music_volume (_sound->_sound_volume_music);
+		_imuse->setMasterVolume(_sound->_sound_volume_master);
+		_imuse->set_music_volume(_sound->_sound_volume_music);
 	}
 }
 

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- script_v6.cpp	3 Sep 2003 08:55:24 -0000	1.182
+++ script_v6.cpp	7 Sep 2003 19:28:45 -0000	1.183
@@ -2390,7 +2390,7 @@
 			break;
 		case 6: {
 //				if (_imuseDigital) {
-//					_imuseDigital->stopAll();
+//					_imuseDigital->stopAllSounds();
 //				}
 				uint32 speed;
 				assert(getStringAddressVar(VAR_VIDEONAME));

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -d -r1.238 -r1.239
--- sound.cpp	7 Sep 2003 17:14:56 -0000	1.238
+++ sound.cpp	7 Sep 2003 19:28:45 -0000	1.239
@@ -208,7 +208,6 @@
 		int track = ptr[0];
 		int loops = ptr[1];
 		int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4];
-		_scumm->VAR(_scumm->VAR_MUSIC_TIMER) = 0;
 		playCDTrack(track, loops == 0xff ? -1 : loops, start, 0);
 
 		_currentCDSound = soundID;
@@ -772,13 +771,16 @@
 		_scumm->_playerV3A->stopAllSounds();
 	}
 
-	clearSoundQue();
-	stopSfxSound();
-}
-
-void Sound::clearSoundQue() {
+	// Clear the (secondary) sound queue
 	_soundQue2Pos = 0;
 	memset(_soundQue2, 0, sizeof(_soundQue2));
+
+	// Stop all SFX
+	if (_scumm->_imuseDigital) {
+		_scumm->_imuseDigital->stopAllSounds();
+	} else {
+		_scumm->_mixer->stopAll();
+	}
 }
 
 void Sound::soundKludge(int *list, int num) {
@@ -831,7 +833,7 @@
 	if (_scumm->_imuse) {
 		_scumm->_imuse->setBase(_scumm->res.address[rtSound]);
 
-		_scumm->_imuse->set_master_volume(_sound_volume_master);
+		_scumm->_imuse->setMasterVolume(_sound_volume_master);
 		_scumm->_imuse->set_music_volume(_sound_volume_music);
 	}
 	_scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255);
@@ -1014,14 +1016,6 @@
 	return file;
 }
 
-void Sound::stopSfxSound() {
-	if (_scumm->_imuseDigital) {
-		_scumm->_imuseDigital->stopAll();
-	} else {
-		_scumm->_mixer->stopAll();
-	}
-}
-
 bool Sound::isSfxFinished() const {
 	return !_scumm->_mixer->hasActiveSFXChannel();
 }
@@ -1625,9 +1619,9 @@
 
 	if (!_dig_cd.handle) {
 		if (_dig_cd.numLoops == -1 || --_dig_cd.numLoops > 0)
-			playMP3CDTrack(_dig_cd.track, _dig_cd.numLoops, _dig_cd.start, _dig_cd.duration);
+			playCDTrack(_dig_cd.track, _dig_cd.numLoops, _dig_cd.start, _dig_cd.duration);
 		else
-			stopMP3CD();
+			stopCD();
 	}
 
 	return 0;

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- sound.h	7 Sep 2003 17:14:56 -0000	1.45
+++ sound.h	7 Sep 2003 19:28:45 -0000	1.46
@@ -152,11 +152,8 @@
 	int getCurrentCDSound() const { return _currentCDSound; }
 
 protected:
-	void clearSoundQue();
-
 	File *openSfxFile();
 	void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle);
-	void stopSfxSound();
 	bool isSfxFinished() const;
 	void playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned, PlayingSoundHandle *handle);
 	void playSfxSound_Vorbis(void *sound, uint32 size, PlayingSoundHandle *handle);





More information about the Scummvm-git-logs mailing list