update counter after adding sample, not before

This commit is contained in:
Michaël Banaan Ananas 2011-08-14 13:40:02 +00:00
parent 3a4dc7ae8e
commit 26005610c0

View File

@ -133,24 +133,26 @@ static STREAM_UPDATE( flower_update_mono )
for (i = 0; i < samples; i++) for (i = 0; i < samples; i++)
{ {
voice->pos += f; // add sample
if (voice->oneshot) if (voice->oneshot)
{ {
if (voice->active) UINT8 sample = state->m_sample_rom[(voice->start + voice->pos) >> 7 & 0x7fff];
if (sample == 0xff)
{ {
UINT8 sample = state->m_sample_rom[(voice->start + voice->pos) >> 7 & 0x7fff]; voice->active = 0;
if (sample == 0xff) break;
voice->active = 0;
else
*mix++ += state->m_volume_rom[v << 8 | sample] - 0x80;
} }
else
*mix++ += state->m_volume_rom[v << 8 | sample] - 0x80;
} }
else else
{ {
UINT8 sample = state->m_sample_rom[(voice->start >> 7 & 0x7e00) | (voice->pos >> 7 & 0x1ff)]; UINT8 sample = state->m_sample_rom[(voice->start >> 7 & 0x7e00) | (voice->pos >> 7 & 0x1ff)];
*mix++ += state->m_volume_rom[v << 8 | sample] - 0x80; *mix++ += state->m_volume_rom[v << 8 | sample] - 0x80;
} }
// update counter
voice->pos += f;
} }
} }