Skip to content

Commit

Permalink
AUDIO: Sync with upstream Nuked OPL. Last commit: cfedb09e
Browse files Browse the repository at this point in the history
  • Loading branch information
Torbjörn Andersson committed Sep 9, 2024
1 parent b7aae29 commit 3f1772e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
24 changes: 4 additions & 20 deletions audio/softsynth/opl/nuked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,6 @@ static void OPL3_EnvelopeCalc(opl3_slot *slot)
case envelope_gen_num_release:
reg_rate = slot->reg_rr;
break;
default:
break;
}
}
slot->pg_reset = reset;
Expand Down Expand Up @@ -466,7 +464,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 @@ -523,8 +521,6 @@ static void OPL3_EnvelopeCalc(opl3_slot *slot)
eg_inc = 1 << (shift - 1);
}
break;
default:
break;
}
slot->eg_rout = (eg_rout + eg_inc) & 0x1ff;
/* Key off */
Expand Down Expand Up @@ -872,8 +868,6 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
channel->slotz[0]->mod = &channel->slotz[0]->fbmod;
channel->slotz[1]->mod = &channel->chip->zeromod;
break;
default:
break;
}
return;
}
Expand Down Expand Up @@ -929,8 +923,6 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
channel->out[2] = &channel->slotz[1]->out;
channel->out[3] = &channel->chip->zeromod;
break;
default:
break;
}
}
else
Expand All @@ -953,8 +945,6 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
default:
break;
}
}
}
Expand Down Expand Up @@ -1219,10 +1209,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 @@ -1234,6 +1223,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 Expand Up @@ -1392,8 +1382,6 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v)
chip->stereoext = (v >> 1) & 0x01;
#endif
break;
default:
break;
}
}
else
Expand All @@ -1403,8 +1391,6 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v)
case 0x08:
chip->nts = (v >> 6) & 0x01;
break;
default:
break;
}
}
break;
Expand Down Expand Up @@ -1483,8 +1469,6 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v)
}
break;
#endif
default:
break;
}
}

Expand Down
3 changes: 2 additions & 1 deletion audio/softsynth/opl/nuked.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,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 Expand Up @@ -159,7 +160,7 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v);
void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v);
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples);

void OPL3_Generate4Ch(opl3_chip *chpi, int16_t *buf4);
void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4);
void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4);
void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples);

Expand Down

0 comments on commit 3f1772e

Please sign in to comment.