mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 09:58:19 -07:00
Merge branch 'master' of github.com:86Box/86Box into tc1995
This commit is contained in:
@@ -5,8 +5,7 @@ typedef struct opl_t
|
||||
{
|
||||
int pos, chip_nr[2];
|
||||
|
||||
int32_t filtbuf[2],
|
||||
buffer[SOUNDBUFLEN * 2],
|
||||
int32_t buffer[SOUNDBUFLEN * 2],
|
||||
buffer2[SOUNDBUFLEN * 2];
|
||||
|
||||
pc_timer_t timers[2][2];
|
||||
|
||||
@@ -131,8 +131,8 @@ struct opl3_chip {
|
||||
//OPL3L
|
||||
Bit32s rateratio;
|
||||
Bit32s samplecnt;
|
||||
Bit16s oldsamples[2];
|
||||
Bit16s samples[2];
|
||||
Bit32s oldsamples[2];
|
||||
Bit32s samples[2];
|
||||
|
||||
Bit64u writebuf_samplecnt;
|
||||
Bit32u writebuf_cur;
|
||||
@@ -141,7 +141,7 @@ struct opl3_chip {
|
||||
struct opl3_writebuf writebuf[OPL_WRITEBUF_SIZE];
|
||||
};
|
||||
|
||||
void OPL3_Generate(struct opl3_chip *chip, Bit16s *buf);
|
||||
void OPL3_Generate(struct opl3_chip *chip, Bit32s *buf);
|
||||
void OPL3_GenerateResampled(struct opl3_chip *chip, Bit32s *buf);
|
||||
void OPL3_Reset(struct opl3_chip *chip, Bit32u samplerate);
|
||||
Bit32u OPL3_WriteAddr(struct opl3_chip *chip, Bit32u port, Bit8u val);
|
||||
|
||||
@@ -1030,27 +1030,14 @@ static void OPL3_ChannelSet4Op(struct opl3_chip *chip, Bit8u data)
|
||||
}
|
||||
}
|
||||
|
||||
static Bit16s OPL3_ClipSample(Bit32s sample)
|
||||
{
|
||||
if (sample > 32767)
|
||||
{
|
||||
sample = 32767;
|
||||
}
|
||||
else if (sample < -32768)
|
||||
{
|
||||
sample = -32768;
|
||||
}
|
||||
return (Bit16s)sample;
|
||||
}
|
||||
|
||||
void OPL3_Generate(struct opl3_chip *chip, Bit16s *buf)
|
||||
void OPL3_Generate(struct opl3_chip *chip, Bit32s *buf)
|
||||
{
|
||||
Bit8u ii;
|
||||
Bit8u jj;
|
||||
Bit16s accm;
|
||||
Bit8u shift = 0;
|
||||
|
||||
buf[1] = OPL3_ClipSample(chip->mixbuff[1]);
|
||||
buf[1] = chip->mixbuff[1];
|
||||
|
||||
for (ii = 0; ii < 15; ii++)
|
||||
{
|
||||
@@ -1079,7 +1066,7 @@ void OPL3_Generate(struct opl3_chip *chip, Bit16s *buf)
|
||||
OPL3_SlotGenerate(&chip->slot[ii]);
|
||||
}
|
||||
|
||||
buf[0] = OPL3_ClipSample(chip->mixbuff[0]);
|
||||
buf[0] = chip->mixbuff[0];
|
||||
|
||||
for (ii = 18; ii < 33; ii++)
|
||||
{
|
||||
|
||||
@@ -115,8 +115,8 @@ opl2_update2(opl_t *opl)
|
||||
opl2_update(1, &opl->buffer2[opl->pos << 1], sound_pos_global - opl->pos);
|
||||
for (; opl->pos < sound_pos_global; opl->pos++) {
|
||||
opl->buffer[(opl->pos << 1) + 1] = opl->buffer2[(opl->pos << 1) + 1];
|
||||
opl->filtbuf[0] = opl->buffer[opl->pos << 1] = (opl->buffer[opl->pos << 1] / 2);
|
||||
opl->filtbuf[1] = opl->buffer[(opl->pos << 1) + 1] = (opl->buffer[(opl->pos << 1) + 1] / 2);
|
||||
opl->buffer[opl->pos << 1] = (opl->buffer[opl->pos << 1] / 2);
|
||||
opl->buffer[(opl->pos << 1) + 1] = (opl->buffer[(opl->pos << 1) + 1] / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,8 +128,8 @@ opl3_update2(opl_t *opl)
|
||||
if (opl->pos < sound_pos_global) {
|
||||
opl3_update(0, &opl->buffer[(opl->pos << 1)], sound_pos_global - opl->pos);
|
||||
for (; opl->pos < sound_pos_global; opl->pos++) {
|
||||
opl->filtbuf[0] = opl->buffer[opl->pos << 1] = (opl->buffer[opl->pos << 1] / 2);
|
||||
opl->filtbuf[1] = opl->buffer[(opl->pos << 1) + 1] = (opl->buffer[(opl->pos << 1) + 1] / 2);
|
||||
opl->buffer[opl->pos << 1] = (opl->buffer[opl->pos << 1] / 2);
|
||||
opl->buffer[(opl->pos << 1) + 1] = (opl->buffer[(opl->pos << 1) + 1] / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user