aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/imuse
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/imuse')
-rw-r--r--engines/scumm/imuse/imuse.cpp13
-rw-r--r--engines/scumm/imuse/imuse_internal.h2
-rw-r--r--engines/scumm/imuse/imuse_player.cpp6
-rw-r--r--engines/scumm/imuse/sysex_scumm.cpp2
4 files changed, 15 insertions, 8 deletions
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 7d971f5ca4..317ef36cb9 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -26,6 +26,7 @@
#include "common/util.h"
#include "common/system.h"
+#include "common/endian.h"
#include "scumm/imuse/imuse.h"
#include "scumm/imuse/imuse_internal.h"
@@ -99,9 +100,15 @@ IMuseInternal::~IMuseInternal() {
}
}
-byte *IMuseInternal::findStartOfSound(int sound, int ct) {
+byte *IMuseInternal::findStartOfSound(int sound, int ct) {
int32 size, pos;
- static uint32 id[] = { 'MThd', 'FORM', 'MDhd', 'MDpg' };
+
+ static const uint32 id[] = {
+ MKTAG('M', 'T', 'h', 'd'),
+ MKTAG('F', 'O', 'R', 'M'),
+ MKTAG('M', 'D', 'h', 'd'),
+ MKTAG('M', 'D', 'p', 'g')
+ };
byte *ptr = g_scumm->_res->_types[rtSound][sound]._address;
@@ -945,7 +952,7 @@ void IMuseInternal::handle_marker(uint id, byte data) {
_trigger_count--;
_queue_cleared = false;
_queue_end = (_queue_end + 1) % ARRAYSIZE(_cmd_queue);
-
+
while (_queue_end != _queue_pos && _cmd_queue[_queue_end].array[0] == COMMAND_ID && !_queue_cleared) {
p = _cmd_queue[_queue_end].array;
doCommand_internal(p[1], p[2], p[3], p[4], p[5], p[6], p[7], 0);
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index 8808a3655a..6a7b9fc7d9 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -450,7 +450,7 @@ protected:
kMThd = 1,
kFORM = 2,
kMDhd = 4, // Used in MI2 and INDY4. Contain certain start parameters (priority, volume, etc. ) for the player.
- kMDpg = 8 // These chunks exist in DOTT and SAMNMAX. They don't get processed, however.
+ kMDpg = 8 // These chunks exist in DOTT and SAMNMAX. They don't get processed, however.
};
byte *findStartOfSound(int sound, int ct = (kMThd | kFORM));
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 0b084f3116..61b9cad2cb 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -120,7 +120,7 @@ bool Player::startSound(int sound, MidiDriver *midi) {
_midi = NULL;
return false;
}
-
+
debugC(DEBUG_IMUSE, "Starting music %d", sound);
return true;
}
@@ -194,7 +194,7 @@ int Player::start_seq_sound(int sound, bool reset_vars) {
_parser->property(MidiParser::mpSmartJump, 1);
_parser->loadMusic(ptr, 0);
_parser->setTrack(_track_index);
-
+
ptr = _se->findStartOfSound(sound, IMuseInternal::kMDhd);
setSpeed(reset_vars ? (ptr ? (READ_BE_UINT32(&ptr[4]) && ptr[15] ? ptr[15] : 128) : 128) : _speed);
@@ -226,7 +226,7 @@ void Player::loadStartParameters(int sound) {
_pan = ptr[4];
_transpose = ptr[5];
_detune = ptr[6];
- setSpeed(ptr[7]);
+ setSpeed(ptr[7]);
}
}
}
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index 4eb3bee93c..c3bec93a60 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -76,7 +76,7 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
part->set_pri(p[4]);
part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
part->set_pan((p[7] & 0x0F) << 4 | (p[8] & 0x0F));
- part->_percussion = player->_isMIDI ? ((p[9] & 0x08) > 0) : false;
+ part->_percussion = player->_isMIDI ? ((p[9] & 0x08) > 0) : false;
part->set_transpose((p[9] & 0x0F) << 4 | (p[10] & 0x0F));
part->set_detune((p[11] & 0x0F) << 4 | (p[12] & 0x0F));
part->pitchBendFactor((p[13] & 0x0F) << 4 | (p[14] & 0x0F));