From 8056c1bc9afae88ea1399834674474108e9261c7 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 14 Jul 2024 14:48:43 -0400 Subject: [PATCH] Nuked: wrbuf -> writebuf --- src/include/86box/snd_opl_nuked.h | 18 +++++------ src/sound/snd_opl_nuked.c | 50 +++++++++++++++---------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/include/86box/snd_opl_nuked.h b/src/include/86box/snd_opl_nuked.h index b6e128d09..508affde2 100644 --- a/src/include/86box/snd_opl_nuked.h +++ b/src/include/86box/snd_opl_nuked.h @@ -24,8 +24,8 @@ #define OPL_ENABLE_STEREOEXT 0 #endif -#define WRBUF_SIZE 1024 -#define WRBUF_DELAY 1 +#define OPL_WRITEBUF_SIZE 1024 +#define OPL_WRITEBUF_DELAY 2 struct chan; struct chip; @@ -85,11 +85,11 @@ typedef struct chan { uint8_t ch_num; } opl3_channel; -typedef struct wrbuf { +typedef struct _opl3_writebuf { uint64_t time; uint16_t reg; uint8_t data; -} wrbuf_t; +} opl3_writebuf; typedef struct chip { opl3_channel channel[18]; @@ -128,11 +128,11 @@ typedef struct chip { int32_t oldsamples[4]; int32_t samples[4]; - uint64_t wrbuf_samplecnt; - uint32_t wrbuf_cur; - uint32_t wrbuf_last; - uint64_t wrbuf_lasttime; - wrbuf_t wrbuf[WRBUF_SIZE]; + uint64_t writebuf_samplecnt; + uint32_t writebuf_cur; + uint32_t writebuf_last; + uint64_t writebuf_lasttime; + opl3_writebuf writebuf[OPL_WRITEBUF_SIZE]; } opl3_chip; typedef struct { diff --git a/src/sound/snd_opl_nuked.c b/src/sound/snd_opl_nuked.c index f578b460c..958dc87d5 100644 --- a/src/sound/snd_opl_nuked.c +++ b/src/sound/snd_opl_nuked.c @@ -1058,14 +1058,14 @@ process_slot(opl3_slot *slot) static inline void nuked_generate_4ch(void *priv, int32_t *buf4) { - opl3_chip *chip = (opl3_chip *) priv; - opl3_channel *channel; - wrbuf_t *writebuf; - int16_t **out; - int32_t mix[2]; - int16_t accm; - int16_t shift = 0; - uint8_t i; + opl3_chip *chip = (opl3_chip *) priv; + opl3_channel *channel; + opl3_writebuf *writebuf; + int16_t **out; + int32_t mix[2]; + int16_t accm; + int16_t shift = 0; + uint8_t i; buf4[1] = chip->mixbuff[1]; buf4[3] = chip->mixbuff[3]; @@ -1166,7 +1166,7 @@ nuked_generate_4ch(void *priv, int32_t *buf4) chip->eg_state ^= 1; - while (writebuf = &chip->wrbuf[chip->wrbuf_cur], writebuf->time <= chip->wrbuf_samplecnt) { + while (writebuf = &chip->writebuf[chip->writebuf_cur], writebuf->time <= chip->writebuf_samplecnt) { if (!(writebuf->reg & 0x200)) break; @@ -1174,10 +1174,10 @@ nuked_generate_4ch(void *priv, int32_t *buf4) nuked_write_reg(chip, writebuf->reg, writebuf->data); - chip->wrbuf_cur = (chip->wrbuf_cur + 1) % WRBUF_SIZE; + chip->writebuf_cur = (chip->writebuf_cur + 1) % OPL_WRITEBUF_SIZE; } - chip->wrbuf_samplecnt++; + chip->writebuf_samplecnt++; } void @@ -1419,33 +1419,33 @@ nuked_write_reg(void *priv, uint16_t reg, uint8_t val) void nuked_write_reg_buffered(void *priv, uint16_t reg, uint8_t val) { - opl3_chip *chip = (opl3_chip *) priv; - uint64_t time1; - uint64_t time2; - wrbuf_t *writebuf; - uint32_t writebuf_last; + opl3_chip *chip = (opl3_chip *) priv; + uint64_t time1; + uint64_t time2; + opl3_writebuf *writebuf; + uint32_t writebuf_last; - writebuf_last = chip->wrbuf_last; - writebuf = &chip->wrbuf[writebuf_last]; + writebuf_last = chip->writebuf_last; + writebuf = &chip->writebuf[writebuf_last]; if (writebuf->reg & 0x0200) { nuked_write_reg(chip, writebuf->reg & 0x01ff, writebuf->data); - chip->wrbuf_cur = (writebuf_last + 1) % WRBUF_SIZE; - chip->wrbuf_samplecnt = writebuf->time; + chip->writebuf_cur = (writebuf_last + 1) % OPL_WRITEBUF_SIZE; + chip->writebuf_samplecnt = writebuf->time; } writebuf->reg = reg | 0x0200; writebuf->data = val; - time1 = chip->wrbuf_lasttime + WRBUF_DELAY; - time2 = chip->wrbuf_samplecnt; + time1 = chip->writebuf_lasttime + OPL_WRITEBUF_DELAY; + time2 = chip->writebuf_samplecnt; if (time1 < time2) time1 = time2; - writebuf->time = time1; - chip->wrbuf_lasttime = time1; - chip->wrbuf_last = (writebuf_last + 1) % WRBUF_SIZE; + writebuf->time = time1; + chip->writebuf_lasttime = time1; + chip->writebuf_last = (writebuf_last + 1) % OPL_WRITEBUF_SIZE; } void