Changed misleading 'isGM' name to 'isMIDI'; cleanup in the isMIDI/isMT32 methods

svn-id: r18248
This commit is contained in:
Max Horn
2005-05-25 09:32:19 +00:00
parent 7afc24881d
commit 83a3507507
3 changed files with 31 additions and 29 deletions
+22 -20
View File
@@ -32,6 +32,7 @@
#include "scumm/instrument.h"
#include "scumm/saveload.h"
#include "scumm/scumm.h"
#include "scumm/util.h"
#include "sound/mididrv.h"
@@ -95,7 +96,7 @@ byte *IMuseInternal::findStartOfSound(int sound) {
ptr += 4;
// Okay, we're looking for one of those things: either
// an 'MThd' tag(for SMF), or a 'FORM' tag(for XMIDI).
// an 'MThd' tag (for SMF), or a 'FORM' tag (for XMIDI).
size = 48; // Arbitrary; we should find our tag within the first 48 bytes of the resource
pos = 0;
while (pos < size) {
@@ -122,16 +123,15 @@ bool IMuseInternal::isMT32(int sound) {
switch (tag) {
case MKID('ADL '):
case MKID('ASFX'): // Special AD class for old Adlib sound effects
case MKID('SPK '):
return false;
case MKID('AMI '):
return true;
case MKID('ROL '):
return true;
case MKID('GMD '):
return false;
case MKID('MAC '):
return true;
case MKID('SPK '):
case MKID('GMD '):
return false;
}
@@ -142,10 +142,12 @@ bool IMuseInternal::isMT32(int sound) {
if (ptr[8] == 'S' && ptr[9] == 'O')
return false;
warning("Unknown music type: '%s'", tag2str(tag));
return false;
}
bool IMuseInternal::isGM(int sound) {
bool IMuseInternal::isMIDI(int sound) {
byte *ptr = NULL;
uint32 tag;
@@ -159,19 +161,17 @@ bool IMuseInternal::isGM(int sound) {
switch (tag) {
case MKID('ADL '):
case MKID('ASFX'): // Special AD class for old Adlib sound effects
return false;
case MKID('AMI '):
return true; // Yeah... for our purposes, this is GM
case MKID('ROL '):
return true; // Yeah... for our purposes, this is GM
case MKID('GMD '):
return true;
case MKID('MIDI'):
return true;
case MKID('MAC '):
return true; // I guess this one too, since it qualifies under isMT32()
case MKID('SPK '):
return false;
return false;
case MKID('AMI '):
case MKID('ROL '):
case MKID('MAC '):
return true;
case MKID('GMD '):
case MKID('MIDI'):
return true;
}
// Old style 'RO' has equivalent properties to 'ROL'
@@ -182,13 +182,15 @@ bool IMuseInternal::isGM(int sound) {
if (ptr[8] == 'S' && ptr[9] == 'O')
return true;
warning("Unknown music type: '%s'", tag2str(tag));
return false;
}
MidiDriver *IMuseInternal::getBestMidiDriver(int sound) {
MidiDriver *driver = NULL;
if (isGM(sound)) {
if (isMIDI(sound)) {
if (_midi_native) {
driver = _midi_native;
} else {
@@ -1736,7 +1738,7 @@ void Part::init() {
void Part::setup(Player *player) {
_player = player;
_percussion = (player->isGM() && _chan == 9); // true;
_percussion = (player->isMIDI() && _chan == 9); // true;
_on = true;
_pri_eff = player->getPriority();
_pri = 0;
+3 -3
View File
@@ -184,7 +184,7 @@ protected:
ParameterFader _parameterFaders[4];
bool _isMT32;
bool _isGM;
bool _isMIDI;
protected:
// Player part
@@ -239,7 +239,7 @@ public:
byte getVolume() const { return _volume; }
bool isActive() const { return _active; }
bool isFadingOut() const;
bool isGM() const { return _isGM; }
bool isMIDI() const { return _isMIDI; }
bool isMT32() const { return _isMT32; }
bool jump(uint track, uint beat, uint tick);
void onTimer();
@@ -389,7 +389,7 @@ protected:
protected:
byte *findStartOfSound(int sound);
bool isMT32(int sound);
bool isGM(int sound);
bool isMIDI(int sound);
int get_queue_sound_status(int sound) const;
void handle_marker(uint id, byte data);
int get_channel_volume(uint a);
+6 -6
View File
@@ -79,7 +79,7 @@ Player::Player() :
_loop_from_tick(0),
_speed(128),
_isMT32(false),
_isGM(false),
_isMIDI(false),
_se(0),
_vol_chan(0){
}
@@ -104,7 +104,7 @@ bool Player::startSound(int sound, MidiDriver *midi, bool passThrough) {
}
_isMT32 = _se->isMT32(sound);
_isGM = _se->isGM(sound);
_isMIDI = _se->isMIDI(sound);
_parts = NULL;
_active = true;
@@ -313,7 +313,7 @@ void Player::send(uint32 b) {
case 0xC: // Program Change
part = getPart(chan);
if (part) {
if (_isGM) {
if (_isMIDI) {
if (param1 < 128)
part->programChange(param1);
} else {
@@ -414,7 +414,7 @@ void Player::sysEx(byte *p, uint16 len) {
part->set_onoff(p[2] & 0x01);
part->set_pri (p[4]);
part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
part->_percussion = _isGM ?((p[9] & 0x08) > 0) : false;
part->_percussion = _isMIDI ?((p[9] & 0x08) > 0) : false;
if (part->_percussion) {
if (part->_mc) {
part->off();
@@ -426,7 +426,7 @@ void Player::sysEx(byte *p, uint16 len) {
// 0 is a valid program number. MI2 tests show that in such
// cases, a regular program change message always seems to follow
// anyway.
if (_isGM)
if (_isMIDI)
part->_instrument.program((p[15] & 0x0F) << 4 |(p[16] & 0x0F), _isMT32);
part->sendAll();
}
@@ -1144,7 +1144,7 @@ void Player::fixAfterLoad() {
if (_parser)
_parser->jumpToTick(_music_tick); // start_seq_sound already switched tracks
_isMT32 = _se->isMT32(_id);
_isGM = _se->isGM(_id);
_isMIDI = _se->isMIDI(_id);
}
}