Re: [hatari-devel] Little crossbar.c patch

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


Le 20/10/2020 à 19:21, Laurent Sallafranque a écrit :
Hi,

I suggest a little patch for crossbar.c (if it's not too late).

It's just about modifiing one line of code ;)


By the time, Nicolas did improve the Falcon sound a lot by changing this :

     dac.writePosition = 0;

by

    dac.writePosition = (dac.readPosition+DACBUFFER_SIZE/2)%DACBUFFER_SIZE;


Like this, the read and the write pointers are in opposite distance and never overlap (this avoid some sound glitches).


I think the same patch could be applied to the crossbar input sound (microphone input) to improve it :

     adc.writePosition = 0;

could become

    adc.writePosition = (adc.readPosition+DACBUFFER_SIZE/2)%DACBUFFER_SIZE;


Like this, the microphone input sound would never overlap too.


     /* DAC inits */
     memset(dac.buffer_left, 0, sizeof(dac.buffer_left));
     memset(dac.buffer_right, 0, sizeof(dac.buffer_right));
     dac.readPosition_float = 0;
     dac.readPosition = 0;
    dac.writePosition = (dac.readPosition+DACBUFFER_SIZE/2)%DACBUFFER_SIZE;

     /* ADC inits */
     memset(adc.buffer_left, 0, sizeof(adc.buffer_left));
     memset(adc.buffer_right, 0, sizeof(adc.buffer_right));
     adc.readPosition_float = 0;
     adc.readPosition = 0;
    adc.writePosition = (adc.readPosition+DACBUFFER_SIZE/2)%DACBUFFER_SIZE;   // This line


Do you agree ?

Hi

this should be fine, else there's a risk of an overlap too. You can commit the patch if you like.




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