Skip to content

Commit

Permalink
QUEEN: Rename some MidiMusic members to match Audio::MidiPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Mar 24, 2011
1 parent 47e347b commit 6b797cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions engines/queen/music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ namespace Queen {
extern MidiDriver *C_Player_CreateAdLibMidiDriver(Audio::Mixer *);

MidiMusic::MidiMusic(QueenEngine *vm)
: _isPlaying(false), _looping(false), _randomLoop(false), _masterVolume(192), _buf(0) {
: _isPlaying(false), _isLooping(false), _randomLoop(false), _masterVolume(192), _buf(0) {

memset(_channel, 0, sizeof(_channel));
memset(_channelsTable, 0, sizeof(_channelsTable));
_queuePos = _lastSong = _currentSong = 0;
queueClear();

Expand Down Expand Up @@ -118,8 +118,8 @@ void MidiMusic::setVolume(int volume) {
_masterVolume = volume;

for (int i = 0; i < 16; ++i) {
if (_channel[i])
_channel[i]->volume(_channelVolume[i] * _masterVolume / 255);
if (_channelsTable[i])
_channelsTable[i]->volume(_channelsVolume[i] * _masterVolume / 255);
}
}

Expand Down Expand Up @@ -156,7 +156,7 @@ bool MidiMusic::queueSong(uint16 songNum) {
void MidiMusic::queueClear() {
_lastSong = _songQueue[0];
_queuePos = 0;
_looping = _randomLoop = false;
_isLooping = _randomLoop = false;
memset(_songQueue, 0, sizeof(_songQueue));
}

Expand All @@ -170,15 +170,15 @@ void MidiMusic::send(uint32 b) {
if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume
byte volume = (byte)((b >> 16) & 0x7F);
_channelVolume[channel] = volume;
_channelsVolume[channel] = volume;
volume = volume * _masterVolume / 255;
b = (b & 0xFF00FFFF) | (volume << 16);
} else if ((b & 0xF0) == 0xC0 && !_nativeMT32) {
b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
} else if ((b & 0xFFF0) == 0x007BB0) {
//Only respond to All Notes Off if this channel
//has currently been allocated
if (!_channel[channel])
if (!_channelsTable[channel])
return;
}

Expand All @@ -190,17 +190,17 @@ void MidiMusic::send(uint32 b) {
if (channel == 5 && _currentSong == 38)
return;

if (!_channel[channel])
_channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
if (!_channelsTable[channel])
_channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();

if (_channel[channel])
_channel[channel]->send(b);
if (_channelsTable[channel])
_channelsTable[channel]->send(b);
}

void MidiMusic::metaEvent(byte type, byte *data, uint16 length) {
switch (type) {
case 0x2F: // End of Track
if (_looping || _songQueue[1]) {
if (_isLooping || _songQueue[1]) {
playMusic();
} else {
stopMusic();
Expand Down Expand Up @@ -333,7 +333,7 @@ void MidiMusic::queueUpdatePos() {
} else {
if (_queuePos < (MUSIC_QUEUE_SIZE - 1) && _songQueue[_queuePos + 1])
_queuePos++;
else if (_looping)
else if (_isLooping)
_queuePos = 0;
}
}
Expand Down
8 changes: 4 additions & 4 deletions engines/queen/music.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MidiMusic : public MidiDriver_BASE {
void stopSong() { stopMusic(); }
void playMusic();
void stopMusic();
void setLoop(bool loop) { _looping = loop; }
void setLoop(bool loop) { _isLooping = loop; }
void queueTuneList(int16 tuneList);
bool queueSong(uint16 songNum);
void queueClear();
Expand All @@ -76,15 +76,15 @@ class MidiMusic : public MidiDriver_BASE {

MidiDriver *_driver;
MidiParser *_parser;
MidiChannel *_channel[16];
byte _channelVolume[16];
MidiChannel *_channelsTable[16];
byte _channelsVolume[16];
bool _adlib;
bool _nativeMT32;
Common::Mutex _mutex;
Common::RandomSource _rnd;

bool _isPlaying;
bool _looping;
bool _isLooping;
bool _randomLoop;
byte _masterVolume;
uint8 _queuePos;
Expand Down

0 comments on commit 6b797cc

Please sign in to comment.