diff options
author | 2009-12-09 15:40:16 +0000 | |
---|---|---|
committer | 2009-12-09 15:40:16 +0000 | |
commit | a0375128a0874978fb400d52f06e2892ce1dc40f (patch) | |
tree | 4f27d96fd9edb73226286eadc45ae723ae880a5e /src/emu | |
parent | e349350227210df49e168d29d1b7e32044ec6af1 (diff) |
Fixed DMADAC wrapping behavior. [Tim Schuerewegen]
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/sound/dmadac.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/emu/sound/dmadac.c b/src/emu/sound/dmadac.c index 9367be43f80..5209961d0da 100644 --- a/src/emu/sound/dmadac.c +++ b/src/emu/sound/dmadac.c @@ -83,14 +83,17 @@ static STREAM_UPDATE( dmadac_update ) /* feed as much as we can */ 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 */ while (samples-- > 0) *output++ = 0; /* 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 */ 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; } ch->bufin = curin; |