[Scummvm-cvs-logs] CVS: scummvm/sky adlibchannel.cpp,1.2,1.2.2.1 adlibchannel.h,1.2,1.2.2.1 adlibmusic.cpp,1.2,1.2.2.1 adlibmusic.h,1.2,1.2.2.1
Max Horn
fingolfin at users.sourceforge.net
Mon May 5 08:57:01 CEST 2003
Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv22295/sky
Modified Files:
Tag: branch-0-4-0
adlibchannel.cpp adlibchannel.h adlibmusic.cpp adlibmusic.h
Log Message:
reverted to old fmopl code on the branch
Index: adlibchannel.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibchannel.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- adlibchannel.cpp 4 May 2003 21:17:42 -0000 1.2
+++ adlibchannel.cpp 5 May 2003 15:55:59 -0000 1.2.2.1
@@ -20,11 +20,11 @@
*/
#include "adlibchannel.h"
-#include "sound/fmopl.h"
-SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData)
+SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, FM_OPL *pOpl)
{
_musicData = pMusicData;
+ _opl = pOpl;
_channelData.startOfData = startOfData;
_channelData.eventDataPtr = startOfData;
_channelData.channelActive = 1;
@@ -62,8 +62,7 @@
void SkyAdlibChannel::setRegister(uint8 regNum, uint8 value) {
if (_adlibRegMirror[regNum] != value) {
- YM3812Write(0, 0, regNum);
- YM3812Write(0, 1, value);
+ OPLWriteReg(_opl,regNum,value);
_adlibRegMirror[regNum] = value;
}
}
Index: adlibchannel.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibchannel.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- adlibchannel.h 4 May 2003 21:17:42 -0000 1.2
+++ adlibchannel.h 5 May 2003 15:56:00 -0000 1.2.2.1
@@ -23,6 +23,7 @@
#define ADLIBCHANNEL_H
#include "stdafx.h"
+#include "sound/fmopl.h"
#include "common/engine.h"
#include "sky/musicbase.h"
@@ -59,13 +60,14 @@
class SkyAdlibChannel : public SkyChannelBase {
public:
- SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData);
+ SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, FM_OPL *pOpl);
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: adlibmusic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibmusic.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- adlibmusic.cpp 4 May 2003 21:17:42 -0000 1.2
+++ adlibmusic.cpp 5 May 2003 15:56:00 -0000 1.2.2.1
@@ -20,7 +20,6 @@
*/
#include "sky/adlibmusic.h"
-#include "sound/fmopl.h"
void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) {
@@ -33,15 +32,17 @@
_driverFileBase = 60202;
_mixer = pMixer;
_sampleRate = g_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
- if (0 != YM3812Init(1, 3579545, _sampleRate))
- error("Error initialising YM3812 sound chip emulation");
+ 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);
_mixer->setupPremix(this, passMixerFunc);
}
SkyAdlibMusic::~SkyAdlibMusic(void) {
_mixer->setupPremix(NULL, NULL);
- YM3812Shutdown();
+ OPLDestroy(_opl);
}
void SkyAdlibMusic::premixerCall(int16 *buf, uint len) {
@@ -63,7 +64,7 @@
render = (len > _nextMusicPoll) ? (_nextMusicPoll) : (len);
len -= render;
_nextMusicPoll -= render;
- YM3812UpdateOne(0, buf, render);
+ YM3812UpdateOne(_opl, buf, render);
buf += render;
if (_nextMusicPoll == 0) {
pollMusic();
@@ -85,7 +86,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);
+ _channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart, _opl);
}
}
@@ -93,8 +94,7 @@
uint16 cnt = 0;
while (_initSequence[cnt] || _initSequence[cnt+1]) {
- YM3812Write(0, 0, _initSequence[cnt]);
- YM3812Write(0, 1, _initSequence[cnt+1]);
+ OPLWriteReg(_opl, _initSequence[cnt], _initSequence[cnt+1]);
cnt += 2;
}
_allowedCommands = 0xD;
Index: adlibmusic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/adlibmusic.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- adlibmusic.h 4 May 2003 21:17:42 -0000 1.2
+++ adlibmusic.h 5 May 2003 15:56:00 -0000 1.2.2.1
@@ -23,6 +23,7 @@
#define ADLIBMUSIC_H
#include "stdafx.h"
+#include "sound/fmopl.h"
#include "sound/mixer.h"
#include "common/engine.h"
#include "adlibchannel.h"
@@ -34,6 +35,7 @@
~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