aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJamieson Christian2002-12-18 17:14:05 +0000
committerJamieson Christian2002-12-18 17:14:05 +0000
commitb708c7dd646b324c913adf808326ca438c01de00 (patch)
tree3c4284375924f788824bc0cfaa8f6e58a3e858b7 /scumm
parentf95ea3afdf392ca3bd39f8be8560cefd1b25cef3 (diff)
downloadscummvm-rg350-b708c7dd646b324c913adf808326ca438c01de00.tar.gz
scummvm-rg350-b708c7dd646b324c913adf808326ca438c01de00.tar.bz2
scummvm-rg350-b708c7dd646b324c913adf808326ca438c01de00.zip
Miscellaneous cleanup.
svn-id: r6021
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse.cpp51
-rw-r--r--scumm/instrument.cpp2
-rw-r--r--scumm/instrument.h2
3 files changed, 29 insertions, 26 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 050a725124..095f858913 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -963,10 +963,12 @@ Part *IMuseInternal::allocate_part(byte pri)
}
}
- if (best)
+ if (best) {
best->uninit();
- else
+ _driver->update_pris();
+ } else {
debug(1, "Denying part request");
+ }
return best;
}
@@ -2165,8 +2167,10 @@ void Player::parse_sysex(byte *p, uint len)
part->set_vol ((p[5] & 0x0F) << 4 | (p[6] & 0x0F));
part->_percussion = _isGM ? ((p[9] & 0x08) > 0) : false;
if (part->_percussion) {
- if (part->_mc)
+ if (part->_mc) {
part->off();
+ part->update_pris();
+ }
} else {
part->changed (IMuseDriver::pcAll);
}
@@ -2837,6 +2841,7 @@ void Player::turn_off_parts()
for (part = _parts; part; part = part->_next)
part->off();
+ _se->_driver->update_pris();
}
void Player::play_active_notes()
@@ -3317,8 +3322,10 @@ void Part::setup(Player *player)
_pitchbend_factor = 2;
_pitchbend = 0;
_effect_level = 64;
- _program = player->_se->get_channel_program (_chan);
- _instrument.program (_program, player->_mt32emulate);
+// _program = player->_se->get_channel_program (_chan);
+// _instrument.program (_program, player->_mt32emulate);
+ _program = 255;
+ _instrument.clear();
_chorus = 0;
_modwheel = 0;
_bank = 0;
@@ -3633,26 +3640,23 @@ void IMuseDriver::update_pris()
if (!hipart)
return;
- if ((hipart->_mc = _md->allocateChannel()) != NULL) {
- hipart->changed (pcAll);
- return;
- }
-
- lopri = 255;
- lopart = NULL;
- for (i = 32, part = _se->parts_ptr(); i; i--, part++) {
- if (part->_mc && part->_pri_eff <= lopri) {
- lopri = part->_pri_eff;
- lopart = part;
+ if ((hipart->_mc = _md->allocateChannel()) == NULL) {
+ lopri = 255;
+ lopart = NULL;
+ for (i = 32, part = _se->parts_ptr(); i; i--, part++) {
+ if (part->_mc && part->_pri_eff <= lopri) {
+ lopri = part->_pri_eff;
+ lopart = part;
+ }
}
- }
- if (lopart == NULL || lopri >= hipri)
- return;
- lopart->off();
+ if (lopart == NULL || lopri >= hipri)
+ return;
+ lopart->off();
- if ((hipart->_mc = _md->allocateChannel()) == NULL)
- return;
+ if ((hipart->_mc = _md->allocateChannel()) == NULL)
+ return;
+ }
hipart->changed(pcAll);
}
}
@@ -3696,9 +3700,8 @@ void IMuseDriver::part_changed(Part *part, uint16 what)
MidiChannel *mc;
// Mark for re-schedule if program changed when in pre-state
- if (what & pcProgram && !part->_percussion && !part->_mc) {
+ if (what & pcProgram && !part->_mc && part->_on && !part->_percussion)
update_pris();
- }
if (!(mc = part->_mc))
return;
diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp
index e2b47dcef4..bfe8d9c180 100644
--- a/scumm/instrument.cpp
+++ b/scumm/instrument.cpp
@@ -25,8 +25,6 @@
#include "scumm/instrument.h"
#include "sound/mididrv.h"
-#define NATIVE_MT32 false
-
static const byte 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
diff --git a/scumm/instrument.h b/scumm/instrument.h
index 065bff0f4a..e28bf5321c 100644
--- a/scumm/instrument.h
+++ b/scumm/instrument.h
@@ -25,6 +25,8 @@
#include "stdafx.h"
#include "common/scummsys.h"
+#define NATIVE_MT32 false
+
class Serializer;
class MidiChannel;