Re: [hatari-devel] STe DMA sound -> new downsampling method

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


Le 05/10/2019 à 11:05, Nicolas Pomarède a écrit :

But if I crosscompile the windows version under linux using mingw then I can hear the same issue. So it seems to be a compiler issue, maybe it doesn't handle correctly the 64 bit integer type used in this code to add extra precision.
I will look into this.

In the meantime, you can run it from linux and sound should be OK :)

Nicolas



Fix is available in latest git.

the problem was with :

interval_fract = ( YM_ATARI_CLOCK_COUNTER * 0x10000L ) / YM_REPLAY_FREQ;

YM_ATARI_CLOCK_COUNTER is in fact MachineClocks.YM_Freq and YM_REPLAY_FREQ is nAudioFrequency. Noth are 32 bit integer.

On my 64 bit linux, the correct value of interval_fract is 0x5af18 because 0x10000L is defaulting to 64 bit. But with mingw/cygwin for example, 0x1000L is 32 bit and the operation gets truncated after the multiplication, yelding a wrong value of interval_fract=0x139c9 :(

Hence the bug, since interval_fract is used to compute the correct average by simulating 16 bit fractional precision.

Using 0x10000LL to explicitely cast to 64 bits is fixing the problem under mingw. do you confirm ?

Nicolas

PS : you can now remove the youtube video, no need to keep trace of hatari's bug :)



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