aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scalpel/drivers
diff options
context:
space:
mode:
authorMartin Kiewitz2015-05-31 00:58:49 +0200
committerMartin Kiewitz2015-05-31 00:58:49 +0200
commit6ce9be24046b1cfd886d020758f083155a930155 (patch)
tree0fa2cc01e525c99c667d3ab0b5c0ec8f7bc497a5 /engines/sherlock/scalpel/drivers
parentec56344ed706f81df3701b0b18f7194c319fde6c (diff)
downloadscummvm-rg350-6ce9be24046b1cfd886d020758f083155a930155.tar.gz
scummvm-rg350-6ce9be24046b1cfd886d020758f083155a930155.tar.bz2
scummvm-rg350-6ce9be24046b1cfd886d020758f083155a930155.zip
SHERLOCK: adlib: in-use timer, thx LordHoto
Diffstat (limited to 'engines/sherlock/scalpel/drivers')
-rw-r--r--engines/sherlock/scalpel/drivers/adlib.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp
index c1dbddbc04..8dee5019f4 100644
--- a/engines/sherlock/scalpel/drivers/adlib.cpp
+++ b/engines/sherlock/scalpel/drivers/adlib.cpp
@@ -269,8 +269,10 @@ private:
// stores information about all FM voice channels
adlib_ChannelEntry _channels[SHERLOCK_ADLIB_VOICES_COUNT];
- void updateChannelInUseTimers();
+protected:
+ void onTimer();
+private:
void resetAdLib();
void resetAdLib_OperatorRegisters(byte baseRegister, byte value);
void resetAdLib_FMVoiceChannelRegisters(byte baseRegister, byte value);
@@ -337,10 +339,10 @@ void MidiDriver_AdLib::setVolume(byte volume) {
//renewNotes(-1, true);
}
-// this should normally get called per tick
-// but calling it per send() shouldn't be a problem
-// TODO: maybe change inUseTimer to a 32-bit integer to make sure there are no overruns?!?!
-void MidiDriver_AdLib::updateChannelInUseTimers() {
+// this should/must get called per tick
+// original driver did this before MIDI data processing on each tick
+// we do it atm after MIDI data processing
+void MidiDriver_AdLib::onTimer() {
for (byte FMvoiceChannel = 0; FMvoiceChannel < SHERLOCK_ADLIB_VOICES_COUNT; FMvoiceChannel++) {
if (_channels[FMvoiceChannel].inUse) {
_channels[FMvoiceChannel].inUseTimer++;
@@ -411,8 +413,6 @@ void MidiDriver_AdLib::send(uint32 b) {
byte op1 = (b >> 8) & 0xff;
byte op2 = (b >> 16) & 0xff;
- updateChannelInUseTimers();
-
switch (command) {
case 0x80:
noteOff(channel, op1);