From 8670d6e4f464fea9e6b55c48df5103e8904af429 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 9 Nov 2012 04:57:25 +0000 Subject: [PATCH] - The raw OPL music player no longer checks against the chip count for writing to the second OPL2; OPLwriteReg() will now do nothing when called to act on a chip that doesn't exist. This is so that it can use the second half of a single OPL3. SVN r3949 (trunk) --- src/oplsynth/mlopl_io.cpp | 5 ++++- src/oplsynth/opl_mus_player.cpp | 12 +++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/oplsynth/mlopl_io.cpp b/src/oplsynth/mlopl_io.cpp index 5e2f23e93..4dc15e39f 100644 --- a/src/oplsynth/mlopl_io.cpp +++ b/src/oplsynth/mlopl_io.cpp @@ -68,7 +68,10 @@ void OPLio::OPLwriteReg(int which, uint reg, uchar data) reg |= (which & 1) << 8; which >>= 1; } - chips[which]->WriteReg(reg, data); + if (chips[which] != NULL) + { + chips[which]->WriteReg(reg, data); + } } /* diff --git a/src/oplsynth/opl_mus_player.cpp b/src/oplsynth/opl_mus_player.cpp index df4b3c88e..335e6d66e 100644 --- a/src/oplsynth/opl_mus_player.cpp +++ b/src/oplsynth/opl_mus_player.cpp @@ -411,10 +411,7 @@ int OPLmusicFile::PlayTick () break; default: // It's something to stuff into the OPL chip - if (WhichChip < NumChips) - { - io->OPLwriteReg(WhichChip, reg, data); - } + io->OPLwriteReg(WhichChip, reg, data); break; } } @@ -454,10 +451,7 @@ int OPLmusicFile::PlayTick () { data = *score++; } - if (WhichChip < NumChips) - { - io->OPLwriteReg(WhichChip, reg, data); - } + io->OPLwriteReg(WhichChip, reg, data); } break; @@ -485,7 +479,7 @@ int OPLmusicFile::PlayTick () { return (data + 1) << 8; } - else if (code < to_reg_size && which < NumChips) + else if (code < to_reg_size) { io->OPLwriteReg(which, to_reg[code], data); }