Re: [hatari-devel] Cracks in the sound (YM+DMA)

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 24/02/2013 08:33, David Savinkoff wrote:
Hi,

version 2 dmaSnd.c.saturation.2.diff patch enclosed

David


Hello

thanks for the patch, I will apply it later ; but I think it would be more efficient to do :

sample = DmaSnd_IIRfilterL( Subsonic_IIR_HPF_Left( MixBuffer[nBufIdx][0]))

if ( sample < -32767 )
  sample = -32767;
else if ( sample > 32767 )
  sample = 32767;

This remove the "< 0" test and "speed up" (very slightly :) ) the code.

Statistically, half of sample will be <0 or >0, but only a very small part will be <-32767 or >32767, so comparing only with these 2 values should be more efficient.

Nicolas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/