GA20: another optimization
This commit is contained in:
parent
f55f92975a
commit
0e0aab88de
|
|
@ -77,6 +77,7 @@ void iremga20_device::device_reset()
|
||||||
{
|
{
|
||||||
m_channel[i].rate = 0;
|
m_channel[i].rate = 0;
|
||||||
m_channel[i].pos = 0;
|
m_channel[i].pos = 0;
|
||||||
|
m_channel[i].sample = 0;
|
||||||
m_channel[i].counter = 0;
|
m_channel[i].counter = 0;
|
||||||
m_channel[i].end = 0;
|
m_channel[i].end = 0;
|
||||||
m_channel[i].volume = 0;
|
m_channel[i].volume = 0;
|
||||||
|
|
@ -99,17 +100,17 @@ void iremga20_device::sound_stream_update(short** outputs, int len)
|
||||||
channel_def &ch = m_channel[j];
|
channel_def &ch = m_channel[j];
|
||||||
if (ch.play)
|
if (ch.play)
|
||||||
{
|
{
|
||||||
int sample = m_intf.read_byte(ch.pos);
|
if (ch.sample == 0x00) // check for sample end marker
|
||||||
if (sample == 0x00) // check for sample end marker
|
|
||||||
ch.play = false;
|
ch.play = false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleout = ch.mute ? 0 : (sample - 0x80) * (s32)ch.volume;
|
sampleout = ch.mute ? 0 : (ch.sample - 0x80) * (s32)ch.volume;
|
||||||
ch.counter--;
|
ch.counter--;
|
||||||
if (ch.counter <= ch.rate)
|
if (ch.counter <= ch.rate)
|
||||||
{
|
{
|
||||||
ch.pos++;
|
ch.pos++;
|
||||||
ch.counter = 0x100;
|
ch.counter = 0x100;
|
||||||
|
ch.sample = m_intf.read_byte(ch.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -150,6 +151,7 @@ void iremga20_device::write(u32 offset, u8 data)
|
||||||
m_channel[ch].pos = (m_regs[ch << 3 | 0] | m_regs[ch << 3 | 1] << 8) << 4;
|
m_channel[ch].pos = (m_regs[ch << 3 | 0] | m_regs[ch << 3 | 1] << 8) << 4;
|
||||||
m_channel[ch].end = (m_regs[ch << 3 | 2] | m_regs[ch << 3 | 3] << 8) << 4;
|
m_channel[ch].end = (m_regs[ch << 3 | 2] | m_regs[ch << 3 | 3] << 8) << 4;
|
||||||
m_channel[ch].counter = 0x100;
|
m_channel[ch].counter = 0x100;
|
||||||
|
m_channel[ch].sample = m_intf.read_byte(m_channel[ch].pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_channel[ch].play = false;
|
m_channel[ch].play = false;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ private:
|
||||||
struct channel_def
|
struct channel_def
|
||||||
{
|
{
|
||||||
channel_def() :
|
channel_def() :
|
||||||
|
sample(0),
|
||||||
rate(0),
|
rate(0),
|
||||||
pos(0),
|
pos(0),
|
||||||
counter(0),
|
counter(0),
|
||||||
|
|
@ -67,6 +68,7 @@ private:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sample;
|
||||||
u32 rate;
|
u32 rate;
|
||||||
u32 pos;
|
u32 pos;
|
||||||
u32 counter;
|
u32 counter;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue