[Scummvm-cvs-logs] CVS: scummvm/sky adlibchannel.h,1.1,1.2 adlibchannel.cpp,1.1,1.2 adlibmusic.cpp,1.1,1.2 adlibmusic.h,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Sun May 4 14:18:34 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv4049/sky

Modified Files:
	adlibchannel.h adlibchannel.cpp adlibmusic.cpp adlibmusic.h 
Log Message:
new fmopl (from adplug, which has it from mame; we can use it under the LGPL should we ever have to)

Index: adlibchannel.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibchannel.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- adlibchannel.h	3 May 2003 02:59:45 -0000	1.1
+++ adlibchannel.h	4 May 2003 21:17:42 -0000	1.2
@@ -23,7 +23,6 @@
 #define ADLIBCHANNEL_H
 
 #include "stdafx.h"
-#include "sound/fmopl.h"
 #include "common/engine.h"
 #include "sky/musicbase.h"
 
@@ -60,14 +59,13 @@
 
 class SkyAdlibChannel : public SkyChannelBase {
 public:
-	SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, FM_OPL *pOpl);
+	SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData);
 	virtual void stopNote(void);
 	virtual uint8 process(uint16 aktTime);
 	virtual void updateVolume(uint16 pVolume);
 private:
 	uint8 *_musicData;
 	uint16 _musicVolume;
-	FM_OPL *_opl;
 	AdlibChannelType _channelData;
 	//-
 	InstrumentStruct *_instruments;

Index: adlibchannel.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibchannel.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- adlibchannel.cpp	3 May 2003 02:59:45 -0000	1.1
+++ adlibchannel.cpp	4 May 2003 21:17:42 -0000	1.2
@@ -20,11 +20,11 @@
  */
 
 #include "adlibchannel.h"
+#include "sound/fmopl.h"
 
-SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, FM_OPL *pOpl)
+SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData)
 {
 	_musicData = pMusicData;
-	_opl = pOpl;
 	_channelData.startOfData = startOfData;
 	_channelData.eventDataPtr = startOfData;
 	_channelData.channelActive = 1;
@@ -62,7 +62,8 @@
 void SkyAdlibChannel::setRegister(uint8 regNum, uint8 value) {
 
 	if (_adlibRegMirror[regNum] != value) {
-		OPLWriteReg(_opl,regNum,value);
+		YM3812Write(0, 0, regNum);
+		YM3812Write(0, 1, value);
 		_adlibRegMirror[regNum] = value;
 	}
 }

Index: adlibmusic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibmusic.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- adlibmusic.cpp	3 May 2003 02:59:45 -0000	1.1
+++ adlibmusic.cpp	4 May 2003 21:17:42 -0000	1.2
@@ -20,6 +20,7 @@
  */
 
 #include "sky/adlibmusic.h"
+#include "sound/fmopl.h"
 
 void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) {
 
@@ -32,17 +33,15 @@
 	_driverFileBase = 60202;
     _mixer = pMixer;
 	_sampleRate = g_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
-	int env_bits = g_system->property(OSystem::PROP_GET_FMOPL_ENV_BITS, NULL);
-	int eg_ent = g_system->property(OSystem::PROP_GET_FMOPL_EG_ENT, NULL);
-	OPLBuildTables((env_bits ? env_bits : FMOPL_ENV_BITS_HQ), (eg_ent ? eg_ent : FMOPL_EG_ENT_HQ));
-	_opl = OPLCreate(OPL_TYPE_YM3812, 3579545, _sampleRate);
+	if (0 != YM3812Init(1, 3579545, _sampleRate))
+		error("Error initialising YM3812 sound chip emulation");
 	_mixer->setupPremix(this, passMixerFunc);
 }
 
 SkyAdlibMusic::~SkyAdlibMusic(void) {
 
 	_mixer->setupPremix(NULL, NULL);
-	OPLDestroy(_opl);
+	YM3812Shutdown();
 }
 
 void SkyAdlibMusic::premixerCall(int16 *buf, uint len) {
@@ -64,7 +63,7 @@
 		render = (len > _nextMusicPoll) ? (_nextMusicPoll) : (len);
 		len -= render;
 		_nextMusicPoll -= render;
-		YM3812UpdateOne(_opl, buf, render);
+		YM3812UpdateOne(0, buf, render);
 		buf += render;
 		if (_nextMusicPoll == 0) {
 			pollMusic();
@@ -86,7 +85,7 @@
 	channelData++;
 	for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) {
 		uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc;
-		_channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart, _opl);
+		_channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart);
 	}
 }
 
@@ -94,7 +93,8 @@
 
 	uint16 cnt = 0;
 	while (_initSequence[cnt] || _initSequence[cnt+1]) {
-		OPLWriteReg(_opl, _initSequence[cnt], _initSequence[cnt+1]);
+		YM3812Write(0, 0, _initSequence[cnt]);
+		YM3812Write(0, 1, _initSequence[cnt+1]);
 		cnt += 2;
 	}
 	_allowedCommands = 0xD;

Index: adlibmusic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibmusic.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- adlibmusic.h	3 May 2003 02:59:45 -0000	1.1
+++ adlibmusic.h	4 May 2003 21:17:42 -0000	1.2
@@ -23,7 +23,6 @@
 #define ADLIBMUSIC_H
 
 #include "stdafx.h"
-#include "sound/fmopl.h"
 #include "sound/mixer.h"
 #include "common/engine.h"
 #include "adlibchannel.h"
@@ -35,7 +34,6 @@
 	~SkyAdlibMusic(void);
 private:
 	SoundMixer *_mixer;
-	FM_OPL *_opl;
 	uint8 *_initSequence;
 	uint32 _sampleRate, _nextMusicPoll;
 	virtual void setupPointers(void);





More information about the Scummvm-git-logs mailing list