More linting in src/sound

This commit is contained in:
Jasmine Iwanek
2023-08-21 20:24:51 -04:00
parent 859d06b608
commit 11a2f5266a
12 changed files with 68 additions and 63 deletions

View File

@@ -151,7 +151,7 @@ midi_out_device_has_config(int card)
return devices[card].device->config ? 1 : 0;
}
char *
const char *
midi_out_device_get_internal_name(int card)
{
return device_get_internal_name(devices[card].device);
@@ -269,7 +269,7 @@ midi_in_device_has_config(int card)
return midi_in_devices[card].device->config ? 1 : 0;
}
char *
const char *
midi_in_device_get_internal_name(int card)
{
return device_get_internal_name(midi_in_devices[card].device);

View File

@@ -888,9 +888,9 @@ adgold_filter_cd_audio(int channel, double *buffer, void *priv)
}
static void
adgold_input_msg(void *p, uint8_t *msg, uint32_t len)
adgold_input_msg(void *priv, uint8_t *msg, uint32_t len)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
if (adgold->sysex)
return;
@@ -908,9 +908,9 @@ adgold_input_msg(void *p, uint8_t *msg, uint32_t len)
}
static int
adgold_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
adgold_input_sysex(void *priv, uint8_t *buffer, uint32_t len, int abort)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
if (abort) {
adgold->sysex = 0;
@@ -930,7 +930,7 @@ adgold_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
void *
adgold_init(UNUSED(const device_t *info))
{
FILE *f;
FILE *fp;
int c;
double out;
adgold_t *adgold = malloc(sizeof(adgold_t));
@@ -980,11 +980,11 @@ adgold_init(UNUSED(const device_t *info))
adgold->adgold_eeprom[0x18] = 0x00; /* Surround */
adgold->adgold_eeprom[0x19] = 0x00;
f = nvr_fopen("adgold.bin", "rb");
if (f) {
if (fread(adgold->adgold_eeprom, 1, 0x1a, f) != 0x1a)
fp = nvr_fopen("adgold.bin", "rb");
if (fp) {
if (fread(adgold->adgold_eeprom, 1, 0x1a, fp) != 0x1a)
fatal("adgold_init(): Error reading data\n");
fclose(f);
fclose(fp);
}
adgold->adgold_status = 0xf;

View File

@@ -2054,18 +2054,18 @@ generate_es1371_filter(void)
}
static void
es1371_input_msg(void *p, uint8_t *msg, uint32_t len)
es1371_input_msg(void *priv, uint8_t *msg, uint32_t len)
{
es1371_t *dev = (es1371_t *) p;
es1371_t *dev = (es1371_t *) priv;
for (uint32_t i = 0; i < len; i++)
es1371_write_fifo(dev, msg[i]);
}
static int
es1371_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
es1371_input_sysex(void *priv, uint8_t *buffer, uint32_t len, int abort)
{
es1371_t *dev = (es1371_t *) p;
es1371_t *dev = (es1371_t *) priv;
uint32_t i = -1;
audiopci_log("Abort = %i\n", abort);

View File

@@ -968,7 +968,7 @@ azt2316a_get_buffer(int32_t *buffer, int len, void *priv)
static void *
azt_init(const device_t *info)
{
FILE *f;
FILE *fp;
char *fn = NULL;
int i;
int loaded_from_eeprom = 0;
@@ -986,20 +986,20 @@ azt_init(const device_t *info)
}
/* config */
f = nvr_fopen(fn, "rb");
if (f) {
fp = nvr_fopen(fn, "rb");
if (fp) {
uint8_t checksum = 0x7f;
uint8_t saved_checksum;
size_t res;
res = fread(read_eeprom, AZTECH_EEPROM_SIZE, 1, f);
res = fread(read_eeprom, AZTECH_EEPROM_SIZE, 1, fp);
for (i = 0; i < AZTECH_EEPROM_SIZE; i++)
checksum += read_eeprom[i];
res = fread(&saved_checksum, sizeof(saved_checksum), 1, f);
res = fread(&saved_checksum, sizeof(saved_checksum), 1, fp);
(void) res;
fclose(f);
fclose(fp);
if (checksum == saved_checksum)
loaded_from_eeprom = 1;
@@ -1273,7 +1273,7 @@ azt_close(void *priv)
{
azt2316a_t *azt2316a = (azt2316a_t *) priv;
char *fn = NULL;
FILE *f;
FILE *fp;
uint8_t checksum = 0x7f;
if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) {
@@ -1283,18 +1283,18 @@ azt_close(void *priv)
}
/* always save to eeprom (recover from bad values) */
f = nvr_fopen(fn, "wb");
if (f) {
fp = nvr_fopen(fn, "wb");
if (fp) {
for (uint8_t i = 0; i < AZTECH_EEPROM_SIZE; i++)
checksum += azt2316a->sb->dsp.azt_eeprom[i];
fwrite(azt2316a->sb->dsp.azt_eeprom, AZTECH_EEPROM_SIZE, 1, f);
fwrite(azt2316a->sb->dsp.azt_eeprom, AZTECH_EEPROM_SIZE, 1, fp);
// TODO: confirm any models saving mixer settings to EEPROM and implement reading back
// TODO: should remember to save wss duplex setting if 86Box has voice recording implemented in the future? Also, default azt2316a->wss_config
// TODO: azt2316a->cur_mode is not saved to EEPROM?
fwrite(&checksum, sizeof(checksum), 1, f);
fwrite(&checksum, sizeof(checksum), 1, fp);
fclose(f);
fclose(fp);
}
sb_close(azt2316a->sb);

View File

@@ -171,13 +171,13 @@ static void cs423x_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config
static void
cs423x_nvram(cs423x_t *dev, uint8_t save)
{
FILE *f = nvr_fopen(dev->nvr_path, save ? "wb" : "rb");
if (f) {
FILE *fp = nvr_fopen(dev->nvr_path, save ? "wb" : "rb");
if (fp) {
if (save)
fwrite(dev->eeprom_data, sizeof(dev->eeprom_data), 1, f);
fwrite(dev->eeprom_data, sizeof(dev->eeprom_data), 1, fp);
else
(void) !fread(dev->eeprom_data, sizeof(dev->eeprom_data), 1, f);
fclose(f);
(void) !fread(dev->eeprom_data, sizeof(dev->eeprom_data), 1, fp);
fclose(fp);
}
}

View File

@@ -2168,18 +2168,18 @@ void
emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
{
uint32_t const BLOCK_SIZE_WORDS = 0x10000;
FILE *f;
FILE *fp;
int c;
double out;
f = rom_fopen("roms/sound/awe32.raw", "rb");
if (!f)
fp = rom_fopen("roms/sound/awe32.raw", "rb");
if (!fp)
fatal("AWE32.RAW not found\n");
emu8k->rom = malloc(1024 * 1024);
if (fread(emu8k->rom, 1, 1048576, f) != 1048576)
if (fread(emu8k->rom, 1, 1048576, fp) != 1048576)
fatal("emu8k_init(): Error reading data\n");
fclose(f);
fclose(fp);
/*AWE-DUMP creates ROM images offset by 2 bytes, so if we detect this
then correct it*/
if (emu8k->rom[3] == 0x314d && emu8k->rom[4] == 0x474d) {

View File

@@ -905,7 +905,7 @@ readgus(uint16_t addr, void *priv)
#ifdef OLD_NMI_BEHAVIOR
nmi = 0;
#endif
/*FALLTHROUGH*/
fallthrough;
case 0x389:
val = gus->ad_data;
break;
@@ -1149,9 +1149,9 @@ gus_get_buffer(int32_t *buffer, int len, void *priv)
}
static void
gus_input_msg(void *p, uint8_t *msg, uint32_t len)
gus_input_msg(void *priv, uint8_t *msg, uint32_t len)
{
gus_t *gus = (gus_t *) p;
gus_t *gus = (gus_t *) priv;
if (gus->sysex)
return;
@@ -1169,9 +1169,9 @@ gus_input_msg(void *p, uint8_t *msg, uint32_t len)
}
static int
gus_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
gus_input_sysex(void *priv, uint8_t *buffer, uint32_t len, int abort)
{
gus_t *gus = (gus_t *) p;
gus_t *gus = (gus_t *) priv;
if (abort) {
gus->sysex = 0;
@@ -1189,11 +1189,11 @@ gus_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
}
static void
gus_reset(void *p)
gus_reset(void *priv)
{
gus_t *gus = (gus_t *) p;
int c;
double out = 1.0;
gus_t *gus = (gus_t *) priv;
int c;
double out = 1.0;
if (gus == NULL)
return;

View File

@@ -145,7 +145,9 @@ MPU401_RunClock(mpu_t *mpu)
return;
}
timer_advance_u64(&mpu->mpu401_event_callback, (MPU401_TIMECONSTANT / mpu->clock.freq) * 1000 * TIMER_USEC);
// mpu401_log("Next event after %" PRIu64 " us (time constant: %i)\n", (uint64_t) ((MPU401_TIMECONSTANT / mpu->clock.freq) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
#if 0
mpu401_log("Next event after %" PRIu64 " us (time constant: %i)\n", (uint64_t) ((MPU401_TIMECONSTANT / mpu->clock.freq) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
#endif
}
static void
@@ -1410,9 +1412,9 @@ MPU401_NotesOff(mpu_t *mpu, int i)
/*Input handler for SysEx */
int
MPU401_InputSysex(void *p, uint8_t *buffer, uint32_t len, int abort)
MPU401_InputSysex(void *priv, uint8_t *buffer, uint32_t len, int abort)
{
mpu_t *mpu = (mpu_t *) p;
mpu_t *mpu = (mpu_t *) priv;
int i;
uint8_t val_ff = 0xff;
@@ -1465,9 +1467,9 @@ MPU401_InputSysex(void *p, uint8_t *buffer, uint32_t len, int abort)
/*Input handler for MIDI*/
void
MPU401_InputMsg(void *p, uint8_t *msg, uint32_t len)
MPU401_InputMsg(void *priv, uint8_t *msg, uint32_t len)
{
mpu_t *mpu = (mpu_t *) p;
mpu_t *mpu = (mpu_t *) priv;
int i;
int tick;
static uint8_t old_msg = 0;

View File

@@ -51,7 +51,7 @@ enum {
class YMFMChipBase {
public:
YMFMChipBase(uint32_t clock, fm_type type, UNUSED(uint32_t samplerate))
YMFMChipBase(UNUSED(uint32_t clock), fm_type type, UNUSED(uint32_t samplerate))
: m_buf_pos(0)
, m_flags(0)
, m_type(type)

View File

@@ -2227,11 +2227,11 @@ sb_awe32_pnp_init(const device_t *info)
uint8_t *pnp_rom = NULL;
if (pnp_rom_file) {
FILE *f = rom_fopen(pnp_rom_file, "rb");
if (f) {
if (fread(sb->pnp_rom, 1, 512, f) == 512)
FILE *fp = rom_fopen(pnp_rom_file, "rb");
if (fp) {
if (fread(sb->pnp_rom, 1, 512, fp) == 512)
pnp_rom = sb->pnp_rom;
fclose(f);
fclose(fp);
}
}

View File

@@ -489,7 +489,7 @@ sb_exec_command(sb_dsp_t *dsp)
case 0x17: /* 2-bit ADPCM output with reference */
dsp->sbref = dsp->dma_readb(dsp->dma_priv);
dsp->sbstep = 0;
/* Fall through */
fallthrough;
case 0x16: /* 2-bit ADPCM output */
sb_start_dma(dsp, 1, 0, ADPCM_2, dsp->sb_data[0] + (dsp->sb_data[1] << 8));
dsp->sbdat2 = dsp->dma_readb(dsp->dma_priv);
@@ -612,7 +612,7 @@ sb_exec_command(sb_dsp_t *dsp)
case 0x77: /* 2.6-bit ADPCM output with reference */
dsp->sbref = dsp->dma_readb(dsp->dma_priv);
dsp->sbstep = 0;
/* Fall through */
fallthrough;
case 0x76: /* 2.6-bit ADPCM output */
sb_start_dma(dsp, 1, 0, ADPCM_26, dsp->sb_data[0] + (dsp->sb_data[1] << 8));
dsp->sbdat2 = dsp->dma_readb(dsp->dma_priv);
@@ -991,6 +991,9 @@ sb_write(uint16_t a, uint8_t v, void *priv)
}
}
break;
default:
break;
}
}
@@ -1064,9 +1067,9 @@ sb_read(uint16_t a, void *priv)
}
void
sb_dsp_input_msg(void *p, uint8_t *msg, uint32_t len)
sb_dsp_input_msg(void *priv, uint8_t *msg, uint32_t len)
{
sb_dsp_t *dsp = (sb_dsp_t *) p;
sb_dsp_t *dsp = (sb_dsp_t *) priv;
sb_dsp_log("MIDI in sysex = %d, uart irq = %d, msg = %d\n", dsp->midi_in_sysex, dsp->uart_irq, len);
@@ -1089,9 +1092,9 @@ sb_dsp_input_msg(void *p, uint8_t *msg, uint32_t len)
}
int
sb_dsp_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
sb_dsp_input_sysex(void *priv, uint8_t *buffer, uint32_t len, int abort)
{
sb_dsp_t *dsp = (sb_dsp_t *) p;
sb_dsp_t *dsp = (sb_dsp_t *) priv;
if (!dsp->uart_irq && !dsp->midi_in_poll && (dsp->mpu != NULL))
return MPU401_InputSysex(dsp->mpu, buffer, len, abort);

View File

@@ -196,7 +196,7 @@ sound_card_has_config(int card)
return device_has_config(sound_cards[card].device) ? 1 : 0;
}
char *
const char *
sound_card_get_internal_name(int card)
{
return device_get_internal_name(sound_cards[card].device);