Search
lxdream.org :: lxdream/src/aica/audio.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/audio.c
changeset 1089:a3984d242909
prev1024:c67f2d61ab97
next1296:30ecee61f811
author nkeynes
date Mon Dec 07 08:59:50 2009 +1000 (11 years ago)
permissions -rw-r--r--
last change Mask audio RAM accesses from the mixer to ensure they're in bounds. Uncertain if
this is correct (vs eg zero-fill), but it's at least consistent with the masking
of the channel start position.
file annotate diff log raw
1.1 --- a/src/aica/audio.c Sat Jun 13 00:50:48 2009 +0000
1.2 +++ b/src/aica/audio.c Mon Dec 07 08:59:50 2009 +1000
1.3 @@ -328,7 +328,7 @@
1.4 switch( channel->sample_format ) {
1.5 case AUDIO_FMT_16BIT:
1.6 for( j=0; j<num_samples; j++ ) {
1.7 - sample = ((int16_t *)(aica_main_ram + channel->start))[channel->posn];
1.8 + sample = *(int16_t *)(aica_main_ram + ((channel->start + channel->posn*2)&AUDIO_MEM_MASK));
1.9 result_buf[j][0] += sample * vol_left;
1.10 result_buf[j][1] += sample * vol_right;
1.11
1.12 @@ -352,7 +352,7 @@
1.13 break;
1.14 case AUDIO_FMT_8BIT:
1.15 for( j=0; j<num_samples; j++ ) {
1.16 - sample = ((int8_t *)(aica_main_ram + channel->start))[channel->posn] << 8;
1.17 + sample = (*(int8_t *)(aica_main_ram + ((channel->start + channel->posn)&AUDIO_MEM_MASK))) << 8;
1.18 result_buf[j][0] += sample * vol_left;
1.19 result_buf[j][1] += sample * vol_right;
1.20
1.21 @@ -395,7 +395,7 @@
1.22 break;
1.23 }
1.24 }
1.25 - uint8_t data = ((uint8_t *)(aica_main_ram + channel->start))[channel->posn>>1];
1.26 + uint8_t data = *(uint8_t *)(aica_main_ram + ((channel->start + (channel->posn>>1))&AUDIO_MEM_MASK));
1.27 if( channel->posn&1 ) {
1.28 adpcm_yamaha_decode_nibble( channel, (data >> 4) & 0x0F );
1.29 } else {
.