- 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)
This commit is contained in:
Randy Heit 2012-11-09 04:57:25 +00:00
parent b513931473
commit 8670d6e4f4
2 changed files with 7 additions and 10 deletions

View file

@ -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);
}
}
/*

View file

@ -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);
}