Skip to content

Commit

Permalink
Merge pull request #5085 from StevenSYS/master
Browse files Browse the repository at this point in the history
Update NukedOPL to the latest commit.
  • Loading branch information
joncampbell123 authored Jul 2, 2024
2 parents 214c048 + e025eb2 commit 8afc213
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hardware/nukedopl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ static void OPL3_EnvelopeCalc(opl3_slot *slot)
}
else
{
shift = (rate_hi & 0x03) + eg_incstep[rate_lo][slot->chip->timer & 0x03u];
shift = (rate_hi & 0x03) + eg_incstep[rate_lo][slot->chip->eg_timer_lo];
if (shift & 0x04)
{
shift = 0x03;
Expand Down Expand Up @@ -1207,10 +1207,9 @@ inline void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4)

chip->timer++;

chip->eg_add = 0;
if (chip->eg_timer)
if (chip->eg_state)
{
while (shift < 36 && ((chip->eg_timer >> shift) & 1) == 0)
while (shift < 13 && ((chip->eg_timer >> shift) & 1) == 0)
{
shift++;
}
Expand All @@ -1222,6 +1221,7 @@ inline void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4)
{
chip->eg_add = shift + 1;
}
chip->eg_timer_lo = (uint8_t)(chip->eg_timer & 0x3u);
}

if (chip->eg_timerrem || chip->eg_state)
Expand Down
1 change: 1 addition & 0 deletions src/hardware/nukedopl.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct _opl3_chip {
uint8_t eg_timerrem;
uint8_t eg_state;
uint8_t eg_add;
uint8_t eg_timer_lo;
uint8_t newm;
uint8_t nts;
uint8_t rhy;
Expand Down

0 comments on commit 8afc213

Please sign in to comment.