GA20: another optimization

This commit is contained in:
tildearrow 2025-02-18 05:53:54 -05:00
parent f55f92975a
commit 0e0aab88de
2 changed files with 7 additions and 3 deletions

View file

@ -77,6 +77,7 @@ void iremga20_device::device_reset()
{
m_channel[i].rate = 0;
m_channel[i].pos = 0;
m_channel[i].sample = 0;
m_channel[i].counter = 0;
m_channel[i].end = 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];
if (ch.play)
{
int sample = m_intf.read_byte(ch.pos);
if (sample == 0x00) // check for sample end marker
if (ch.sample == 0x00) // check for sample end marker
ch.play = false;
else
{
sampleout = ch.mute ? 0 : (sample - 0x80) * (s32)ch.volume;
sampleout = ch.mute ? 0 : (ch.sample - 0x80) * (s32)ch.volume;
ch.counter--;
if (ch.counter <= ch.rate)
{
ch.pos++;
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].end = (m_regs[ch << 3 | 2] | m_regs[ch << 3 | 3] << 8) << 4;
m_channel[ch].counter = 0x100;
m_channel[ch].sample = m_intf.read_byte(m_channel[ch].pos);
}
else
m_channel[ch].play = false;

View file

@ -57,6 +57,7 @@ private:
struct channel_def
{
channel_def() :
sample(0),
rate(0),
pos(0),
counter(0),
@ -67,6 +68,7 @@ private:
{
}
int sample;
u32 rate;
u32 pos;
u32 counter;