ES5506: more optimization

This commit is contained in:
tildearrow 2023-02-06 03:44:03 -05:00
parent bf0f424cca
commit c4121ccfd6
4 changed files with 6 additions and 12 deletions

View File

@ -314,9 +314,9 @@ class es5506_core : public es550x_shared_core
inline bool bclk_falling_edge() { return m_bclk.falling_edge(); }
// 6 stereo output channels
inline s32 lout(u8 ch) { return m_output[std::min<u8>(5, ch & 0x7)].left(); }
inline s32 lout(u8 ch) { return m_output[ch&7].left(); }
inline s32 rout(u8 ch) { return m_output[std::min<u8>(5, ch & 0x7)].right(); }
inline s32 rout(u8 ch) { return m_output[ch&7].right(); }
//-----------------------------------------------------------------
//
@ -374,7 +374,7 @@ class es5506_core : public es550x_shared_core
bool m_wclk_lr = false; // WCLK, L/R output select
s8 m_output_bit = 0; // Bit position in output
output_t m_ch[6]; // 6 stereo output channels
output_t m_output[6]; // Serial outputs
output_t m_output[8]; // Serial outputs
output_t m_output_temp[6]; // temporary signal for serial output
output_t m_output_latch[6]; // output latch
};

View File

@ -160,6 +160,7 @@ class es550x_shared_core : public vgsound_emu_core
: vgsound_emu_core("es550x_voice_alu")
, m_integer(integer)
, m_fraction(fraction)
, m_fraction_m9(std::max<s8>(0, m_fraction - 9))
, m_total_bits(integer + fraction)
, m_accum_mask(
u32(std::min<u64>(~0, u64(u64(1) << u64(integer + fraction)) - 1)))
@ -175,6 +176,7 @@ class es550x_shared_core : public vgsound_emu_core
// configurations
const u8 m_integer = 21;
const u8 m_fraction = 11;
const u8 m_fraction_m9 = 2;
const u8 m_total_bits = 32;
const u32 m_accum_mask = 0xffffffff;
const bool m_transwave = true;

View File

@ -101,7 +101,7 @@ void es550x_shared_core::es550x_voice_t::es550x_alu_t::loop_exec()
s32 es550x_shared_core::es550x_voice_t::es550x_alu_t::interpolation()
{
// SF = S1 + ACCfr * (S2 - S1)
return m_sample[0] + ((bitfield<s32>(m_accum, std::max<s8>(0, m_fraction - 9), 9) *
return m_sample[0] + ((bitfield<s32>(m_accum, m_fraction_m9, 9) *
(m_sample[1] - m_sample[0])) >>
9);
}

View File

@ -170,14 +170,6 @@ void DivPlatformES5506::acquire(short** buf, size_t len) {
}
void DivPlatformES5506::e_pin(bool state) {
/*
if (es5506.e_falling_edge()) { // get channel outputs
if (es5506.voice_update()) {
const signed int lOut=es5506.voice_lout(prevChanCycle);
const signed int rOut=es5506.voice_rout(prevChanCycle);
chan[prevChanCycle].oscOut=CLAMP((lOut+rOut)>>5,-32768,32767);
}
}*/
if (state) { // host interface
if (cycle) { // wait until delay
cycle--;