SMS: volume table is now non-float

This commit is contained in:
tildearrow 2022-05-26 23:46:42 -05:00
parent 905aa1b1a1
commit 061b312943
3 changed files with 7 additions and 7 deletions

View file

@ -266,7 +266,7 @@ void YMPSG_Init(ympsg_t *chip, uint8_t real_sn)
chip->noise_size = real_sn ? 16383 : 32767; chip->noise_size = real_sn ? 16383 : 32767;
for (i = 0; i < 17; i++) for (i = 0; i < 17; i++)
{ {
chip->vol_table[i]=real_sn?tipsg_vol[i]:ympsg_vol[i]; chip->vol_table[i]=(real_sn?tipsg_vol[i]:ympsg_vol[i]) * 8192.0f;
} }
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
@ -315,15 +315,15 @@ void YMPSG_Clock(ympsg_t *chip)
} }
} }
float YMPSG_GetOutput(ympsg_t *chip) int YMPSG_GetOutput(ympsg_t *chip)
{ {
float sample = 0.f; int sample = 0;
uint32_t i; uint32_t i;
YMPSG_UpdateSample(chip); YMPSG_UpdateSample(chip);
if (chip->test & 1) if (chip->test & 1)
{ {
sample += chip->vol_table[chip->volume_out[chip->test >> 1]]; sample += chip->vol_table[chip->volume_out[chip->test >> 1]];
sample += chip->vol_table[16] * 3.f; sample += chip->vol_table[16] * 3;
} }
else if (!chip->mute) else if (!chip->mute)
{ {

View file

@ -59,7 +59,7 @@ typedef struct {
ympsg_writebuf writebuf[YMPSG_WRITEBUF_SIZE]; ympsg_writebuf writebuf[YMPSG_WRITEBUF_SIZE];
// //
float vol_table[17]; short vol_table[17];
uint8_t mute; uint8_t mute;
@ -71,7 +71,7 @@ uint16_t YMPSG_Read(ympsg_t *chip);
void YMPSG_Init(ympsg_t *chip, uint8_t real_sn); void YMPSG_Init(ympsg_t *chip, uint8_t real_sn);
void YMPSG_SetIC(ympsg_t *chip, uint32_t ic); void YMPSG_SetIC(ympsg_t *chip, uint32_t ic);
void YMPSG_Clock(ympsg_t *chip); void YMPSG_Clock(ympsg_t *chip);
float YMPSG_GetOutput(ympsg_t *chip); int YMPSG_GetOutput(ympsg_t *chip);
void YMPSG_Test(ympsg_t *chip, uint16_t test); void YMPSG_Test(ympsg_t *chip, uint16_t test);

View file

@ -65,7 +65,7 @@ void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_
YMPSG_Clock(&sn_nuked); YMPSG_Clock(&sn_nuked);
YMPSG_Clock(&sn_nuked); YMPSG_Clock(&sn_nuked);
YMPSG_Clock(&sn_nuked); YMPSG_Clock(&sn_nuked);
o=YMPSG_GetOutput(&sn_nuked)*8192.0; o=YMPSG_GetOutput(&sn_nuked);
if (o<-32768) o=-32768; if (o<-32768) o=-32768;
if (o>32767) o=32767; if (o>32767) o=32767;
bufL[h]=o; bufL[h]=o;