SMS: add TI PSG volume table
This commit is contained in:
parent
33dc18bac2
commit
905aa1b1a1
|
@ -8,6 +8,10 @@ const float ympsg_vol[17] = {
|
||||||
1.0, 0.772, 0.622, 0.485, 0.382, 0.29, 0.229, 0.174, 0.132, 0.096, 0.072, 0.051, 0.034, 0.019, 0.009, 0.0, -1.059
|
1.0, 0.772, 0.622, 0.485, 0.382, 0.29, 0.229, 0.174, 0.132, 0.096, 0.072, 0.051, 0.034, 0.019, 0.009, 0.0, -1.059
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const float tipsg_vol[17] = {
|
||||||
|
1.0, 0.794, 0.631, 0.501, 0.398, 0.316, 0.251, 0.2, 0.158, 0.126, 0.1, 0.079, 0.063, 0.05, 0.04, 0.0, -1.059
|
||||||
|
};
|
||||||
|
|
||||||
static void YMPSG_WriteLatch(ympsg_t *chip)
|
static void YMPSG_WriteLatch(ympsg_t *chip)
|
||||||
{
|
{
|
||||||
uint8_t data = chip->data;
|
uint8_t data = chip->data;
|
||||||
|
@ -260,6 +264,10 @@ void YMPSG_Init(ympsg_t *chip, uint8_t real_sn)
|
||||||
YMPSG_SetIC(chip, 1);
|
YMPSG_SetIC(chip, 1);
|
||||||
chip->noise_tap2 = real_sn ? 13 : 15;
|
chip->noise_tap2 = real_sn ? 13 : 15;
|
||||||
chip->noise_size = real_sn ? 16383 : 32767;
|
chip->noise_size = real_sn ? 16383 : 32767;
|
||||||
|
for (i = 0; i < 17; i++)
|
||||||
|
{
|
||||||
|
chip->vol_table[i]=real_sn?tipsg_vol[i]:ympsg_vol[i];
|
||||||
|
}
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
YMPSG_Clock(chip);
|
YMPSG_Clock(chip);
|
||||||
|
@ -314,22 +322,22 @@ float YMPSG_GetOutput(ympsg_t *chip)
|
||||||
YMPSG_UpdateSample(chip);
|
YMPSG_UpdateSample(chip);
|
||||||
if (chip->test & 1)
|
if (chip->test & 1)
|
||||||
{
|
{
|
||||||
sample += ympsg_vol[chip->volume_out[chip->test >> 1]];
|
sample += chip->vol_table[chip->volume_out[chip->test >> 1]];
|
||||||
sample += ympsg_vol[16] * 3.f;
|
sample += chip->vol_table[16] * 3.f;
|
||||||
}
|
}
|
||||||
else if (!chip->mute)
|
else if (!chip->mute)
|
||||||
{
|
{
|
||||||
sample += ympsg_vol[chip->volume_out[0]];
|
sample += chip->vol_table[chip->volume_out[0]];
|
||||||
sample += ympsg_vol[chip->volume_out[1]];
|
sample += chip->vol_table[chip->volume_out[1]];
|
||||||
sample += ympsg_vol[chip->volume_out[2]];
|
sample += chip->vol_table[chip->volume_out[2]];
|
||||||
sample += ympsg_vol[chip->volume_out[3]];
|
sample += chip->vol_table[chip->volume_out[3]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (!((chip->mute>>i) & 1))
|
if (!((chip->mute>>i) & 1))
|
||||||
sample += ympsg_vol[chip->volume_out[i]];
|
sample += chip->vol_table[chip->volume_out[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sample;
|
return sample;
|
||||||
|
|
|
@ -58,6 +58,10 @@ typedef struct {
|
||||||
uint64_t writebuf_lasttime;
|
uint64_t writebuf_lasttime;
|
||||||
ympsg_writebuf writebuf[YMPSG_WRITEBUF_SIZE];
|
ympsg_writebuf writebuf[YMPSG_WRITEBUF_SIZE];
|
||||||
|
|
||||||
|
//
|
||||||
|
float vol_table[17];
|
||||||
|
|
||||||
|
|
||||||
uint8_t mute;
|
uint8_t mute;
|
||||||
} ympsg_t;
|
} ympsg_t;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ const char* DivPlatformSMS::getEffectName(unsigned char effect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
|
int o=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
unsigned char w=writes.front();
|
unsigned char w=writes.front();
|
||||||
|
@ -64,7 +65,10 @@ 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);
|
||||||
bufL[h]=YMPSG_GetOutput(&sn_nuked)*8192.0;
|
o=YMPSG_GetOutput(&sn_nuked)*8192.0;
|
||||||
|
if (o<-32768) o=-32768;
|
||||||
|
if (o>32767) o=32767;
|
||||||
|
bufL[h]=o;
|
||||||
/*
|
/*
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
if (isMuted[i]) {
|
if (isMuted[i]) {
|
||||||
|
|
Loading…
Reference in New Issue