diff --git a/src/include/nukedopl.h b/src/include/nukedopl.h index 6b3f09228..0c766b1ae 100644 --- a/src/include/nukedopl.h +++ b/src/include/nukedopl.h @@ -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); diff --git a/src/sound/nukedopl.c b/src/sound/nukedopl.c index a2bc192c5..ec580c772 100644 --- a/src/sound/nukedopl.c +++ b/src/sound/nukedopl.c @@ -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++) {