sms: set initial audio mixing state on reset [Enik Land]

This commit is contained in:
MetalliC 2016-11-01 02:28:42 +02:00
parent aa758804ab
commit 8b9fab79ff
5 changed files with 45 additions and 18 deletions

View File

@ -93,6 +93,16 @@ void sega_fm_unit_device::device_start()
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void sega_fm_unit_device::device_reset()
{
set_audio_control(0x00);
}
//-------------------------------------------------
// peripheral_r - fm unit read
//-------------------------------------------------
@ -125,21 +135,7 @@ WRITE8_MEMBER(sega_fm_unit_device::peripheral_w)
break;
case 2: // control port
case 3: // mirror
m_audio_control = data & 0x01;
if (m_audio_control == 0x01)
{
m_ym->set_output_gain(ALL_OUTPUTS, 1.0);
// assume the PSG output is muted when FM is active.
// Out Run need this. Needs confirmation (see TODO).
if (m_psg.found())
m_psg->set_output_gain(ALL_OUTPUTS, 0.0);
}
else
{
m_ym->set_output_gain(ALL_OUTPUTS, 0.0);
if (m_psg.found())
m_psg->set_output_gain(ALL_OUTPUTS, 1.0);
}
set_audio_control(data);
break;
default:
break;
@ -157,3 +153,24 @@ bool sega_fm_unit_device::is_writeable(uint8_t offset)
{
return (offset <= 3) ? true : false;
}
void sega_fm_unit_device::set_audio_control(uint8_t data)
{
m_audio_control = data & 0x01;
if (m_audio_control == 0x01)
{
m_ym->set_output_gain(ALL_OUTPUTS, 1.0);
// assume the PSG output is muted when FM is active.
// Out Run need this. Needs confirmation (see TODO).
if (m_psg.found())
m_psg->set_output_gain(ALL_OUTPUTS, 0.0);
}
else
{
m_ym->set_output_gain(ALL_OUTPUTS, 0.0);
if (m_psg.found())
m_psg->set_output_gain(ALL_OUTPUTS, 1.0);
}
}

View File

@ -35,6 +35,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// device_sg1000_expansion_slot_interface overrides
@ -42,6 +43,7 @@ protected:
virtual DECLARE_WRITE8_MEMBER(peripheral_w) override;
virtual bool is_readable(uint8_t offset) override;
virtual bool is_writeable(uint8_t offset) override;
void set_audio_control(uint8_t data);
private:
required_device<ym2413_device> m_ym;

View File

@ -300,7 +300,7 @@ static ADDRESS_MAP_START( sg1000m3_io, AS_IO, 8, sms_state )
AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w)
AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write)
AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write)
AM_RANGE(0xc0, 0xc7) AM_MIRROR(0x38) AM_READWRITE(sg1000m3_peripheral_r,sg1000m3_peripheral_w)
AM_RANGE(0xc0, 0xc7) AM_MIRROR(0x38) AM_READWRITE(sg1000m3_peripheral_r, sg1000m3_peripheral_w)
ADDRESS_MAP_END
@ -945,6 +945,7 @@ static MACHINE_CONFIG_START( gamegear, sms_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
/* actually, PSG is embedded in the VDP chip */
MCFG_SOUND_ADD("gamegear", GAMEGEAR, MASTER_CLOCK_GG/9)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)

View File

@ -227,6 +227,7 @@ protected:
void setup_enabled_slots();
void lphaser_hcount_latch();
void sms_get_inputs();
void smsj_set_audio_control(uint8_t data);
};
class smssdisp_state : public sms_state

View File

@ -455,7 +455,7 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
}
WRITE8_MEMBER(sms_state::smsj_audio_control_w)
void sms_state::smsj_set_audio_control(uint8_t data)
{
m_smsj_audio_control = data & 0x03;
@ -477,6 +477,12 @@ WRITE8_MEMBER(sms_state::smsj_audio_control_w)
}
WRITE8_MEMBER(sms_state::smsj_audio_control_w)
{
smsj_set_audio_control(data);
}
READ8_MEMBER(sms_state::smsj_audio_control_r)
{
uint8_t data;
@ -1114,7 +1120,7 @@ MACHINE_RESET_MEMBER(sms_state,sms)
{
if (m_is_smsj)
{
m_smsj_audio_control = 0x00;
smsj_set_audio_control(0x00);
}
if (m_port_rapid.found())