GA20: yet another optimization
This commit is contained in:
parent
c6bb7acfad
commit
cf89a4ff44
|
@ -95,8 +95,6 @@ void iremga20_device::sound_stream_update(short** outputs, int len)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
s32 sampleout = 0;
|
|
||||||
|
|
||||||
channel_def &ch = m_channel[j];
|
channel_def &ch = m_channel[j];
|
||||||
if (ch.play)
|
if (ch.play)
|
||||||
{
|
{
|
||||||
|
@ -104,17 +102,21 @@ void iremga20_device::sound_stream_update(short** outputs, int len)
|
||||||
ch.play = false;
|
ch.play = false;
|
||||||
else
|
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--;
|
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);
|
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:
|
case 5:
|
||||||
m_channel[ch].volume = (data * 256) / (data + 10);
|
m_channel[ch].volume = (data * 256) / (data + 10);
|
||||||
|
m_channel[ch].hot=true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
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].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);
|
m_channel[ch].sample = m_intf.read_byte(m_channel[ch].pos);
|
||||||
|
m_channel[ch].hot=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_channel[ch].play = false;
|
m_channel[ch].play = false;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
void write(u32 offset, u8 data);
|
void write(u32 offset, u8 data);
|
||||||
u8 read(u32 offset);
|
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) {
|
inline unsigned int get_position(const int ch) {
|
||||||
return m_channel[ch&3].pos;
|
return m_channel[ch&3].pos;
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,10 @@ private:
|
||||||
counter(0),
|
counter(0),
|
||||||
end(0),
|
end(0),
|
||||||
volume(0),
|
volume(0),
|
||||||
|
output(0),
|
||||||
play(0),
|
play(0),
|
||||||
mute(false)
|
mute(false),
|
||||||
|
hot(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +76,10 @@ private:
|
||||||
u32 counter;
|
u32 counter;
|
||||||
u32 end;
|
u32 end;
|
||||||
u32 volume;
|
u32 volume;
|
||||||
|
int output;
|
||||||
bool play;
|
bool play;
|
||||||
bool mute;
|
bool mute;
|
||||||
|
bool hot;
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 m_regs[0x20];
|
u8 m_regs[0x20];
|
||||||
|
|
Loading…
Reference in a new issue