aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorRobert Göffringmann2003-05-12 23:25:54 +0000
committerRobert Göffringmann2003-05-12 23:25:54 +0000
commit4162a22121bcf2845b5f3b206f516a1bf6754a3c (patch)
tree35dabb56d7d30abe9705cc31a6176ecf82d918e1 /sky
parent299a1a451fdbde6f7c8bed40596dc3a6786a6c3b (diff)
downloadscummvm-rg350-4162a22121bcf2845b5f3b206f516a1bf6754a3c.tar.gz
scummvm-rg350-4162a22121bcf2845b5f3b206f516a1bf6754a3c.tar.bz2
scummvm-rg350-4162a22121bcf2845b5f3b206f516a1bf6754a3c.zip
changed some internal structures, added support for true MT32 (though not yet used by main prog)
svn-id: r7483
Diffstat (limited to 'sky')
-rw-r--r--sky/gmchannel.cpp17
-rw-r--r--sky/gmchannel.h4
-rw-r--r--sky/gmmusic.cpp78
-rw-r--r--sky/gmmusic.h5
-rw-r--r--sky/mt32music.cpp182
-rw-r--r--sky/mt32music.h50
-rw-r--r--sky/musicbase.cpp1
-rw-r--r--sky/musicbase.h2
-rw-r--r--sky/sky.cpp20
-rw-r--r--sky/sky.h1
10 files changed, 322 insertions, 38 deletions
diff --git a/sky/gmchannel.cpp b/sky/gmchannel.cpp
index 6383427c0d..4850f654c1 100644
--- a/sky/gmchannel.cpp
+++ b/sky/gmchannel.cpp
@@ -21,21 +21,7 @@
#include "gmchannel.h"
-// instrument map copied from scumm/instrument.cpp
-
-const byte SkyGmChannel::_mt32_to_gm[128] = {
-// 0 1 2 3 4 5 6 7 8 9 A B C D E F
- 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
- 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
- 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
- 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
- 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
- 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
- 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
- 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117 // 7x
-};
-
-SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pMidiDrv)
+SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pMidiDrv, byte *pInstMap)
{
_musicData = pMusicData;
_midiDrv = pMidiDrv;
@@ -43,6 +29,7 @@ SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pM
_channelData.eventDataPtr = startOfData;
_channelData.channelActive = 1;
_channelData.nextEventTime = getNextEventTime();
+ _mt32_to_gm = pInstMap;
_musicVolume = 0x100;
}
diff --git a/sky/gmchannel.h b/sky/gmchannel.h
index 1f5edede12..06b4390bc0 100644
--- a/sky/gmchannel.h
+++ b/sky/gmchannel.h
@@ -38,12 +38,12 @@ typedef struct {
class SkyGmChannel : public SkyChannelBase {
public:
- SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pMidiDrv);
+ SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pMidiDrv, byte *pInstMap);
virtual void stopNote(void);
virtual uint8 process(uint16 aktTime);
virtual void updateVolume(uint16 pVolume);
private:
- static const byte _mt32_to_gm[128];
+ byte *_mt32_to_gm;
MidiDriver *_midiDrv;
uint8 *_musicData;
uint16 _musicVolume;
diff --git a/sky/gmmusic.cpp b/sky/gmmusic.cpp
index 2b0e5f45ad..9d81684006 100644
--- a/sky/gmmusic.cpp
+++ b/sky/gmmusic.cpp
@@ -33,10 +33,10 @@ SkyGmMusic::SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk)
_midiDrv = pMidiDrv;
int midiRes = _midiDrv->open();
if (midiRes != 0) {
- printf("Error code: %d\n",midiRes);
+ error("Can't open midi device. Errorcode: %d\n",midiRes);
}
_midiDrv->setTimerCallback(this, passTimerFunc);
- ignoreNextPoll = false;
+ _ignoreNextPoll = false;
}
SkyGmMusic::~SkyGmMusic(void) {
@@ -49,8 +49,8 @@ SkyGmMusic::~SkyGmMusic(void) {
void SkyGmMusic::timerCall(void) {
// midi driver polls hundred times per sec. We only want 50 times.
- ignoreNextPoll = !ignoreNextPoll;
- if (!ignoreNextPoll) return;
+ _ignoreNextPoll = !_ignoreNextPoll;
+ if (!_ignoreNextPoll) return;
if (_musicData != NULL)
pollMusic();
@@ -68,11 +68,79 @@ void SkyGmMusic::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 SkyGmChannel(_musicData, chDataStart, _midiDrv);
+ _channels[cnt] = new SkyGmChannel(_musicData, chDataStart, _midiDrv, _mt32_to_gm + 128 * _currentSection);
}
}
void SkyGmMusic::startDriver(void) {
_midiDrv->send(0xFF);
+ // skip all sysEx as it can't be handled anyways.
}
+
+// each section has its own custom instruments setup, so we need one translation table
+// per section. Need an MT32 to make correct tables, though.
+
+byte SkyGmMusic::_mt32_to_gm[6*128] = {
+// Section 0:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 57, 69, 70, 22, 56, 59, 57, 57, 60, 60, 60, 63, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117, // 7x
+
+// Section 1:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117, // 7x
+// Section 2:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117, // 7x
+// Section 3:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117, // 7x
+// Section 4:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117, // 7x
+// Section 5:
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 1, 0, 2, 4, 4, 5, 3, 16, 17, 18, 16, 16, 19, 20, 21, // 0x
+ 6, 6, 6, 7, 7, 7, 8, 112, 62, 62, 63, 63, 38, 38, 39, 39, // 1x
+ 88, 95, 52, 98, 97, 99, 14, 54, 102, 96, 53, 102, 81, 100, 14, 80, // 2x
+ 48, 48, 49, 45, 41, 40, 42, 42, 43, 46, 45, 24, 25, 28, 27, 104, // 3x
+ 32, 32, 34, 33, 36, 37, 35, 35, 79, 73, 72, 72, 74, 75, 64, 65, // 4x
+ 66, 67, 71, 71, 68, 69, 70, 22, 56, 59, 57, 57, 60, 60, 58, 61, // 5x
+ 61, 11, 11, 98, 14, 9, 14, 13, 12, 107, 107, 77, 78, 78, 76, 76, // 6x
+ 47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117 // 7x
+};
diff --git a/sky/gmmusic.h b/sky/gmmusic.h
index 51f1bd81c2..b3dca05b39 100644
--- a/sky/gmmusic.h
+++ b/sky/gmmusic.h
@@ -35,9 +35,12 @@ public:
private:
static void passTimerFunc(void *param);
void timerCall(void);
- bool ignoreNextPoll;
+
+ bool _ignoreNextPoll;
uint8 *_sysExSequence;
MidiDriver *_midiDrv;
+ static byte _mt32_to_gm[6*128];
+
virtual void setupPointers(void);
virtual void setupChannels(uint8 *channelData);
virtual void startDriver(void);
diff --git a/sky/mt32music.cpp b/sky/mt32music.cpp
new file mode 100644
index 0000000000..cb99c59f42
--- /dev/null
+++ b/sky/mt32music.cpp
@@ -0,0 +1,182 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "sky/mt32music.h"
+
+void SkyMT32Music::passTimerFunc(void *param) {
+
+ ((SkyMT32Music*)param)->timerCall();
+}
+
+SkyMT32Music::SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk)
+ : SkyMusicBase(pSkyDisk) {
+
+ _driverFileBase = 60200;
+ _midiDrv = pMidiDrv;
+ int midiRes = _midiDrv->open();
+ if (midiRes != 0) {
+ error("Can't open midi device. Errorcode: %d\n",midiRes);
+ }
+ _midiDrv->setTimerCallback(this, passTimerFunc);
+ _ignoreNextPoll = false;
+ for (uint8 cnt = 0; cnt < 128; cnt++)
+ _dummyMap[cnt] = cnt;
+}
+
+SkyMT32Music::~SkyMT32Music(void) {
+
+ _midiDrv->close();
+ _midiDrv->setTimerCallback(NULL, NULL);
+ delete _midiDrv;
+}
+
+void SkyMT32Music::timerCall(void) {
+
+ // midi driver polls hundred times per sec. We only want 50 times.
+ _ignoreNextPoll = !_ignoreNextPoll;
+ if (!_ignoreNextPoll) return;
+
+ if (_musicData != NULL)
+ pollMusic();
+}
+
+void SkyMT32Music::setupPointers(void) {
+
+ _musicDataLoc = (_musicData[0x7DD] << 8) | _musicData[0x7DC];
+ _sysExSequence = ((_musicData[0x7E1] << 8) | _musicData[0x7E0]) + _musicData;
+}
+
+void SkyMT32Music::setupChannels(uint8 *channelData) {
+
+ _numberOfChannels = channelData[0];
+ channelData++;
+ for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) {
+ uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc;
+ _channels[cnt] = new SkyGmChannel(_musicData, chDataStart, _midiDrv, _dummyMap);
+ }
+}
+
+#define MIDI_PACK(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
+
+bool SkyMT32Music::processPatchSysEx(uint8 *sysExData) {
+
+ uint8 crc = 0;
+ if (sysExData[0] & 0x80) return false;
+ uint8 patchNum = sysExData[0];
+ sysExData++;
+
+ uint8 timbreGroup = sysExData[0] >> 6;
+ uint8 timbreNumber = sysExData[0] & 0x3F;
+ uint8 keyShift = sysExData[1] & 0x3F;
+ uint8 fineTune = sysExData[2] & 0x7F;
+ uint8 benderRange = sysExData[3] & 0x7F;
+ uint8 assignMode = sysExData[1] >> 6;
+ uint8 reverbSwitch = sysExData[2] >> 7;
+
+ _midiDrv->send(MIDI_PACK(0xF0, 0x41, 0x10, 0x16));
+ _midiDrv->send(MIDI_PACK(0x12, 5, patchNum >> 4, (patchNum & 0xF) << 3));
+
+ crc -= 5 + (patchNum >> 4) + ((patchNum & 0xF) << 3);
+ crc -= timbreGroup + timbreNumber + keyShift + fineTune;
+ crc -= benderRange + assignMode + reverbSwitch;
+
+ _midiDrv->send(MIDI_PACK(timbreGroup, timbreNumber, keyShift, fineTune));
+ _midiDrv->send(MIDI_PACK(benderRange, assignMode, reverbSwitch, crc));
+ _midiDrv->send(0xF7);
+
+ debug(3," Patch %02X:\n",patchNum);
+ debug(3," Timbre Group: %d\n",timbreGroup);
+ debug(3," Timbre Number: %d\n",timbreNumber);
+ debug(3," Key Shift: %d\n",keyShift);
+ debug(3," Fine Tune: %d\n",fineTune);
+ debug(3," Bender Range: %d\n",benderRange);
+ debug(3," Assign Mode: %d\n",assignMode);
+ debug(3," Reverb Switch: %d\n\n",reverbSwitch);
+ return true;
+}
+
+void SkyMT32Music::startDriver(void) {
+
+ _midiDrv->send(0xFF); // reset midi device
+
+ // setup timbres and patches using SysEx data
+ uint8* sysExData = _sysExSequence;
+ uint8 timbreNum = sysExData[0];
+ uint8 cnt, crc;
+ uint32 sysComb;
+ sysExData++;
+ for (cnt = 0; cnt < timbreNum; cnt++) {
+ crc = 0;
+ _midiDrv->send(MIDI_PACK(0xF0, 0x41, 0x10, 0x16));
+ //- sendTimbreAddress
+ sysComb = (0x2 << 16) | (sysExData[0] << 8) | 0xA;
+ sysExData++;
+ uint8 sysByte1 = (uint8)(sysComb >> 14);
+ uint8 sysByte2 = (uint8)((sysComb & 0x3FFF) >> 7);
+ uint8 sysByte3 = (uint8)(sysComb & 0x7F);
+ _midiDrv->send(MIDI_PACK(0x12, sysByte1, sysByte2, sysByte3));
+ debug(3,"InitBySysEx: Timbre address: %02X:%02X:%02X (%02X)\n",sysByte1,sysByte2,sysByte3,(sysExData-1)[0]);
+ crc -= sysByte1 + sysByte2 + sysByte3;
+ //- sendTimbreData
+ uint8 dataLen = sysExData[0];
+ debug(3,"[%02X]",dataLen);
+ sysExData++;
+ uint32 nextSend = 0;
+ uint8 bytesInSend = 0;
+ debug(3," Timbre Data:");
+ do {
+ uint8 rlVal = 1;
+ uint8 codeVal = sysExData[0];
+ sysExData++;
+
+ if (codeVal & 0x80) {
+ codeVal &= 0x7F;
+ rlVal = sysExData[0];
+ sysExData++;
+ dataLen--;
+ }
+ for (uint8 cnt = 0; cnt < rlVal; cnt++) {
+ nextSend |= codeVal << (bytesInSend << 3);
+ crc -= codeVal;
+ debug(3," %02X",codeVal);
+ bytesInSend++;
+ if (bytesInSend == 4) {
+ _midiDrv->send(nextSend);
+ nextSend = bytesInSend = 0;
+ }
+ }
+ dataLen--;
+ } while (dataLen > 0);
+ crc &= 0x7F;
+ debug(3," %02X F7\n",crc);
+ nextSend |= crc << (bytesInSend << 3);
+ bytesInSend++;
+ if (bytesInSend == 4) {
+ _midiDrv->send(nextSend);
+ nextSend = bytesInSend = 0;
+ }
+ nextSend |= 0xF7 << (bytesInSend << 3);
+ _midiDrv->send(nextSend);
+ }
+
+ while (processPatchSysEx(sysExData))
+ sysExData += 5;
+}
diff --git a/sky/mt32music.h b/sky/mt32music.h
new file mode 100644
index 0000000000..76b2a18fc5
--- /dev/null
+++ b/sky/mt32music.h
@@ -0,0 +1,50 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef MT32MUSIC_H
+#define MT32MUSIC_H
+
+#include "stdafx.h"
+#include "common/engine.h"
+#include "musicbase.h"
+#include "sound/mididrv.h"
+#include "gmchannel.h"
+
+class SkyMT32Music : public SkyMusicBase {
+public:
+ SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk);
+ ~SkyMT32Music(void);
+private:
+ static void passTimerFunc(void *param);
+ void timerCall(void);
+ bool processPatchSysEx(uint8 *sysExData);
+
+ bool _ignoreNextPoll;
+ uint8 *_sysExSequence;
+ MidiDriver *_midiDrv;
+ uint8 _dummyMap[128];
+
+ virtual void setupPointers(void);
+ virtual void setupChannels(uint8 *channelData);
+ virtual void startDriver(void);
+};
+
+#endif //MT32MUSIC_H
diff --git a/sky/musicbase.cpp b/sky/musicbase.cpp
index 233cc524d4..39943057c3 100644
--- a/sky/musicbase.cpp
+++ b/sky/musicbase.cpp
@@ -38,6 +38,7 @@ void SkyMusicBase::loadSectionMusic(uint8 pSection)
{
if (_currentMusic) stopMusic();
if (_musicData) free(_musicData);
+ _currentSection = pSection;
_musicData = _skyDisk->loadFile(_driverFileBase + FILES_PER_SECTION * pSection, NULL);
_allowedCommands = 0;
_musicTempo0 = 0x78; // init constants taken from idb file, area ~0x1060
diff --git a/sky/musicbase.h b/sky/musicbase.h
index 6b813a222a..34c0f39e79 100644
--- a/sky/musicbase.h
+++ b/sky/musicbase.h
@@ -57,7 +57,7 @@ protected:
uint16 _driverFileBase;
uint16 _musicVolume, _numberOfChannels;
- uint8 _currentMusic;
+ uint8 _currentMusic, _currentSection;
uint8 _musicTempo0; // can be changed by music stream
uint8 _musicTempo1; // given once per music
uint32 _tempo; // calculated from musicTempo0 and musicTempo1
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 7dcf83861a..cead2b69a3 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -110,22 +110,14 @@ void SkyState::initialise(void) {
_skySound = new SkySound(_mixer);
_skyDisk = new SkyDisk(_gameDataPath);
- // FIXME: This is *ugly* (and maybe even incorrect?)
- // We need to know if we have to use adlib for midi or not.
-
- if (_detector->_midi_driver == MD_ADLIB) {
- _skyMusic = new SkyAdlibMusic(_mixer, _skyDisk);
+ if (_detector->getMidiDriverType() == MD_ADLIB) {
+ _skyMusic = new SkyAdlibMusic(_mixer, _skyDisk);
} else {
- if (_detector->_midi_driver == MD_AUTO) {
-#if defined (_WIN32_WCE) || defined(UNIX) || defined(X11_BACKEND)
- _skyMusic = new SkyAdlibMusic(_mixer, _skyDisk);
-#else
- _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
-#endif
- } else {
- _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
- }
+ _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
}
+ // TODO: Add option for users with real MT32 to use it. Driver is done.
+ // _skyMusic = new SkyMT32Music(_detector->createMidi(), _skyDisk);
+
_gameVersion = _skyDisk->determineGameVersion();
_skyText = new SkyText(_skyDisk, _gameVersion, _language);
diff --git a/sky/sky.h b/sky/sky.h
index f20d67fe74..78990ff3ab 100644
--- a/sky/sky.h
+++ b/sky/sky.h
@@ -35,6 +35,7 @@
#include "sky/musicbase.h"
#include "sky/adlibmusic.h"
#include "sky/gmmusic.h"
+#include "sky/mt32music.h"
#include "sky/mouse.h"
class SkyLogic;