[Scummvm-cvs-logs] scummvm master -> d1a30b41b1bb0bc001751e8a4dcfcdb1044826ad

dreammaster dreammaster at scummvm.org
Sat Jul 2 05:54:03 CEST 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ab7fdccc3b TSAGE: Beginnings of SoundBlaster sound driver
160a8d96d9 TSAGE: Fixed problem with saving double values
d1a30b41b1 TSAGE: Linked in the (in progress) SoundBlaster Fx class


Commit: ab7fdccc3b69d6ded7eb0c978da8804901ff95a9
    https://github.com/scummvm/scummvm/commit/ab7fdccc3b69d6ded7eb0c978da8804901ff95a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-07-01T17:39:57-07:00

Commit Message:
TSAGE: Beginnings of SoundBlaster sound driver

Changed paths:
    engines/tsage/sound.cpp
    engines/tsage/sound.h



diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 01e770a..7f454bf 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -126,7 +126,10 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
 	assert(__sndmgrReady);
 	_availableDrivers.clear();
 
-	// Build up a list of available drivers. Currently we only implement an Adlib driver
+	// Build up a list of available drivers. Currently we only implement an Adlib music 
+	// and SoundBlaster FX driver
+
+	// Adlib driver
 	SoundDriverEntry sd;
 	sd.driverNum = ADLIB_DRIVER_NUM;
 	sd.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
@@ -136,12 +139,23 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
 	sd.longDescription = "3812fm";
 	_availableDrivers.push_back(sd);
 
+	// SoundBlaster entry
+	SoundDriverEntry sdFx;
+	sdFx.driverNum = SBLASTER_DRIVER_NUM;
+	sdFx.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
+	sdFx.field2 = 0;
+	sdFx.field6 = 15000;
+	sdFx.shortDescription = "SndBlast";
+	sdFx.longDescription = "SoundBlaster";
+	_availableDrivers.push_back(sdFx);
+
 	_driversDetected = true;
 	return _availableDrivers;
 }
 
 void SoundManager::installConfigDrivers() {
 	installDriver(ADLIB_DRIVER_NUM);
+	installDriver(SBLASTER_DRIVER_NUM);
 }
 
 Common::List<SoundDriverEntry> &SoundManager::getDriverList(bool detectFlag) {
@@ -2125,7 +2139,7 @@ void Sound::_soProc32(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voice
 		vtStruct->_entries[entryIndex]._type1._field4 = v0;
 		vtStruct->_entries[entryIndex]._type1._field5 = 0;
 
-		driver->proc32(vtStruct->_entries[entryIndex]._voiceNum, _chProgram[channelNum], v0, v1);
+		driver->proc32(this, vtStruct->_entries[entryIndex]._voiceNum, _chProgram[channelNum], v0, v1);
 	}
 }
 
@@ -2143,8 +2157,9 @@ void Sound::_soProc42(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voice
 				vtStruct->_entries[entryIndex]._type1._field4 = v0;
 				vtStruct->_entries[entryIndex]._type1._field5 = 0;
 
-				driver->proc32(vtStruct->_entries[entryIndex]._voiceNum, -1, v0, 0x7F);
-				driver->proc42(vtStruct->_entries[entryIndex]._voiceNum, voiceType, 0);
+				int v1, v2;
+				driver->proc32(this, vtStruct->_entries[entryIndex]._voiceNum, -1, v0, 0x7F);
+				driver->proc42(vtStruct->_entries[entryIndex]._voiceNum, voiceType, 0, &v1, &v2);
 			}
 			break;
 		}
@@ -2271,11 +2286,33 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
 						vtStruct->_entries[entryIndex]._type1._field4 = *(channelData + 1);
 						vtStruct->_entries[entryIndex]._type1._field5 = 0;
 
-						driver->proc32(vtStruct->_entries[entryIndex]._voiceNum, -1, *(channelData + 1), 0x7f);
+						int v1, v2;
+						driver->proc32(this, vtStruct->_entries[entryIndex]._voiceNum, -1, *(channelData + 1), 0x7f);
+						driver->proc42(vtStruct->_entries[entryIndex]._voiceNum, *(channelData + 1), _loop ? 1 : 0,
+							&v1, &v2);
 					}
 				} else {
+					int channel = 0; // Is this correct?!
+					for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
+						VoiceStructEntry &vte = vtStruct->_entries[entryIndex];
+						VoiceStructEntryType1 &vse = vte._type1;
+						if ((vse._sound == this) && (vse._channelNum == channel) && (vse._field4 == vtStruct->_total)) {
+							SoundDriver *driver = vte._driver;
+
+							int v1, v2;
+							driver->proc42(vte._voiceNum, vtStruct->_total, _loop ? 1 : 0, &v1, &v2);
+							if (v2) {
+								_trkState[trackIndex] = 0;
+							} else if (vtStruct->_total) {
+								_timer = 0;
+							}
+						}
+					}
 
+					_trkState[trackIndex] = 0;
 				}
+			} else {
+				_trkState[trackIndex] = 0;
 			}
 		}
 	}
@@ -2511,7 +2548,7 @@ int AdlibSoundDriver::setMasterVolume(int volume) {
 	return oldVolume;
 }
 
-void AdlibSoundDriver::proc32(int channel, int program, int v0, int v1) {
+void AdlibSoundDriver::proc32(Sound *sound, int channel, int program, int v0, int v1) {
 	if (program == -1)
 		return;
 
@@ -2735,7 +2772,7 @@ AdlibFxSoundDriver::AdlibFxSoundDriver(): SoundDriver() {
 	_maxVersion = 0x10A;
 	_masterVolume = 0;
 
-	_groupData.groupMask = 9;
+	_groupData.groupMask = 1;
 	_groupData.v1 = 0x3E;
 	_groupData.v2 = 0;
 	_groupData.pData = &adlib_group_data[0];
@@ -2765,31 +2802,25 @@ AdlibFxSoundDriver::~AdlibFxSoundDriver() {
 }
 
 bool AdlibFxSoundDriver::open() {
+	write209();
+	write(64);
+	write(165);
 
+	// for (int idx = 0; idx < 5000 * 16; ++idx) al = port[21h]
 
-	write(1, 0x20);
-	if (!reset())
-		return false;
+//	_v45071 = 1;
+//	_v4506F = 0;
 
-	write(8, 0);
-	for (int idx = 0x20; idx < 0xF6; ++idx)
-		write(idx, 0);
-
-	write(0xBD, 0);
 	return true;
 }
 
 void AdlibFxSoundDriver::close() {
-	for (int idx = 0xB0; idx < 0xB8; ++idx)
-		write(idx, _portContents[idx] & 0xDF);
-	for (int idx = 0x40; idx < 0x55; ++idx)
-		write(idx, 0x3F);
-	reset();
+	write(208);
+	write211();
+
 }
 
 bool AdlibFxSoundDriver::reset() {
-	write(1, 0x20);
-	write(1, 0x20);
 
 	return true;
 }
@@ -2798,77 +2829,72 @@ const GroupData *AdlibFxSoundDriver::getGroupData() {
 	return &_groupData;
 }
 
+void AdlibFxSoundDriver::poll() {
+	if (!_masterVolume || !_channelVolume) {
+		if (_v45046)
+			write211();
+	} else {
+		if (!_v45046)
+			write209();
+	}
+}
+
 int AdlibFxSoundDriver::setMasterVolume(int volume) {
 	int oldVolume = _masterVolume;
 	_masterVolume = volume;
 
-	for (int channelNum = 0; channelNum < ADLIB_CHANNEL_COUNT; ++channelNum)
-		updateChannelVolume(channelNum);
-
 	return oldVolume;
 }
 
-void AdlibFxSoundDriver::proc32(int channel, int program, int v0, int v1) {
+void AdlibFxSoundDriver::proc32(Sound *sound, int channel, int program, int v0, int v1) {
 	if (program == -1)
 		return;
-/*
-	int offset = READ_LE_UINT16(_patchData + program * 2);
-	if (offset) {
-		const byte *dataP = _patchData + offset;
-		int id;
-
-		for (offset = 2, id = 0; id != READ_LE_UINT16(dataP); offset += 30, ++id) {
-			if ((dataP[offset] <= v0) && (dataP[offset + 1] >= v0)) {
-				if (dataP[offset + 2] != 0xff)
-					v0 = dataP[offset + 2];
 
-				_v4409E[channel] = dataP + offset - _patchData;
+	if (_sound)
+		updateVoice(channel);
 
-				// Set sustain/release
-				int portNum = v440C2[v440B0[channel]] + 0x80;
-				write(portNum, (_portContents[portNum] & 0xF0) | 0xF);
+	// TODO: Stuff
 
-				portNum = v440C2[v440B9[channel]] + 0x80;
-				write(portNum, (_portContents[portNum] & 0xF0) | 0xF);
 
-				if (_channelVoiced[channel])
-					clearVoice(channel);
 
-				_v44067[channel] = v0;
-				_v4405E[channel] = v1;
-
-				updateChannel(channel);
-				setFrequency(channel);
-				updateChannelVolume(channel);
-				setVoice(channel);
-				break;
-			}
-		}
-	}
-	*/
 }
 
 void AdlibFxSoundDriver::updateVoice(int channel) {
-	if (_channelVoiced[channel])
-		clearVoice(channel);
+	if (_sound) {
+		write(208);
+
+		_sound = NULL;
+		_v45062 = 0;
+		_v45066 = 0;
+		_v45068 = 0;
+	}
 }
 
 void AdlibFxSoundDriver::proc38(int channel, int cmd, int value) {
 	if (cmd == 7) {
 		// Set channel volume
-		_channelVolume[channel] = value;
-		updateChannelVolume(channel);
+		_channelVolume = value;
 	}
 }
 
-void AdlibFxSoundDriver::setPitch(int channel, int pitchBlend) {
-	_pitchBlend[channel] = pitchBlend;
-	setFrequency(channel);
+void AdlibFxSoundDriver::proc42(int channel, int cmd, int value, int *v1, int *v2) {
+	_v4506A = value;
+	*v1 = _v4506B;
+	*v2 = 0;
+	_v4506B = 0;
+
+	if (!_sound)
+		*v2 = 1;
 }
 
-void AdlibFxSoundDriver::write(byte reg, byte value) {
-	_portContents[reg] = value;
-	_queue.push(RegisterValue(reg, value));
+void AdlibFxSoundDriver::write(int v) {
+	/*
+	port[adlib_port + 12] = v;
+	for (int i = 0; i < 100; ++i) {
+		if (!port[adlib_port + 12] & 0x80)
+			break;
+	}
+	*/
 }
 
 void AdlibFxSoundDriver::flush() {
@@ -2880,127 +2906,7 @@ void AdlibFxSoundDriver::flush() {
 	}
 }
 
-void AdlibFxSoundDriver::updateChannelVolume(int channelNum) {
-	int volume = (_masterVolume * _channelVolume[channelNum] / 127 * _v4405E[channelNum] / 127) / 2;
-	int level2 = 63 - v44134[volume * _v44079[channelNum] / 63];
-	int level1 = !_v44082[channelNum] ? 63 - _v44070[channelNum] :
-		63 - v44134[volume * _v44070[channelNum] / 63];
-
-	int portNum = v440C2[v440B0[channelNum]] + 0x40;
-	write(portNum, (_portContents[portNum] & 0x80) | level1);
-
-	portNum = v440C2[v440B9[channelNum]] + 0x40;
-	write(portNum, (_portContents[portNum] & 0x80) | level2);
-}
-
-void AdlibFxSoundDriver::setVoice(int channel) {
-	int portNum = 0xB0 + channel;
-	write(portNum, _portContents[portNum] | 0x20);
-	_channelVoiced[channel] = true;
-}
-
-void AdlibFxSoundDriver::clearVoice(int channel) {
-	write(0xB0 + channel, _portContents[0xB0 + channel] & ~0x20);
-	_channelVoiced[channel] = false;
-}
-
-void AdlibFxSoundDriver::updateChannel(int channel) {
-/*
-	const byte *dataP = _patchData + _v4409E[channel];
-	int portOffset = v440C2[v440B0[channel]];
-
-	int portNum = portOffset + 0x20;
-	int portValue = 0;
-	if (*(dataP + 4))
-		portValue |= 0x80;
-	if (*(dataP + 5))
-		portValue |= 0x40;
-	if (*(dataP + 8))
-		portValue |= 0x20;
-	if (*(dataP + 6))
-		portValue |= 0x10;
-	portValue |= *(dataP + 7);
-	write(portNum, portValue);
-
-	portValue = (_portContents[0x40 + portOffset] & 0x3F) | (*(dataP + 9) << 6);
-	write(0x40 + portOffset, portValue);
-
-	_v44070[channel] = 63 - *(dataP + 10);
-	write(0x60 + portOffset, *(dataP + 12) | (*(dataP + 11) << 4));
-	write(0x80 + portOffset, *(dataP + 14) | (*(dataP + 13) << 4));
-	write(0xE0 + portOffset, (_portContents[0xE0 + portOffset] & 0xFC) | *(dataP + 15));
-
-	portOffset = v440C2[v440B9[channel]];
-	portNum = portOffset + 0x20;
-	portValue = 0;
-	if (*(dataP + 17))
-		portValue |= 0x80;
-	if (*(dataP + 18))
-		portValue |= 0x40;
-	if (*(dataP + 21))
-		portValue |= 0x20;
-	if (*(dataP + 19))
-		portValue |= 0x10;
-	portValue |= *(dataP + 20);
-	write(portNum, portValue);
-
-	write(0x40 + portOffset, (_portContents[0x40 + portOffset] & 0x3f) | (*(dataP + 22) << 6));
-	_v44079[channel] = 0x3F - *(dataP + 23);
-	write(0x60 + portOffset, *(dataP + 25) | (*(dataP + 24) << 4));
-	write(0x80 + portOffset, *(dataP + 27) | (*(dataP + 26) << 4));
-	write(0xE0 + portOffset, (_portContents[0xE0 + portOffset] & 0xFC) | *(dataP + 28));
-
-	write(0xC0 + channel, (_portContents[0xC0 + channel] & 0xF0)
-		| (*(dataP + 16) << 1) | *(dataP + 3));
-
-	_v44082[channel] = *(dataP + 3);
-	*/
-}
-
-void AdlibFxSoundDriver::setFrequency(int channel) {
-	int offset, ch;
-
-	int v = _pitchBlend[channel];
-	if (v == 0x2000) {
-		offset = 0;
-		ch = _v44067[channel];
-	} else if (v > 0x2000) {
-		ch = _v44067[channel];
-		v -= 0x2000;
-		if (v == 0x1fff)
-			v = 0x2000;
-
-		offset = (v / 170) & 3;
-		ch += (v / 170) >> 2;
-
-		if (ch >= 128)
-			ch = 127;
-	} else {
-		ch = _v44067[channel];
-		int tempVal = (0x2000 - v) / 170;
-		int tempVal2 = 4 - (tempVal & 3);
-
-		if (tempVal2 == 4)
-			offset = 0;
-		else {
-			offset = tempVal2;
-			--ch;
-		}
-
-		ch -= tempVal >> 2;
-		if (ch < 0)
-			ch = 0;
-	}
-
-	int var2 = ch / 12;
-	if (var2)
-		--var2;
 
-	int dataWord = v440D4[((ch % 12) << 2) + offset];
-	write(0xA0 + channel, dataWord & 0xff);
-	write(0xB0 + channel, (_portContents[0xB0 + channel] & 0xE0) |
-		((dataWord >> 8) & 3) | (var2 << 2));
-}
 
 int AdlibFxSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
 	update(buffer, numSamples);
@@ -3025,4 +2931,14 @@ void AdlibFxSoundDriver::update(int16 *buf, int len) {
 	}
 }
 
+void AdlibFxSoundDriver::write209() {
+	write(209);
+	_v45046 = true;
+}
+
+void AdlibFxSoundDriver::write211() {
+	write(211);
+	_v45046 = false;
+}
+
 } // End of namespace tSage
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 27f30b9..26bf3e6 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -40,6 +40,7 @@ class Sound;
 #define SOUND_ARR_SIZE 16
 #define ROLAND_DRIVER_NUM 2
 #define ADLIB_DRIVER_NUM 3
+#define SBLASTER_DRIVER_NUM 4
 
 struct trackInfoStruct {
 	int _numTracks;
@@ -106,12 +107,12 @@ public:
 	virtual void setProgram(int channel, int program) {}			// Method #13
 	virtual void setVolume1(int channel, int v2, int v3, int volume) {}
 	virtual void setPitchBlend(int channel, int pitchBlend) {}		// Method #15
-	virtual void proc32(int channel, int program, int v0, int v1) {}// Method #16
+	virtual void proc32(Sound *sound, int channel, int program, int v0, int v1) {}// Method #16
 	virtual void updateVoice(int channel) {}						// Method #17
 	virtual void proc36() {}										// Method #18
 	virtual void proc38(int channel, int cmd, int value) {}			// Method #19
 	virtual void setPitch(int channel, int pitchBlend) {}			// Method #20
-	virtual void proc42(int channel, int v0, int v1) {}				// Method #21
+	virtual void proc42(int channel, int cmd, int value, int *v1, int *v2) {}	// Method #21
 };
 
 struct VoiceStructEntryType0 {
@@ -439,7 +440,7 @@ public:
 	virtual const GroupData *getGroupData();
 	virtual void installPatch(const byte *data, int size);
 	virtual int setMasterVolume(int volume);
-	virtual void proc32(int channel, int program, int v0, int v1);
+	virtual void proc32(Sound *sound, int channel, int program, int v0, int v1);
 	virtual void updateVoice(int channel);
 	virtual void proc38(int channel, int cmd, int value);
 	virtual void setPitch(int channel, int pitchBlend);
@@ -455,33 +456,28 @@ public:
 
 class AdlibFxSoundDriver: public SoundDriver, Audio::AudioStream {
 private:
+	Common::Queue<RegisterValue> _queue;
 	GroupData _groupData;
 	Audio::Mixer *_mixer;
 	FM_OPL *_opl;
 	Audio::SoundHandle _soundHandle;
 	int _sampleRate;
-	byte _portContents[256];
-	int _masterVolume;
-	Common::Queue<RegisterValue> _queue;
-
-	bool _channelVoiced[ADLIB_CHANNEL_COUNT];
-	int _channelVolume[ADLIB_CHANNEL_COUNT];
-	int _v4405E[ADLIB_CHANNEL_COUNT];
-	int _v44067[ADLIB_CHANNEL_COUNT];
-	int _v44070[ADLIB_CHANNEL_COUNT];
-	int _v44079[ADLIB_CHANNEL_COUNT];
-	int _v44082[ADLIB_CHANNEL_COUNT + 1];
-	int _pitchBlend[ADLIB_CHANNEL_COUNT];
-	int _v4409E[ADLIB_CHANNEL_COUNT];
 
+	int _v45062;
+	int _v45066;
+	int _v45068;
+	int _v4506A;
+	int _v4506B;
+	bool _v45046;
+	byte _masterVolume;
+	byte _channelVolume;
+	Sound *_sound;
 
-	void write(byte reg, byte value);
+	void write(int v);
 	void flush();
-	void updateChannelVolume(int channel);
-	void setVoice(int channel);
-	void clearVoice(int channel);
-	void updateChannel(int channel);
-	void setFrequency(int channel);
+	void sub_4556E();
+	void write209();
+	void write211();
 public:
 	AdlibFxSoundDriver();
 	virtual ~AdlibFxSoundDriver();
@@ -490,12 +486,12 @@ public:
 	virtual void close();
 	virtual bool reset();
 	virtual const GroupData *getGroupData();
-	virtual void installPatch(const byte *data, int size) {}
+	virtual void poll();
 	virtual int setMasterVolume(int volume);
-	virtual void proc32(int channel, int program, int v0, int v1);
+	virtual void proc32(Sound *sound, int channel, int program, int v0, int v1);
 	virtual void updateVoice(int channel);
 	virtual void proc38(int channel, int cmd, int value);
-	virtual void setPitch(int channel, int pitchBlend);
+	virtual void proc42(int channel, int cmd, int value, int *v1, int *v2);
 
 	// AudioStream interface
 	virtual int readBuffer(int16 *buffer, const int numSamples);


Commit: 160a8d96d943c878a1c8bed742507d540d51a15d
    https://github.com/scummvm/scummvm/commit/160a8d96d943c878a1c8bed742507d540d51a15d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-07-01T20:49:27-07:00

Commit Message:
TSAGE: Fixed problem with saving double values

Changed paths:
    engines/tsage/ringworld_scenes1.cpp
    engines/tsage/saveload.cpp
    engines/tsage/saveload.h



diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index 7fe2610..8299a05 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -3105,10 +3105,10 @@ void Scene6100::Object::synchronize(Serializer &s) {
 	SceneObject::synchronize(s);
 
 	// Save the double fields of the FloatSet
-	s.syncBytes((byte *)&_floats._float1, sizeof(double));
-	s.syncBytes((byte *)&_floats._float2, sizeof(double));
-	s.syncBytes((byte *)&_floats._float3, sizeof(double));
-	s.syncBytes((byte *)&_floats._float4, sizeof(double));
+	s.syncAsDouble(_floats._float1);
+	s.syncAsDouble(_floats._float2);
+	s.syncAsDouble(_floats._float3);
+	s.syncAsDouble(_floats._float4);
 }
 
 /*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index b184e59..40444cd 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -103,6 +103,19 @@ void Serializer::validate(int v, Common::Serializer::Version minVersion,
 		error("Savegame is corrupt");
 }
 
+#define DOUBLE_PRECISION 1000000000
+
+void Serializer::syncAsDouble(double &v) {
+	int32 num = (int32)(v);
+	uint32 fraction = (uint32)((v - (int32)v) * DOUBLE_PRECISION);
+
+	syncAsSint32LE(num);
+	syncAsUint32LE(fraction);
+
+	if (isLoading())
+		v = num + (double)fraction / DOUBLE_PRECISION;
+}
+
 /*--------------------------------------------------------------------------*/
 
 Common::Error Saver::save(int slot, const Common::String &saveName) {
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index 0382e4a..ce181cb 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -77,6 +77,7 @@ public:
 		Common::Serializer::Version maxVersion = kLastVersion);
 	void validate(int v, Common::Serializer::Version minVersion = 0,
 		Common::Serializer::Version maxVersion = kLastVersion);
+	void syncAsDouble(double &v);
 };
 
 /*--------------------------------------------------------------------------*/


Commit: d1a30b41b1bb0bc001751e8a4dcfcdb1044826ad
    https://github.com/scummvm/scummvm/commit/d1a30b41b1bb0bc001751e8a4dcfcdb1044826ad
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-07-01T20:51:05-07:00

Commit Message:
TSAGE: Linked in the (in progress) SoundBlaster Fx class

Changed paths:
    engines/tsage/sound.cpp
    engines/tsage/sound.h



diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 7f454bf..b2cf530 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -155,7 +155,9 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
 
 void SoundManager::installConfigDrivers() {
 	installDriver(ADLIB_DRIVER_NUM);
+#ifdef DEBUG
 	installDriver(SBLASTER_DRIVER_NUM);
+#endif
 }
 
 Common::List<SoundDriverEntry> &SoundManager::getDriverList(bool detectFlag) {
@@ -220,8 +222,14 @@ void SoundManager::installDriver(int driverNum) {
  * Instantiate a driver class for the specified driver number
  */
 SoundDriver *SoundManager::instantiateDriver(int driverNum) {
-	assert(driverNum == ADLIB_DRIVER_NUM);
-	return new AdlibSoundDriver();
+	switch (driverNum) {
+	case ADLIB_DRIVER_NUM:
+		return new AdlibSoundDriver();
+	case SBLASTER_DRIVER_NUM:
+		return new AdlibFxSoundDriver();
+	default:
+		error("Unknown sound driver - %d", driverNum);
+	}
 }
 
 /**
@@ -2779,7 +2787,6 @@ AdlibFxSoundDriver::AdlibFxSoundDriver(): SoundDriver() {
 
 	_mixer = _vm->_mixer;
 	_sampleRate = _mixer->getOutputRate();
-	_opl = makeAdLibOPL(_sampleRate);
 	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
 /*
 	Common::set_to(_channelVoiced, _channelVoiced + ADLIB_CHANNEL_COUNT, false);
@@ -2798,7 +2805,6 @@ AdlibFxSoundDriver::AdlibFxSoundDriver(): SoundDriver() {
 
 AdlibFxSoundDriver::~AdlibFxSoundDriver() {
 	_mixer->stopHandle(_soundHandle);
-	OPLDestroy(_opl);
 }
 
 bool AdlibFxSoundDriver::open() {
@@ -2900,10 +2906,7 @@ void AdlibFxSoundDriver::write(int v) {
 void AdlibFxSoundDriver::flush() {
 	Common::StackLock slock(SoundManager::sfManager()._serverDisabledMutex);
 
-	while (!_queue.empty()) {
-		RegisterValue v = _queue.pop();
-		OPLWriteReg(_opl, v._regNum, v._value);
-	}
+	// No data output yet
 }
 
 
@@ -2914,6 +2917,7 @@ int AdlibFxSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
 }
 
 void AdlibFxSoundDriver::update(int16 *buf, int len) {
+/*
 	static int samplesLeft = 0;
 	while (len != 0) {
 		int count = samplesLeft;
@@ -2929,6 +2933,7 @@ void AdlibFxSoundDriver::update(int16 *buf, int len) {
 		}
 		buf += count;
 	}
+*/
 }
 
 void AdlibFxSoundDriver::write209() {
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 26bf3e6..6a47a1a 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -459,7 +459,6 @@ private:
 	Common::Queue<RegisterValue> _queue;
 	GroupData _groupData;
 	Audio::Mixer *_mixer;
-	FM_OPL *_opl;
 	Audio::SoundHandle _soundHandle;
 	int _sampleRate;
 






More information about the Scummvm-git-logs mailing list