qsound clipping fix from MAME
This commit is contained in:
parent
3804e45042
commit
a92c29bbdb
|
@ -162,7 +162,7 @@ void qsound_reset(struct qsound_chip *chip)
|
||||||
chip->state_counter = 0;
|
chip->state_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t qsound_stream_update(struct qsound_chip *chip, int16_t **outputs, int samples)
|
void qsound_stream_update(struct qsound_chip *chip, int16_t **outputs, int samples)
|
||||||
{
|
{
|
||||||
// Clear the buffers
|
// Clear the buffers
|
||||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||||
|
@ -174,10 +174,9 @@ uint8_t qsound_stream_update(struct qsound_chip *chip, int16_t **outputs, int sa
|
||||||
outputs[0][i] = chip->out[0];
|
outputs[0][i] = chip->out[0];
|
||||||
outputs[1][i] = chip->out[1];
|
outputs[1][i] = chip->out[1];
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t qsound_w(struct qsound_chip *chip, uint8_t offset, uint8_t data)
|
void qsound_w(struct qsound_chip *chip, uint8_t offset, uint8_t data)
|
||||||
{
|
{
|
||||||
switch (offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +192,6 @@ uint8_t qsound_w(struct qsound_chip *chip, uint8_t offset, uint8_t data)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t qsound_r(struct qsound_chip *chip)
|
uint8_t qsound_r(struct qsound_chip *chip)
|
||||||
|
@ -614,10 +612,14 @@ static void state_normal_update(struct qsound_chip *chip)
|
||||||
pan_index = 97;
|
pan_index = 97;
|
||||||
|
|
||||||
// Apply different volume tables on the dry and wet inputs.
|
// Apply different volume tables on the dry and wet inputs.
|
||||||
dry -= (chip->voice_output[v] * chip->pan_tables[ch][PANTBL_DRY][pan_index])<<2;
|
dry -= (chip->voice_output[v] * chip->pan_tables[ch][PANTBL_DRY][pan_index]);
|
||||||
wet -= (chip->voice_output[v] * chip->pan_tables[ch][PANTBL_WET][pan_index])<<2;
|
wet -= (chip->voice_output[v] * chip->pan_tables[ch][PANTBL_WET][pan_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Saturate accumulated voices
|
||||||
|
dry = CLAMP(dry, -0x1fffffff, 0x1fffffff) << 2;
|
||||||
|
wet = CLAMP(wet, -0x1fffffff, 0x1fffffff) << 2;
|
||||||
|
|
||||||
// Apply FIR filter on 'wet' input
|
// Apply FIR filter on 'wet' input
|
||||||
wet = fir(&chip->filter[ch], wet >> 16);
|
wet = fir(&chip->filter[ch], wet >> 16);
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ long qsound_start(struct qsound_chip *chip, int clock);
|
||||||
void qsound_reset(struct qsound_chip *chip);
|
void qsound_reset(struct qsound_chip *chip);
|
||||||
void qsound_update(struct qsound_chip *chip);
|
void qsound_update(struct qsound_chip *chip);
|
||||||
|
|
||||||
uint8_t qsound_stream_update(struct qsound_chip *chip, int16_t **outputs, int samples);
|
void qsound_stream_update(struct qsound_chip *chip, int16_t **outputs, int samples);
|
||||||
uint8_t qsound_w(struct qsound_chip *chip, uint8_t offset, uint8_t data);
|
void qsound_w(struct qsound_chip *chip, uint8_t offset, uint8_t data);
|
||||||
uint8_t qsound_r(struct qsound_chip *chip);
|
uint8_t qsound_r(struct qsound_chip *chip);
|
||||||
void qsound_write_data(struct qsound_chip *chip, uint8_t address, uint16_t data);
|
void qsound_write_data(struct qsound_chip *chip, uint8_t address, uint16_t data);
|
||||||
uint16_t qsound_read_data(struct qsound_chip *chip, uint8_t address);
|
uint16_t qsound_read_data(struct qsound_chip *chip, uint8_t address);
|
||||||
|
|
Loading…
Reference in New Issue