implemented volume, taitognet sounds pretty good now, still need to find out why taitofx1b sound sucks compared to it, especially raystorm

This commit is contained in:
Michaël Banaan Ananas 2014-02-21 20:03:05 +00:00
parent 736c01352e
commit 451f2b6a97
4 changed files with 27 additions and 18 deletions

View File

@ -44,13 +44,11 @@
---------------------------------------------------------
Emulation is still preliminary.
TODO:
- channel volume, 16bits?? need to make a lookup table?
- some samples are in stereo format?
- volume/panning is linear?
- what is reg 0xa/0xc? seems related to volume
- identify sample flags
- memory reads out of range sometimes
- a lot of unknowns
*/
@ -110,6 +108,7 @@ void zsg2_device::device_start()
save_item(NAME(m_chan[ch].loop_pos), ch);
save_item(NAME(m_chan[ch].page), ch);
save_item(NAME(m_chan[ch].vol), ch);
save_item(NAME(m_chan[ch].flags), ch);
save_item(NAME(m_chan[ch].panl), ch);
save_item(NAME(m_chan[ch].panr), ch);
}
@ -217,17 +216,14 @@ void zsg2_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
m_chan[ch].samples = prepare_samples(m_chan[ch].page | m_chan[ch].cur_pos);
}
INT16 sample = m_chan[ch].samples[m_chan[ch].step_ptr >> 16 & 3];
//sample = (sample * (m_chan[ch].vol & 0xffff)) / 0x10000;
if (m_chan[ch].vol == 0) sample = 0; // temp hack to prevent stuck notes
INT32 sample = (m_chan[ch].samples[m_chan[ch].step_ptr >> 16 & 3] * m_chan[ch].vol) >> 16;
mix_l += (sample * m_chan[ch].panl + sample * (0x1f - m_chan[ch].panr)) >> 5;
mix_r += (sample * m_chan[ch].panr + sample * (0x1f - m_chan[ch].panl)) >> 5;
}
outputs[0][i] = mix_l / 48;
outputs[1][i] = mix_r / 48;
outputs[0][i] = mix_l;
outputs[1][i] = mix_r;
}
}
@ -293,10 +289,15 @@ void zsg2_device::chan_w(int ch, int reg, UINT16 data)
break;
case 0xe:
// channel volume, reg 0xa/0xc is also related?
// volume
m_chan[ch].vol = data;
break;
case 0xf:
// flags
m_chan[ch].flags = data;
break;
default:
break;
}
@ -346,7 +347,7 @@ void zsg2_device::control_w(int reg, UINT16 data)
case 0x04: case 0x05: case 0x06:
{
// key off?
// key off
int base = (reg & 3) << 4;
for (int i = 0; i < 16; i++)
{

View File

@ -59,6 +59,7 @@ private:
UINT32 loop_pos;
UINT32 page;
UINT16 vol;
UINT16 flags;
UINT8 panl;
UINT8 panr;
};

View File

@ -24,9 +24,8 @@ and a Zoom Corp. ZFX-2 DSP instead of the TMS57002.
TODO:
- add TMS57002
- global volume regs
- a lot more
- add DSP, sound is tinny without it
- howcome taito fx1b sounds worse than gnet? especially raystorm
***************************************************************************/
@ -44,6 +43,7 @@ const device_type TAITO_ZOOM = &device_creator<taito_zoom_device>;
taito_zoom_device::taito_zoom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, TAITO_ZOOM, "Taito Zoom Sound System", tag, owner, clock, "taito_zoom", __FILE__),
m_soundcpu(*this, ":mn10200"),
m_zsg2(*this, ":zsg2"),
m_reg_address(0),
m_tms_ctrl(0)
{
@ -143,11 +143,17 @@ WRITE16_MEMBER(taito_zoom_device::reg_data_w)
switch (m_reg_address)
{
case 0x04:
// zsg2+dsp global volume ch0
// zsg2+dsp global volume left
if (data & 0xc0c0)
popmessage("ZOOM gain L %04X, contact MAMEdev", data);
m_zsg2->set_output_gain(0, (data & 0x3f) / 63.0);
break;
case 0x05:
// zsg2+dsp global volume ch1
// zsg2+dsp global volume right
if (data & 0xc0c0)
popmessage("ZOOM gain R %04X, contact MAMEdev", data);
m_zsg2->set_output_gain(1, (data & 0x3f) / 63.0);
break;
default:

View File

@ -30,6 +30,7 @@ private:
// devices/pointers
required_device<mn10200_device> m_soundcpu;
required_device<zsg2_device> m_zsg2;
// internal state
UINT16 m_reg_address;