Support MT-32 emu.

svn-id: r15657
This commit is contained in:
Eugene Sandulenko 2004-10-22 23:44:08 +00:00
parent c8495dbf23
commit 2c76a8e024
3 changed files with 16 additions and 4 deletions

View File

@ -42,7 +42,7 @@ static const byte mt32_to_gm[128] = {
47, 117, 127, 118, 118, 116, 115, 119, 115, 112, 55, 124, 123, 0, 14, 117 // 7x
};
MusicPlayer::MusicPlayer(MidiDriver *driver, byte *data, uint32 size) : _driver(driver), _isPlaying(false), _looping(false), _randomLoop(false), _masterVolume(192), _queuePos(0), _musicData(data), _musicDataSize(size) {
MusicPlayer::MusicPlayer(MidiDriver *driver, byte *data, uint32 size) : _driver(driver), _isPlaying(false), _looping(false), _randomLoop(false), _masterVolume(192), _queuePos(0), _musicData(data), _musicDataSize(size), _passThrough(false) {
memset(_channel, 0, sizeof(_channel));
queueClear();
_lastSong = _currentSong = 0;
@ -123,6 +123,11 @@ static const byte mt32_to_gm[128] = {
}
void MusicPlayer::send(uint32 b) {
if (_passThrough) {
_driver->send(b);
return;
}
byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume

View File

@ -45,6 +45,7 @@ public:
void queueTuneList(int16 tuneList);
bool queueSong(uint16 songNum);
void queueClear();
void setPassThrough(bool b) { _passThrough = b; }
//MidiDriver interface implementation
int open();
@ -77,6 +78,7 @@ protected:
MidiChannel *_channel[16];
byte _channelVolume[16];
bool _nativeMT32;
bool _passThrough;
Common::RandomSource _rnd;
@ -104,6 +106,7 @@ public:
void queueTuneList(int16 tuneList) { _player->queueTuneList(tuneList); }
void playMusic() { _player->playMusic(); }
void stopSong() { _player->stopMusic(); }
void setPassThrough(bool b) { _player->setPassThrough(b); }
void toggleVChange();
void setVolume(int vol) { _player->setVolume(vol); }

View File

@ -347,14 +347,18 @@ void QueenEngine::initialise(void) {
_logic = new LogicGame(this);
}
MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE));
int midiDriver = GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE);
MidiDriver *driver = GameDetector::createMidi(midiDriver);
if (!driver)
driver = MidiDriver_ADLIB_create(_mixer);
else if (ConfMan.getBool("native_mt32"))
else if (ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32))
driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
_music = new Music(driver, this);
_music->hasNativeMT32(ConfMan.getBool("native_mt32"));
_music->hasNativeMT32(ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32));
if (midiDriver == MD_MT32)
_music->setPassThrough(true);
_sound = Sound::giveSound(_mixer, this, _resource->compression());
_walk = new Walk(this);