From fa6779c7a789f2bf8120553bb7f020a37bc5279f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 4 Jun 2014 01:49:30 +0200 Subject: SCUMM: Store hardware channel number explicitly in Channel structure in AD code. --- engines/scumm/players/player_ad.cpp | 9 ++++++--- engines/scumm/players/player_ad.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp index a353f38ac1..631a86eae5 100644 --- a/engines/scumm/players/player_ad.cpp +++ b/engines/scumm/players/player_ad.cpp @@ -63,6 +63,9 @@ Player_AD::Player_AD(ScummEngine *scumm, Audio::Mixer *mixer) _rndSeed = 1; memset(_channels, 0, sizeof(_channels)); + for (int i = 0; i < ARRAYSIZE(_channels); ++i) { + _channels[i].hardwareChannel = i; + } memset(_sfxResource, 0, sizeof(_sfxResource)); memset(_sfxPriority, 0, sizeof(_sfxPriority)); } @@ -710,9 +713,9 @@ void Player_AD::updateSlot(int channel) { updateNote = processNoteEnvelope(note); if (note->bias) { - writeRegisterSpecial(channel, note->bias - note->instrumentValue, *curOffset & 0x07); + writeRegisterSpecial(_channels[channel].hardwareChannel, note->bias - note->instrumentValue, *curOffset & 0x07); } else { - writeRegisterSpecial(channel, note->instrumentValue, *curOffset & 0x07); + writeRegisterSpecial(_channels[channel].hardwareChannel, note->instrumentValue, *curOffset & 0x07); } } @@ -764,7 +767,7 @@ bool Player_AD::processNote(Note *note, int channel, const byte *offset) { instrumentDataValue = _channels[channel].instrumentData[instrumentDataOffset]; } - uint8 noteInstrumentValue = readRegisterSpecial(channel, instrumentDataValue, instrumentDataOffset); + uint8 noteInstrumentValue = readRegisterSpecial(_channels[channel].hardwareChannel, instrumentDataValue, instrumentDataOffset); if (note->bias) { noteInstrumentValue = note->bias - noteInstrumentValue; } diff --git a/engines/scumm/players/player_ad.h b/engines/scumm/players/player_ad.h index 6d7d28f155..29b6e5156f 100644 --- a/engines/scumm/players/player_ad.h +++ b/engines/scumm/players/player_ad.h @@ -180,6 +180,8 @@ private: uint8 instrumentData[7]; Note notes[2]; + + int hardwareChannel; } _channels[11]; uint8 _rndSeed; -- cgit v1.2.3