(MESS) ngp.c: Implemented disabling the t6w28 output. (nw)

This commit is contained in:
Wilbert Pol 2012-10-17 17:48:40 +00:00
parent b9bc5b2b62
commit 71f3911c87
3 changed files with 23 additions and 4 deletions

View File

@ -233,11 +233,19 @@ void t6w28_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
left -= nextevent;
} while (left > 0);
out0 = vol[4] * m_volume[4] + vol[5] * m_volume[5] +
vol[6] * m_volume[6] + vol[3] * m_volume[7];
if (m_enabled)
{
out0 = vol[4] * m_volume[4] + vol[5] * m_volume[5] +
vol[6] * m_volume[6] + vol[3] * m_volume[7];
out1 = vol[4] * m_volume[0] + vol[5] * m_volume[1] +
vol[6] * m_volume[2] + vol[3] * m_volume[3];
out1 = vol[4] * m_volume[0] + vol[5] * m_volume[1] +
vol[6] * m_volume[2] + vol[3] * m_volume[3];
}
else
{
out0 = 0;
out1 = 0;
}
if (out0 > MAX_OUTPUT * STEP) out0 = MAX_OUTPUT * STEP;
if (out1 > MAX_OUTPUT * STEP) out1 = MAX_OUTPUT * STEP;
@ -328,6 +336,13 @@ void t6w28_device::device_start()
save_item(NAME(m_period));
save_item(NAME(m_count));
save_item(NAME(m_output));
save_item(NAME(m_enabled));
}
void t6w28_device::set_enable(bool enable)
{
m_enabled = enable;
}
const device_type T6W28 = &device_creator<t6w28_device>;

View File

@ -10,6 +10,7 @@ public:
t6w28_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_WRITE8_MEMBER( write );
void set_enable( bool enable );
protected:
// device-level overrides
@ -35,6 +36,7 @@ private:
INT32 m_period[8];
INT32 m_count[8];
INT32 m_output[8];
bool m_enabled;
};
extern const device_type T6W28;

View File

@ -256,8 +256,10 @@ WRITE8_MEMBER( ngp_state::ngp_io_w )
switch( data )
{
case 0x55: /* Enabled sound */
m_t6w28->set_enable( true );
break;
case 0xAA: /* Disable sound */
m_t6w28->set_enable( false );
break;
}
break;