Merge pull request #2883 from Cacodemon345/mirosound_pcm10_opl4

OPTiMC: Fix CD audio mixer and gameport type
This commit is contained in:
Miran Grča
2022-11-20 16:14:39 +01:00
committed by GitHub
2 changed files with 26 additions and 15 deletions

View File

@@ -384,8 +384,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
if (updatefreq)
ad1848_updatefreq(ad1848);
if (ad1848->type >= AD1848_TYPE_CS4231) { /* TODO: configure CD volume for CS4248/AD1848 too */
temp = (ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4;
temp = (ad1848->type < AD1848_TYPE_CS4231) ? 2 : ((ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4);
if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_l = 0;
else
@@ -395,7 +394,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
ad1848->cd_vol_r = 0;
else
ad1848->cd_vol_r = ad1848_vols_5bits_aux_gain[ad1848->regs[temp] & 0x1f];
}
break;
case 2:
@@ -600,7 +599,7 @@ ad1848_filter_cd_audio(int channel, double *buffer, void *priv)
}
void
ad1848_filter_aux2(void* priv, double* out_l, double* out_r)
ad1848_filter_aux2(void *priv, double *out_l, double *out_r)
{
ad1848_t *ad1848 = (ad1848_t *) priv;

View File

@@ -328,6 +328,18 @@ optimc_reg_read(uint16_t addr, void *p)
return temp;
}
static void
optimc_filter_cd_audio(int channel, double *buffer, void *p)
{
optimc_t *optimc = (optimc_t*) p;
if (optimc->cur_wss_enabled) {
ad1848_filter_cd_audio(channel, buffer, p);
} else {
sbpro_filter_cd_audio(channel, buffer, p);
}
}
static void *
optimc_init(const device_t *info)
{
@@ -352,7 +364,7 @@ optimc_init(const device_t *info)
optimc->regs[4] = 0x3F;
optimc->regs[5] = 0x83;
optimc->gameport = gameport_add(&gameport_device);
optimc->gameport = gameport_add(&gameport_pnp_device);
gameport_remap(optimc->gameport, (optimc->regs[0] & 0x1) ? 0x00 : 0x200);
if (info->local & 0x100)
@@ -392,7 +404,7 @@ optimc_init(const device_t *info)
io_sethandler(optimc->cur_addr + 4, 0x0002, sb_ct1345_mixer_read, NULL, NULL, sb_ct1345_mixer_write, NULL, NULL, optimc->sb);
sound_add_handler(optimc_get_buffer, optimc);
sound_set_cd_audio_filter(sbpro_filter_cd_audio, optimc->sb);
sound_set_cd_audio_filter(optimc_filter_cd_audio, optimc);
optimc->mpu = (mpu_t *) malloc(sizeof(mpu_t));
memset(optimc->mpu, 0, sizeof(mpu_t));