Sync vgsound_emu with master

This commit is contained in:
cam900 2022-10-22 16:28:37 +09:00
parent f714acc8a6
commit f839b0771c
6 changed files with 57 additions and 32 deletions

View file

@ -2,6 +2,10 @@
## Important changes
### V 2.1.3 (2022-10-22)
Fix ES5504, ES5505, ES5506 per-voice preview functions
### V 2.1.2 (2022-10-21)
Split utilities and core framework header

View file

@ -11,8 +11,6 @@
// Internal functions
void es5504_core::tick()
{
m_voice_update = false;
m_voice_end = false;
// /CAS, E
if (m_clkin.falling_edge()) // falling edge triggers /CAS, E clock
{
@ -77,8 +75,6 @@ void es5504_core::tick()
// less cycle accurate, but less CPU heavy routine
void es5504_core::tick_perf()
{
m_voice_update = false;
m_voice_end = false;
// update
// falling edge
m_e.edge().set(false);
@ -121,6 +117,10 @@ void es5504_core::voice_tick()
m_voice_end = true;
m_voice_cycle = 0;
}
else
{
m_voice_end = false;
}
m_voice_fetch = 0;
}

View file

@ -11,8 +11,6 @@
// Internal functions
void es5505_core::tick()
{
m_voice_update = false;
m_voice_end = false;
// CLKIN
if (m_clkin.tick())
{
@ -149,8 +147,6 @@ void es5505_core::tick()
// less cycle accurate, but less CPU heavy routine
void es5505_core::tick_perf()
{
m_voice_update = false;
m_voice_end = false;
// output
for (int c = 0; c < 4; c++)
{
@ -207,6 +203,10 @@ void es5505_core::voice_tick()
elem.ch().reset();
}
}
else
{
m_voice_end = false;
}
m_voice_fetch = 0;
}
}
@ -230,8 +230,11 @@ void es5505_core::voice_t::tick(u8 voice)
if (m_alu.busy())
{
// Send to output
m_ch.set_left(volume_calc(m_lvol, sign_ext<s32>(m_filter.o4_1(), 16)));
m_ch.set_right(volume_calc(m_rvol, sign_ext<s32>(m_filter.o4_1(), 16)));
m_output[0] = volume_calc(m_lvol, sign_ext<s32>(m_filter.o4_1(), 16));
m_output[1] = volume_calc(m_rvol, sign_ext<s32>(m_filter.o4_1(), 16));
m_ch.set_left(m_output[0]);
m_ch.set_right(m_output[1]);
// ALU execute
if (m_alu.tick())

View file

@ -105,6 +105,8 @@ class es5505_core : public es550x_shared_core
, m_lvol(0)
, m_rvol(0)
, m_ch(output_t())
, m_mute(false)
, m_output{0}
{
}
@ -125,14 +127,23 @@ class es5505_core : public es550x_shared_core
output_t &ch() { return m_ch; }
// for debug/preview only
inline void set_mute(bool mute) { m_mute = mute; }
inline s32 left_out() { return m_mute ? 0 : m_output[0]; }
inline s32 right_out() { return m_mute ? 0 : m_output[1]; }
private:
s32 volume_calc(u8 volume, s32 in);
// registers
es5505_core &m_host;
u8 m_lvol = 0; // Left volume
u8 m_rvol = 0; // Right volume
output_t m_ch; // channel output
u8 m_lvol = 0; // Left volume
u8 m_rvol = 0; // Right volume
output_t m_ch; // channel output
bool m_mute = false; // mute flag (for debug purpose)
std::array<s32, 2> m_output; // output preview (for debug purpose)
};
class sermode_t : public vgsound_emu_core
@ -270,10 +281,12 @@ class es5505_core : public es550x_shared_core
return ret;
}
// per-voice outputs
inline s32 voice_lout(u8 voice) { return (voice < 32) ? m_voice[voice].ch().left() : 0; }
inline void set_mute(u8 ch, bool mute) { m_voice[ch & 0x1f].set_mute(mute); }
inline s32 voice_rout(u8 voice) { return (voice < 32) ? m_voice[voice].ch().right() : 0; }
// per-voice outputs
inline s32 voice_lout(u8 voice) { return (voice < 32) ? m_voice[voice].left_out() : 0; }
inline s32 voice_rout(u8 voice) { return (voice < 32) ? m_voice[voice].right_out() : 0; }
protected:
virtual inline u8 max_voices() override { return 32; }

View file

@ -11,8 +11,6 @@
// Internal functions
void es5506_core::tick()
{
m_voice_update = false;
m_voice_end = false;
// CLKIN
if (m_clkin.tick())
{
@ -192,8 +190,6 @@ void es5506_core::tick()
// less cycle accurate, but less CPU heavy routine
void es5506_core::tick_perf()
{
m_voice_update = false;
m_voice_end = false;
// output
if (((!m_mode.lrclk_en()) && (!m_mode.bclk_en()) && (!m_mode.wclk_en())) && (m_w_st < m_w_end))
{
@ -268,6 +264,10 @@ void es5506_core::voice_tick()
elem.ch().reset();
}
}
else
{
m_voice_end = false;
}
m_voice_fetch = 0;
}
}
@ -295,8 +295,11 @@ void es5506_core::voice_t::tick(u8 voice)
if (m_alu.busy())
{
// Send to output
m_ch.set_left(volume_calc(m_lvol, sign_ext<s32>(m_filter.o4_1(), 16)));
m_ch.set_right(volume_calc(m_rvol, sign_ext<s32>(m_filter.o4_1(), 16)));
m_output[0] = volume_calc(m_lvol, sign_ext<s32>(m_filter.o4_1(), 16));
m_output[1] = volume_calc(m_rvol, sign_ext<s32>(m_filter.o4_1(), 16));
m_ch.set_left(m_output[0]);
m_ch.set_right(m_output[1]);
// ALU execute
if (m_alu.tick())

View file

@ -147,6 +147,7 @@ class es5506_core : public es550x_shared_core
, m_filtcount(0)
, m_ch(output_t())
, m_mute(false)
, m_output{0}
{
}
@ -186,9 +187,9 @@ class es5506_core : public es550x_shared_core
// for debug/preview only
inline void set_mute(bool mute) { m_mute = mute; }
inline s32 left_out() { return m_mute ? 0 : m_ch.left(); }
inline s32 left_out() { return m_mute ? 0 : m_output[0]; }
inline s32 right_out() { return m_mute ? 0 : m_ch.right(); }
inline s32 right_out() { return m_mute ? 0 : m_output[1]; }
private:
// accessors, getters, setters
@ -202,14 +203,15 @@ class es5506_core : public es550x_shared_core
s32 m_lvol = 0; // Left volume
s32 m_rvol = 0; // Right volume
// Envelope
s32 m_lvramp = 0; // Left volume ramp
s32 m_rvramp = 0; // Righr volume ramp
s16 m_ecount = 0; // Envelope counter
filter_ramp_t m_k2ramp; // Filter coefficient 2 Ramp
filter_ramp_t m_k1ramp; // Filter coefficient 1 Ramp
u8 m_filtcount = 0; // Internal counter for slow mode
output_t m_ch; // channel output
bool m_mute = false; // mute flag (for debug purpose)
s32 m_lvramp = 0; // Left volume ramp
s32 m_rvramp = 0; // Righr volume ramp
s16 m_ecount = 0; // Envelope counter
filter_ramp_t m_k2ramp; // Filter coefficient 2 Ramp
filter_ramp_t m_k1ramp; // Filter coefficient 1 Ramp
u8 m_filtcount = 0; // Internal counter for slow mode
output_t m_ch; // channel output
bool m_mute = false; // mute flag (for debug purpose)
std::array<s32, 2> m_output; // output preview (for debug purpose)
};
// 5 bit mode