moved music drivers into seperated directory, added music support for diskdemo's adlib driver version.

(maybe other sky versions also have this older adlib driver?)

svn-id: r8069
This commit is contained in:
Robert Göffringmann 2003-05-28 23:31:43 +00:00
parent b4ee5004d7
commit 2186ad138b
16 changed files with 61 additions and 37 deletions

View File

@ -26,7 +26,7 @@
#include "sky/disk.h"
#include "sky/grid.h"
#include "sky/autoroute.h"
#include "sky/musicbase.h"
#include "sky/music/musicbase.h"
#include "sky/mouse.h"
#include "sky/screen.h"

View File

@ -1,15 +1,11 @@
MODULE := sky
MODULE_OBJS = \
sky/adlibchannel.o \
sky/adlibmusic.o \
sky/autoroute.o \
sky/cd_intro.o \
sky/compact.o \
sky/debug.o \
sky/disk.o \
sky/gmchannel.o \
sky/gmmusic.o \
sky/grid.o \
sky/intro.o \
sky/logic.o \
@ -20,6 +16,10 @@ MODULE_OBJS = \
sky/sky.o \
sky/sound.o \
sky/text.o \
sky/music/adlibchannel.o \
sky/music/adlibmusic.o \
sky/music/gmchannel.o \
sky/music/gmmusic.o \
# Include common rules
include common.rules

View File

@ -22,8 +22,9 @@
#include "adlibchannel.h"
#include "sound/fmopl.h"
SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData)
SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, uint32 version)
{
_gameVersion = version;
_musicData = pMusicData;
_channelData.startOfData = startOfData;
_channelData.eventDataPtr = startOfData;
@ -39,14 +40,25 @@ SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData)
_channelData.frequency = 0;
_channelData.instrumentData = NULL;
uint16 instrumentDataLoc = (_musicData[0x1206] << 8) | _musicData[0x1205];
uint16 instrumentDataLoc;
if (_gameVersion == 267) {
instrumentDataLoc = (_musicData[0x11FC] << 8) | _musicData[0x11FB];
_frequenceTable = (uint16*)(_musicData+0x7F4);
_registerTable = _musicData+0xDF4;
_opOutputTable = _musicData+0xE06;
_adlibRegMirror = _musicData+0xF55;
} else {
instrumentDataLoc = (_musicData[0x1206] << 8) | _musicData[0x1205];
_frequenceTable = (uint16*)(_musicData+0x7FE);
_registerTable = _musicData+0xDFE;
_opOutputTable = _musicData+0xE10;
_adlibRegMirror = _musicData+0xF5F;
}
_instrumentMap = _musicData+instrumentDataLoc;
_instruments = (InstrumentStruct*)(_instrumentMap+0x80);
_frequenceTable = (uint16*)(_musicData+0x7FE);
_registerTable = _musicData+0xDFE;
_opOutputTable = _musicData+0xE10;
_adlibRegMirror = _musicData+0xF5F;
_musicVolume = 0x100;
}

View File

@ -24,7 +24,7 @@
#include "stdafx.h"
#include "common/engine.h"
#include "sky/musicbase.h"
#include "sky/music/musicbase.h"
typedef struct {
uint8 ad_Op1, ad_Op2;
@ -59,11 +59,12 @@ typedef struct {
class SkyAdlibChannel : public SkyChannelBase {
public:
SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData);
SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, uint32 version);
virtual void stopNote(void);
virtual uint8 process(uint16 aktTime);
virtual void updateVolume(uint16 pVolume);
private:
uint32 _gameVersion;
uint8 *_musicData;
uint16 _musicVolume;
AdlibChannelType _channelData;

View File

@ -19,7 +19,7 @@
*
*/
#include "sky/adlibmusic.h"
#include "sky/music/adlibmusic.h"
#include "sound/fmopl.h"
void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) {
@ -27,8 +27,8 @@ void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) {
((SkyAdlibMusic*)param)->premixerCall(buf, len);
}
SkyAdlibMusic::SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk)
: SkyMusicBase(pSkyDisk) {
SkyAdlibMusic::SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk, uint32 version)
: SkyMusicBase(pSkyDisk, version) {
_driverFileBase = 60202;
_mixer = pMixer;
@ -74,8 +74,15 @@ void SkyAdlibMusic::premixerCall(int16 *buf, uint len) {
void SkyAdlibMusic::setupPointers(void) {
_musicDataLoc = (_musicData[0x1202]<<8)|_musicData[0x1201];
_initSequence = _musicData+0xE91;
printf("game version: %d\n",_gameVersion);
if (_gameVersion == 267) {
// disk demo uses a different adlib driver version, some offsets have changed
_musicDataLoc = (_musicData[0x11F8] << 8) | _musicData[0x11F7];
_initSequence = _musicData + 0xE87;
} else {
_musicDataLoc = (_musicData[0x1202] << 8) | _musicData[0x1201];
_initSequence = _musicData + 0xE91;
}
_nextMusicPoll = 0;
}
@ -85,7 +92,7 @@ void SkyAdlibMusic::setupChannels(uint8 *channelData) {
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, _gameVersion);
}
}

View File

@ -30,7 +30,7 @@
class SkyAdlibMusic : public SkyMusicBase {
public:
SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk);
SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk, uint32 version);
~SkyAdlibMusic(void);
private:
SoundMixer *_mixer;

View File

@ -25,7 +25,7 @@
#include "stdafx.h"
#include "sound/mididrv.h"
#include "common/engine.h"
#include "sky/musicbase.h"
#include "sky/music/musicbase.h"
typedef struct {
uint16 eventDataPtr;

View File

@ -26,8 +26,8 @@ void SkyGmMusic::passTimerFunc(void *param) {
((SkyGmMusic*)param)->timerCall();
}
SkyGmMusic::SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk)
: SkyMusicBase(pSkyDisk) {
SkyGmMusic::SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version)
: SkyMusicBase(pSkyDisk, version) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;

View File

@ -30,7 +30,7 @@
class SkyGmMusic : public SkyMusicBase {
public:
SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk);
SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version);
~SkyGmMusic(void);
private:
static void passTimerFunc(void *param);

View File

@ -26,8 +26,8 @@ void SkyMT32Music::passTimerFunc(void *param) {
((SkyMT32Music*)param)->timerCall();
}
SkyMT32Music::SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk)
: SkyMusicBase(pSkyDisk) {
SkyMT32Music::SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version)
: SkyMusicBase(pSkyDisk, version) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;

View File

@ -30,7 +30,7 @@
class SkyMT32Music : public SkyMusicBase {
public:
SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk);
SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version);
~SkyMT32Music(void);
private:
static void passTimerFunc(void *param);

View File

@ -21,8 +21,9 @@
#include "musicbase.h"
SkyMusicBase::SkyMusicBase(SkyDisk *pSkyDisk) {
SkyMusicBase::SkyMusicBase(SkyDisk *pSkyDisk, uint32 version) {
_gameVersion = version;
_musicData = NULL;
_allowedCommands = 0;
_skyDisk = pSkyDisk;

View File

@ -24,7 +24,7 @@
#include "stdafx.h"
#include "common/engine.h"
#include "disk.h"
#include "sky/disk.h"
#define FILES_PER_SECTION 4
@ -43,13 +43,15 @@ private:
class SkyMusicBase {
public:
SkyMusicBase(SkyDisk *pSkyDisk);
SkyMusicBase(SkyDisk *pSkyDisk, uint32 version);
virtual ~SkyMusicBase(void);
void loadSection(uint8 pSection);
void musicCommand(uint16 command);
void startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; }; // 4
protected:
uint32 _gameVersion;
SkyDisk *_skyDisk;
uint8 *_musicData;
uint8 _allowedCommands;

View File

@ -158,13 +158,14 @@ void SkyState::initialise(void) {
_skyDisk = new SkyDisk(_gameDataPath);
_skySound = new SkySound(_mixer, _skyDisk);
_gameVersion = _skyDisk->determineGameVersion();
if (_detector->getMidiDriverType() == MD_ADLIB) {
_skyMusic = new SkyAdlibMusic(_mixer, _skyDisk);
_skyMusic = new SkyAdlibMusic(_mixer, _skyDisk, _gameVersion);
} else {
_skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
_skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk, _gameVersion);
}
_gameVersion = _skyDisk->determineGameVersion();
_skyText = new SkyText(_skyDisk, _gameVersion, _language);
_skyMouse = new SkyMouse(_skyDisk);
_skyScreen = new SkyScreen(_system, _skyDisk);

View File

@ -33,10 +33,10 @@
#include "sky/struc.h"
#include "sky/grid.h"
#include "sky/screen.h"
#include "sky/musicbase.h"
#include "sky/adlibmusic.h"
#include "sky/gmmusic.h"
#include "sky/mt32music.h"
#include "sky/music/musicbase.h"
#include "sky/music/adlibmusic.h"
#include "sky/music/gmmusic.h"
#include "sky/music/mt32music.h"
#include "sky/mouse.h"
class SkyLogic;