NDS: prepare for optimization
This commit is contained in:
parent
ab1759f09b
commit
d8f66523b6
|
@ -54,6 +54,15 @@ namespace nds_sound_emu
|
||||||
m_routput = 0;
|
m_routput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 nds_sound_t::predict() {
|
||||||
|
s32 ret=INT32_MAX;
|
||||||
|
for (u8 i = 0; i < 16; i++) {
|
||||||
|
const s32 next=m_channel[i].predict();
|
||||||
|
if (next<ret) ret=next;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void nds_sound_t::tick(s32 cycle)
|
void nds_sound_t::tick(s32 cycle)
|
||||||
{
|
{
|
||||||
m_loutput = m_routput = (m_bias & 0x3ff);
|
m_loutput = m_routput = (m_bias & 0x3ff);
|
||||||
|
@ -328,6 +337,11 @@ namespace nds_sound_emu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 nds_sound_t::channel_t::predict() {
|
||||||
|
if (!m_playing) return INT32_MAX;
|
||||||
|
return m_counter-m_freq;
|
||||||
|
}
|
||||||
|
|
||||||
void nds_sound_t::channel_t::fetch()
|
void nds_sound_t::channel_t::fetch()
|
||||||
{
|
{
|
||||||
if (m_playing)
|
if (m_playing)
|
||||||
|
|
|
@ -121,6 +121,7 @@ namespace nds_sound_emu
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void tick(s32 cycle);
|
void tick(s32 cycle);
|
||||||
|
s32 predict();
|
||||||
|
|
||||||
// host accesses
|
// host accesses
|
||||||
u32 read32(u32 addr);
|
u32 read32(u32 addr);
|
||||||
|
@ -205,6 +206,7 @@ namespace nds_sound_emu
|
||||||
void write(u32 offset, u32 data, u32 mask = ~0);
|
void write(u32 offset, u32 data, u32 mask = ~0);
|
||||||
|
|
||||||
void update(s32 cycle);
|
void update(s32 cycle);
|
||||||
|
s32 predict();
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
// control word
|
// control word
|
||||||
|
|
Loading…
Reference in a new issue