mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
sound: fix ym2612 forgetting lfo state when dac is on
for less bad audio in OD2
This commit is contained in:
parent
8013663ec2
commit
ccc39358b0
1 changed files with 8 additions and 6 deletions
|
@ -892,7 +892,8 @@ typedef struct
|
|||
UINT16 vol_out2;
|
||||
UINT16 vol_out3;
|
||||
UINT16 vol_out4;
|
||||
UINT32 pad[2];
|
||||
UINT32 lfo_init_sft16;
|
||||
UINT32 pad;
|
||||
UINT32 phase1; /* 10 */
|
||||
UINT32 phase2;
|
||||
UINT32 phase3;
|
||||
|
@ -1225,18 +1226,18 @@ static chan_rend_context crct;
|
|||
static void chan_render_prep(void)
|
||||
{
|
||||
crct.eg_timer_add = ym2612.OPN.eg_timer_add;
|
||||
crct.lfo_init_sft16 = g_lfo_ampm << 16;
|
||||
crct.lfo_inc = ym2612.OPN.lfo_inc;
|
||||
}
|
||||
|
||||
static void chan_render_finish(s32 *buffer, unsigned short length, int active_chans)
|
||||
static void chan_render_finish(s32 *buffer, int length, int active_chans)
|
||||
{
|
||||
ym2612.OPN.eg_cnt = crct.eg_cnt;
|
||||
ym2612.OPN.eg_timer = crct.eg_timer;
|
||||
g_lfo_ampm = crct.pack >> 16; // need_save
|
||||
ym2612.OPN.lfo_cnt = crct.lfo_cnt;
|
||||
ym2612.OPN.lfo_cnt += ym2612.OPN.lfo_inc * length;
|
||||
}
|
||||
|
||||
static UINT32 update_lfo_phase(FM_SLOT *SLOT, UINT32 block_fnum)
|
||||
static UINT32 update_lfo_phase(const FM_SLOT *SLOT, UINT32 block_fnum)
|
||||
{
|
||||
UINT32 fnum_lfo;
|
||||
INT32 lfo_fn_table_index_offset;
|
||||
|
@ -1273,7 +1274,7 @@ static int chan_render(s32 *buffer, int length, int c, UINT32 flags) // flags: s
|
|||
|
||||
if (crct.lfo_inc) {
|
||||
flags |= 8;
|
||||
flags |= g_lfo_ampm << 16;
|
||||
flags |= crct.lfo_init_sft16;
|
||||
flags |= crct.CH->AMmasks << 8;
|
||||
if (crct.CH->ams == 8) // no ams
|
||||
flags &= ~0xf00;
|
||||
|
@ -1809,6 +1810,7 @@ int YM2612UpdateOne_(s32 *buffer, int length, int stereo, int is_buf_empty)
|
|||
if (ym2612.slot_mask & 0x00f000) active_chs |= chan_render(buffer, length, 3, flags|((pan&0x0c0)>>2)) << 3;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x0f0000) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x0f0000) active_chs |= chan_render(buffer, length, 4, flags|((pan&0x300)>>4)) << 4;
|
||||
g_lfo_ampm = crct.pack >> 16; // need_save; now because ch5 might skip updating it
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0xf00000) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0xf00000) active_chs |= chan_render(buffer, length, 5, flags|((pan&0xc00)>>6)|(!!ym2612.dacen<<2)) << 5;
|
||||
#undef BIT_IF
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue