<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src/aica</tt></b></td></tr>
<tr><td><tt><a href="#file1">audio.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+3</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-3</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">cf3900ae8acc -> a3984d242909</td></tr>
<tr class="alt" style=";" ><td><tt><a href="#file2">audio.h</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+1</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">cf3900ae8acc -> a3984d242909</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+4</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-3</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >2 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
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.
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/aica</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>audio.c</b></big> <small id="info" style="color: #888888;" >cf3900ae8acc -> a3984d242909</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/aica/audio.c
+++ lxdream/src/aica/audio.c
@@ -328,7 +328,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             switch( channel->sample_format ) {
             case AUDIO_FMT_16BIT:
                 for( j=0; j<num_samples; j++ ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-                    sample = ((int16_t *)(aica_main_ram + channel->start))[channel->posn];
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+                    sample = *(int16_t *)(aica_main_ram + ((channel->start + channel->posn*2)&AUDIO_MEM_MASK));
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                     result_buf[j][0] += sample * vol_left;
                     result_buf[j][1] += sample * vol_right;
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -352,7 +352,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                 break;
             case AUDIO_FMT_8BIT:
                 for( j=0; j<num_samples; j++ ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-                    sample = ((int8_t *)(aica_main_ram + channel->start))[channel->posn] << 8;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+                    sample = (*(int8_t *)(aica_main_ram + ((channel->start + channel->posn)&AUDIO_MEM_MASK))) << 8;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                     result_buf[j][0] += sample * vol_left;
                     result_buf[j][1] += sample * vol_right;
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -395,7 +395,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                                 break;
                             }
                         }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-                        uint8_t data = ((uint8_t *)(aica_main_ram + channel->start))[channel->posn>>1];
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+                        uint8_t data = *(uint8_t *)(aica_main_ram + ((channel->start + (channel->posn>>1))&AUDIO_MEM_MASK));
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                         if( channel->posn&1 ) {
                             adpcm_yamaha_decode_nibble( channel, (data >> 4) & 0x0F );
                         } else {
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/aica</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>audio.h</b></big> <small id="info" style="color: #888888;" >cf3900ae8acc -> a3984d242909</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/aica/audio.h
+++ lxdream/src/aica/audio.h
@@ -43,6 +43,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #define AUDIO_FMT_16ST (AUDIO_FMT_16BIT|AUDIO_FMT_STEREO)
 #define AUDIO_FMT_FLOATST (AUDIO_FMT_FLOAT|AUDIO_FMT_STEREO)
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define AUDIO_MEM_MASK 0x1FFFFF
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #define DEFAULT_SAMPLE_RATE 44100
 #define DEFAULT_SAMPLE_FORMAT AUDIO_FMT_16ST
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>