ZeldaHLE: really fix the constant pattern variable step computation.

This time tested by comparing pattern indexes across LLE and HLE with the same
inputs. Matches on the 3-4 test cases I made.
This commit is contained in:
Pierre Bourdon 2015-08-09 01:27:20 +02:00
parent fddb3f0d3c
commit c6c0f69c6b

View File

@ -1341,21 +1341,22 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
s16* pattern = m_const_patterns.data() + pattern_offset;
u32 pos = vpb->current_pos_frac << 6; // log2(PATTERN_SIZE)
u32 step = vpb->resampling_ratio << 5;
for (size_t i = 0; i < buffer->size(); ++i)
{
u32 step = vpb->resampling_ratio << 5;
if (pattern_info.variable_step)
step += (u32)((u16)m_buf_back_right[i] * vpb->resampling_ratio) >> 26;
(*buffer)[i] = pattern[pos >> 16];
pos = (pos + step) % (PATTERN_SIZE << 16);
if (pattern_info.variable_step)
pos = ((pos << 10) + m_buf_back_right[i] * vpb->resampling_ratio) >> 10;
}
vpb->current_pos_frac = pos >> 6;
break;
}
case VPB::SRC_PCM8_FROM_ARAM:
DownloadPCMSamplesFromARAM<s8>(raw_input_samples.data() + 4, vpb,
NeededRawSamplesCount(*vpb));