emulation core related fix, reversed loop and volume
This commit is contained in:
parent
97d2bddf1f
commit
7fbd239b85
|
@ -217,7 +217,7 @@ void DivPlatformES5506::e(bool state)
|
|||
if ((irqv&0x80)==0) {
|
||||
unsigned char ch=irqv&0x1f;
|
||||
if (chan[ch].isReverseLoop) { // Reversed loop
|
||||
pageWriteMask(0x00|ch,0x5f,0x00,(chan[ch].pcm.reversed?0x0040:0x0000)|0x08,0x78);
|
||||
pageWriteMask(0x00|ch,0x5f,0x00,(chan[ch].pcm.reversed?0x0000:0x0040)|0x08,0x78);
|
||||
chan[ch].isReverseLoop=false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,8 +261,8 @@ void es5506_core::voice_t::tick(u8 voice)
|
|||
if (!m_mute)
|
||||
{
|
||||
// Send to output
|
||||
m_ch.m_left = volume_calc(sign_ext<s32>(m_filter.m_o4_1, 16), m_lvol);
|
||||
m_ch.m_right = volume_calc(sign_ext<s32>(m_filter.m_o4_1, 16), m_rvol);
|
||||
m_ch.m_left = volume_calc(m_lvol, sign_ext<s32>(m_filter.m_o4_1, 16));
|
||||
m_ch.m_right = volume_calc(m_rvol, sign_ext<s32>(m_filter.m_o4_1, 16));
|
||||
}
|
||||
|
||||
// ALU execute
|
||||
|
@ -307,7 +307,7 @@ s32 es5506_core::voice_t::volume_calc(u16 volume, s32 in)
|
|||
{
|
||||
u8 exponent = bitfield(volume, 12, 4);
|
||||
u8 mantissa = bitfield(volume, 4, 8);
|
||||
return (in * s32(0x100 | mantissa)) >> (20 - exponent);
|
||||
return (in * s32(0x100 | mantissa)) >> (19 - exponent);
|
||||
}
|
||||
|
||||
void es5506_core::reset()
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace es550x
|
|||
// std::clamp is only for C++17 or later; I use my own code
|
||||
template<typename T> T clamp(T in, T min, T max)
|
||||
{
|
||||
return (in > max) ? max : ((in < min) ? min : in);
|
||||
return (in < max) ? max : ((in > min) ? min : in);
|
||||
}
|
||||
|
||||
template<typename T, T InitWidth, u8 InitEdge = 0>
|
||||
|
|
|
@ -54,13 +54,13 @@ void es550x_shared_core::es550x_alu_t::loop_exec()
|
|||
m_accum = m_start + (m_start - m_accum);
|
||||
}
|
||||
else// Normal
|
||||
m_accum = (m_accum + m_start) - m_end;
|
||||
m_accum = m_end - (m_start - m_accum);
|
||||
}
|
||||
else if (m_cr.ble && m_transwave) // m_transwave
|
||||
{
|
||||
m_cr.lpe = m_cr.ble = 0;
|
||||
m_cr.lei = 1; // Loop end ignore
|
||||
m_accum = (m_accum + m_start) - m_end;
|
||||
m_accum = m_end - (m_start - m_accum);
|
||||
}
|
||||
else // Stop
|
||||
m_cr.stop0 = 1;
|
||||
|
@ -91,7 +91,7 @@ void es550x_shared_core::es550x_alu_t::loop_exec()
|
|||
s32 es550x_shared_core::es550x_alu_t::interpolation()
|
||||
{
|
||||
// SF = S1 + ACCfr * (S2 - S1)
|
||||
return m_sample[0] + ((bitfield(m_accum, std::min<u8>(0, m_fraction - 9), 9) * (m_sample[1] - m_sample[0])) >> 9);
|
||||
return m_sample[0] + ((bitfield<s32>(m_accum, std::min<u8>(0, m_fraction - 9), 9) * (m_sample[1] - m_sample[0])) >> 9);
|
||||
}
|
||||
|
||||
u32 es550x_shared_core::es550x_alu_t::get_accum_integer()
|
||||
|
|
Loading…
Reference in New Issue