[Scummvm-cvs-logs] SF.net SVN: scummvm:[40343] scummvm/trunk/engines/sci/sfx

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Wed May 6 03:18:12 CEST 2009


Revision: 40343
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40343&view=rev
Author:   waltervn
Date:     2009-05-06 01:18:12 +0000 (Wed, 06 May 2009)

Log Message:
-----------
SCI: Modified the new adlib driver for the dosbox adlib emulator, and enabled the new player.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/player/players.cpp
    scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp
    scummvm/trunk/engines/sci/sfx/softseq/adlib.h

Modified: scummvm/trunk/engines/sci/sfx/player/players.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/player/players.cpp	2009-05-06 00:40:37 UTC (rev 40342)
+++ scummvm/trunk/engines/sci/sfx/player/players.cpp	2009-05-06 01:18:12 UTC (rev 40343)
@@ -32,7 +32,7 @@
 extern sfx_player_t sfx_player_player;
 
 sfx_player_t *sfx_players[] = {
-//	&sfx_player_player,
+	&sfx_player_player,
 	&sfx_player_polled,
 	&sfx_player_realtime,
 	NULL

Modified: scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp	2009-05-06 00:40:37 UTC (rev 40342)
+++ scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp	2009-05-06 01:18:12 UTC (rev 40343)
@@ -82,14 +82,12 @@
 	debug(3, "ADLIB: Starting driver in %s mode", (isSCI0 ? "SCI0" : "SCI1"));
 	_isSCI0 = isSCI0;
 
-	for (int i = 0; i < (isStereo() ? 2 : 1); i++) {
-		_fmopl[i] = makeAdlibOPL(rate);
+	_opl = OPL::OPL::create(isStereo() ? OPL::OPL::kDualOpl2 : OPL::OPL::kOpl2);
 
-		if (!_fmopl[i])
-			return -1;
+	if (!_opl)
+		return -1;
 
-		OPLResetChip(_fmopl[i]);
-	}
+	_opl->init(rate);
 
 	setRegister(0xBD, 0);
 	setRegister(0x08, 0);
@@ -105,8 +103,7 @@
 void MidiDriver_Adlib::close() {
 	_mixer->stopHandle(_mixerSoundHandle);
 
-	for (int i = 0; i < (isStereo() ? 2 : 1); i++)
-		OPLDestroy(_fmopl[i]);
+	delete _opl;
 }
 
 void MidiDriver_Adlib::setVolume(byte volume) {
@@ -182,27 +179,10 @@
 }
 
 void MidiDriver_Adlib::generateSamples(int16 *data, int len) {
-	if (isStereo()) {
-		int16 buffer[512];
+	if (isStereo())
+		len <<= 1;
+	_opl->readBuffer(data, len);
 
-		while (len > 0) {
-			int process = len > ARRAYSIZE(buffer) ? ARRAYSIZE(buffer) : len;
-			len -= process;
-
-			YM3812UpdateOne(_fmopl[0], buffer, process);
-			for (int i = 0; i < process; ++i)
-				data[(i << 1) + 0] = buffer[i];
-			
-			YM3812UpdateOne(_fmopl[1], buffer, process);
-			for (int i = 0; i < process; ++i)
-				data[(i << 1) + 1] = buffer[i];
-
-			data += (process << 1);
-		}
-	} else {
-		YM3812UpdateOne(_fmopl[0], data, len);
-	}
-
 	// Increase the age of the notes
 	for (int i = 0; i < kVoices; i++) {
 		if (_voices[i].note != -1)
@@ -587,14 +567,14 @@
 
 void MidiDriver_Adlib::setRegister(int reg, int value, int channels) {
 	if (channels & kLeftChannel) {
-		OPLWrite(_fmopl[0], 0x388, reg);
-		OPLWrite(_fmopl[0], 0x389, value);
+		_opl->write(0x220, reg);
+		_opl->write(0x221, value);
 	}
 
 	if (isStereo()) {
 		if (channels & kRightChannel) {
-			OPLWrite(_fmopl[1], 0x388, reg);
-			OPLWrite(_fmopl[1], 0x389, value);
+			_opl->write(0x222, reg);
+			_opl->write(0x223, value);
 		}
 	}
 }
@@ -611,12 +591,12 @@
 	Resource *res = resmgr->findResource(kResourceTypePatch, 3, 0);
 
 	if (!res) {
-		error("ADLIB: Failed to load patch.003");
+		warning("ADLIB: Failed to load patch.003");
 		return -1;
 	}
 
 	if ((res->size != 1344) && (res->size != 2690)) {
-		error("ADLIB: Unsupported patch format (%i bytes)", res->size);
+		warning("ADLIB: Unsupported patch format (%i bytes)", res->size);
 		return -1;
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/softseq/adlib.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/adlib.h	2009-05-06 00:40:37 UTC (rev 40342)
+++ scummvm/trunk/engines/sci/sfx/softseq/adlib.h	2009-05-06 01:18:12 UTC (rev 40343)
@@ -112,7 +112,7 @@
 
 	bool _stereo;
 	bool _isSCI0;
-	FM_OPL *_fmopl[2];
+	OPL::OPL *_opl;
 	bool _playSwitch;
 	int _masterVolume;
 	Channel _channels[MIDI_CHANNELS];


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