[hatari-devel] Little crossbar.c patch

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


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 ?

regards

Laurent





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