GA20: yet another optimization

This commit is contained in:
tildearrow 2025-02-20 04:44:19 -05:00
parent c6bb7acfad
commit cf89a4ff44
2 changed files with 14 additions and 6 deletions

View file

@ -95,8 +95,6 @@ void iremga20_device::sound_stream_update(short** outputs, int len)
{
for (int j = 0; j < 4; j++)
{
s32 sampleout = 0;
channel_def &ch = m_channel[j];
if (ch.play)
{
@ -104,17 +102,21 @@ void iremga20_device::sound_stream_update(short** outputs, int len)
ch.play = false;
else
{
sampleout = ch.mute ? 0 : (ch.sample - 0x80) * (s32)ch.volume;
if (ch.hot) {
ch.hot=false;
ch.output = 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);
ch.hot=true;
}
}
}
outputs[j][i] = sampleout;
outputs[j][i] = ch.output;
}
}
}
@ -141,6 +143,7 @@ void iremga20_device::write(u32 offset, u8 data)
case 5:
m_channel[ch].volume = (data * 256) / (data + 10);
m_channel[ch].hot=true;
break;
case 6:
@ -152,6 +155,7 @@ void iremga20_device::write(u32 offset, u8 data)
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);
m_channel[ch].hot=true;
}
else
m_channel[ch].play = false;

View file

@ -38,7 +38,7 @@ public:
void write(u32 offset, u8 data);
u8 read(u32 offset);
inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; }
inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; m_channel[ch & 3].hot = true; }
inline unsigned int get_position(const int ch) {
return m_channel[ch&3].pos;
}
@ -63,8 +63,10 @@ private:
counter(0),
end(0),
volume(0),
output(0),
play(0),
mute(false)
mute(false),
hot(false)
{
}
@ -74,8 +76,10 @@ private:
u32 counter;
u32 end;
u32 volume;
int output;
bool play;
bool mute;
bool hot;
};
u8 m_regs[0x20];