[Scummvm-cvs-logs] SF.net SVN: scummvm:[41787] scummvm/trunk/engines/cruise

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Tue Jun 23 03:01:16 CEST 2009


Revision: 41787
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41787&view=rev
Author:   dreammaster
Date:     2009-06-23 01:01:16 +0000 (Tue, 23 Jun 2009)

Log Message:
-----------
Bugfixes to keep sound effects to channel #4 like the original (it ignores the channel parameter to the given library routine)

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/function.cpp
    scummvm/trunk/engines/cruise/sound.cpp
    scummvm/trunk/engines/cruise/sound.h

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2009-06-22 23:09:28 UTC (rev 41786)
+++ scummvm/trunk/engines/cruise/function.cpp	2009-06-23 01:01:16 UTC (rev 41787)
@@ -209,7 +209,7 @@
 		if (speed == -1)
 			speed = filesDatabase[sampleNum].subData.transparency;
 
-		_vm->sound().playSound(channelNum, filesDatabase[sampleNum].subData.ptr,
+		_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
 			filesDatabase[sampleNum].width, volume);
 	}
 
@@ -226,7 +226,7 @@
 		if (speed == -1)
 			speed = filesDatabase[sampleNum].subData.transparency;
 
-		_vm->sound().playSound(channelNum, filesDatabase[sampleNum].subData.ptr,
+		_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
 			filesDatabase[sampleNum].width, volume);
 	}
 

Modified: scummvm/trunk/engines/cruise/sound.cpp
===================================================================
--- scummvm/trunk/engines/cruise/sound.cpp	2009-06-22 23:09:28 UTC (rev 41786)
+++ scummvm/trunk/engines/cruise/sound.cpp	2009-06-23 01:01:16 UTC (rev 41787)
@@ -127,8 +127,8 @@
 	Audio::SoundHandle _soundHandle;
 
 	byte _vibrato;
-	int _channelsVolumeTable[4];
-	AdlibSoundInstrument _instrumentsTable[4];
+	int _channelsVolumeTable[5];
+	AdlibSoundInstrument _instrumentsTable[5];
 
 	static const int _freqTable[];
 	static const int _freqTableCount;
@@ -284,7 +284,7 @@
 }
 
 void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrument, int volume) {
-	assert(channel < 4);
+	assert(channel < 5);
 	if (data) {
 		if (volume > 80) {
 			volume = 80;
@@ -301,7 +301,7 @@
 }
 
 void AdlibSoundDriver::stopChannel(int channel) {
-	assert(channel < 4);
+	assert(channel < 5);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
 	if (ins->mode != 0 && ins->channel == 6) {
 		channel = 6;
@@ -376,7 +376,7 @@
 }
 
 void AdlibSoundDriver::setupInstrument(const byte *data, int channel) {
-	assert(channel < 4);
+	assert(channel < 5);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
 	loadInstrument(data, ins);
 
@@ -465,7 +465,7 @@
 }
 
 void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) {
-	assert(channel < 4);
+	assert(channel < 5);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
 	if (ins->mode != 0) {
 		channel = ins->channel;
@@ -500,7 +500,7 @@
 }
 
 void AdlibSoundDriverADL::playSample(const byte *data, int size, int channel, int volume) {
-	assert(channel < 4);
+	assert(channel < 5);
 	_channelsVolumeTable[channel] = 127;
 	setupInstrument(data, channel);
 	AdlibSoundInstrument *ins = &_instrumentsTable[channel];
@@ -725,6 +725,8 @@
 	_mixer = mixer;
 	_soundDriver = new AdlibSoundDriverADL(_mixer);
 	_player = new PCSoundFxPlayer(_soundDriver);
+	_musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
+	_sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
 }
 
 PCSound::~PCSound() {
@@ -757,9 +759,9 @@
 	_player->fadeOut();
 }
 
-void PCSound::playSound(int channel, const uint8 *data, int size, int volume) {
-	debugC(5, kCruiseDebugSound, "PCSound::playSound() channel %d size %d", channel, size);
-	_soundDriver->playSample(data, size, channel, volume);
+void PCSound::playSound(const uint8 *data, int size, int volume) {
+	debugC(5, kCruiseDebugSound, "PCSound::playSound() channel %d size %d", 4, size);
+	_soundDriver->playSample(data, size, 4, volume);
 }
 
 void PCSound::stopSound(int channel) {

Modified: scummvm/trunk/engines/cruise/sound.h
===================================================================
--- scummvm/trunk/engines/cruise/sound.h	2009-06-22 23:09:28 UTC (rev 41786)
+++ scummvm/trunk/engines/cruise/sound.h	2009-06-23 01:01:16 UTC (rev 41787)
@@ -29,6 +29,8 @@
 #include "sound/mididrv.h"
 #include "sound/midiparser.h"
 #include "sound/mixer.h"
+
+#include "common/config-manager.h"
 #include "common/serializer.h"
 
 namespace Cruise {
@@ -42,6 +44,8 @@
 	Audio::Mixer *_mixer;
 	CruiseEngine *_vm;
 	int _genVolume;
+	uint8 _musicVolume;
+	uint8 _sfxVolume;
 protected:
 	PCSoundDriver *_soundDriver;
 	PCSoundFxPlayer *_player;
@@ -55,7 +59,7 @@
 	virtual void removeMusic();
 	virtual void fadeOutMusic();
 
-	virtual void playSound(int channel, const uint8 *data, int size, int volume);
+	virtual void playSound(const uint8 *data, int size, int volume);
 	virtual void stopSound(int channel);
 	
 	void doSync(Common::Serializer &s);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list