mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
k054321: remember initial speaker input gains, this fixes volume balance in xmen (nw)
This commit is contained in:
parent
ecf0c22f7d
commit
8c875845a7
@ -56,8 +56,8 @@ void k054321_device::sound_map(address_map &map)
|
||||
map(0x3, 0x3).r(FUNC(k054321_device::main2_r));
|
||||
}
|
||||
|
||||
k054321_device::k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, K054321, tag, owner, clock),
|
||||
k054321_device::k054321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, K054321, tag, owner, clock),
|
||||
m_left(*this, finder_base::DUMMY_TAG),
|
||||
m_right(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
@ -65,6 +65,20 @@ k054321_device::k054321_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
void k054321_device::device_start()
|
||||
{
|
||||
// make sure that device_sound_interface is configured
|
||||
if (!m_left->inputs() && !m_right->inputs())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
// remember initial input gains
|
||||
m_left_gains = std::make_unique<float[]>(m_left->inputs());
|
||||
m_right_gains = std::make_unique<float[]>(m_right->inputs());
|
||||
|
||||
for (int i = 0; i < m_left->inputs(); i++)
|
||||
m_left_gains[i] = m_left->input_gain(i);
|
||||
for (int i = 0; i < m_right->inputs(); i++)
|
||||
m_right_gains[i] = m_right->input_gain(i);
|
||||
|
||||
// register for savestates
|
||||
save_item(NAME(m_main1));
|
||||
save_item(NAME(m_main2));
|
||||
save_item(NAME(m_sound1));
|
||||
@ -110,8 +124,12 @@ WRITE8_MEMBER(k054321_device::volume_reset_w)
|
||||
|
||||
WRITE8_MEMBER(k054321_device::volume_up_w)
|
||||
{
|
||||
m_volume ++;
|
||||
// assume that max volume is 64
|
||||
if (data && m_volume < 64)
|
||||
{
|
||||
m_volume++;
|
||||
propagate_volume();
|
||||
}
|
||||
}
|
||||
|
||||
READ8_MEMBER(k054321_device::busy_r)
|
||||
@ -136,7 +154,7 @@ void k054321_device::propagate_volume()
|
||||
double vol = pow(2, (m_volume - 40)/10.0);
|
||||
|
||||
for (int i = 0; i < m_left->inputs(); i++)
|
||||
m_left->set_input_gain(i, m_active & 2 ? vol : 0.0);
|
||||
m_left->set_input_gain(i, m_active & 2 ? vol * m_left_gains[i] : 0.0);
|
||||
for (int i = 0; i < m_right->inputs(); i++)
|
||||
m_right->set_input_gain(i, m_active & 1 ? vol : 0.0);
|
||||
m_right->set_input_gain(i, m_active & 1 ? vol * m_right_gains[i] : 0.0);
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ private:
|
||||
required_device<device_sound_interface> m_left;
|
||||
required_device<device_sound_interface> m_right;
|
||||
|
||||
std::unique_ptr<float[]> m_left_gains;
|
||||
std::unique_ptr<float[]> m_right_gains;
|
||||
|
||||
u8 m_main1;
|
||||
u8 m_main2;
|
||||
u8 m_sound1;
|
||||
|
@ -459,8 +459,8 @@ MACHINE_CONFIG_START(rungun_state::rng)
|
||||
// BGM, volumes handtuned to make SFXs audible (still not 100% right tho)
|
||||
MCFG_DEVICE_ADD("k054539_2", K054539, 18.432_MHz_XTAL)
|
||||
MCFG_DEVICE_ADDRESS_MAP(0, k054539_map)
|
||||
MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
|
||||
MCFG_SOUND_ROUTE(1, "lspeaker", 0.25)
|
||||
MCFG_SOUND_ROUTE(0, "rspeaker", 0.6)
|
||||
MCFG_SOUND_ROUTE(1, "lspeaker", 0.6)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
// for dual-screen output Run and Gun requires the video de-multiplexer board connected to the Jamma output, this gives you 2 Jamma connectors, one for each screen.
|
||||
|
Loading…
Reference in New Issue
Block a user