[Scummvm-cvs-logs] SF.net SVN: scummvm: [21333] scummvm/trunk/engines/kyra/sound_adlib.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Thu Mar 16 09:28:02 CET 2006
Revision: 21333
Author: eriktorbjorn
Date: 2006-03-16 09:27:52 -0800 (Thu, 16 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21333&view=rev
Log Message:
-----------
Fixed some comments and made a couple of cleanups to make it a bit more clear
just how similar callbackOutput() and updateCallback3() are.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/sound_adlib.cpp
Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp 2006-03-16 16:35:46 UTC (rev 21332)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp 2006-03-16 17:27:52 UTC (rev 21333)
@@ -595,17 +595,16 @@
void AdlibDriver::callbackOutput() {
while (_lastProcessed != _soundsPlaying) {
- uint8 *ptr = _soundData;
-
- ptr += READ_LE_UINT16(&ptr[_soundIdTable[_lastProcessed] << 1]);
+ uint16 add = _soundIdTable[_lastProcessed] << 1;
+ uint8 *ptr = _soundData + READ_LE_UINT16(_soundData + add);
uint8 chan = *ptr++;
- Channel &channel = _channels[chan];
-
uint8 priority = *ptr++;
// Only start this sound if its priority is higher than the one
// already playing.
+ Channel &channel = _channels[chan];
+
if (priority >= channel.priority) {
initChannel(channel);
channel.priority = priority;
@@ -658,6 +657,10 @@
// function and it returns anything other than 1.
void AdlibDriver::callbackProcess() {
+ // Each channel runs its own program. There are ten channels: One for
+ // each Adlib channel (0-8), plus one "control channel" (9) which is
+ // the one that tells the other channels what to do.
+
for (_curChannel = 9; _curChannel >= 0; --_curChannel) {
int result = 1;
@@ -763,12 +766,13 @@
void AdlibDriver::noteOff(Channel &channel) {
debugC(9, kDebugLevelSound, "noteOff(%d)", &channel - _channels);
- // I believe that 9 is the percussion channel.
- if (_curChannel == 9)
+ // The control channel has no corresponding Adlib channel
+
+ if (_curChannel >= 9)
return;
- // I believe this has to do with channels 6, 7, and 8 being special
- // when Adlib's rhythm section is enabled.
+ // When the rhythm section is enabled, channels 6, 7 and 8 are special.
+
if (_unk4 && _curChannel >= 6)
return;
@@ -801,8 +805,6 @@
writeOPL(0xB0 + chan, 0x00);
- // FIXME!
- //
// ...and then the note is turned on again, with whatever value is
// still lurking in the A0 + chan register, but everything else -
// including the two most significant frequency bit, and the octave -
@@ -1205,8 +1207,10 @@
uint16 add = value << 1;
uint8 *ptr = _soundData + READ_LE_UINT16(_soundData + add);
uint8 chan = *ptr++;
+ uint8 priority = *ptr++;
+
Channel &channel2 = _channels[chan];
- uint8 priority = *ptr++;
+
if (priority >= channel2.priority) {
_flagTrigger = 1;
_flags |= 8;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list