mirror of
https://github.com/holub/mame
synced 2025-05-25 15:25:33 +03:00
Fixed DMADAC wrapping behavior. [Tim Schuerewegen]
This commit is contained in:
parent
e349350227
commit
a0375128a0
@ -83,14 +83,17 @@ static STREAM_UPDATE( dmadac_update )
|
|||||||
|
|
||||||
/* feed as much as we can */
|
/* feed as much as we can */
|
||||||
while (curout != curin && samples-- > 0)
|
while (curout != curin && samples-- > 0)
|
||||||
*output++ = (source[curout++ % BUFFER_SIZE] * volume) >> 8;
|
{
|
||||||
|
*output++ = (source[curout] * volume) >> 8;
|
||||||
|
curout = (curout + 1) % BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
/* fill the rest with silence */
|
/* fill the rest with silence */
|
||||||
while (samples-- > 0)
|
while (samples-- > 0)
|
||||||
*output++ = 0;
|
*output++ = 0;
|
||||||
|
|
||||||
/* save the new output pointer */
|
/* save the new output pointer */
|
||||||
ch->bufout = curout % BUFFER_SIZE;
|
ch->bufout = curout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +158,8 @@ void dmadac_transfer(const device_config **devlist, UINT8 num_channels, offs_t c
|
|||||||
/* copy the data */
|
/* copy the data */
|
||||||
for (j = 0; j < total_frames && curin != maxin; j++)
|
for (j = 0; j < total_frames && curin != maxin; j++)
|
||||||
{
|
{
|
||||||
ch->buffer[curin++ % BUFFER_SIZE] = *src;
|
ch->buffer[curin] = *src;
|
||||||
|
curin = (curin + 1) % BUFFER_SIZE;
|
||||||
src += frame_spacing;
|
src += frame_spacing;
|
||||||
}
|
}
|
||||||
ch->bufin = curin;
|
ch->bufin = curin;
|
||||||
|
Loading…
Reference in New Issue
Block a user