[hatari-devel] Slow sound buffer
David Savinkoff
dsavnkff at telus.net
Wed Jan 19 01:18:52 CET 2011
On Jan 18, 2011, Nicolas Pomarède <npomarede at corp.free.fr> wrote:
Le 18/01/2011 23:20, David Savinkoff a écrit :
> Hi,
>
> Main_WaitOnVbl() waits on each emulated VBL to synchronize the real
> time with the emulated ST. This now has less rounding error but
> probably doesn't make a difference unless it is taken advantage of.
>
> Your question about dma sound raised some issues with:
> #define SAMPLES_PER_FRAME ((nAudioFrequency+35)/nScreenRefreshRate)
> Furthermore, I changed it (in sound.c) to:
> #define...((nAudioFrequency + d_nAudioFrequency)/nScreenRefreshRate)
> I have to use a different variable to do the frequency offset.
>
> It looks like nAudioFrequency+35 is meant to give more samples per
> frame at lower sample frequencies, but doing this will mess with
> FreqRatio in dmaSnd.c
>
> David
OK, that's what I thought. Also, can you tell more about the /86 and
/-86 you use ? What is the origin of this value of 86 ?
Nicolas
**************************************************
Hi,
I just tested (more thoroughly) a new patch without frequency
offsetting, and with (nAudioFrequency+35) replaced with
(nAudioFrequency). This improvement is enough for me to
believe (nAudioFrequency+35) 'is' the problem.
(nAudioFrequency/86 + nAudioFrequency) increases the sample rate
by 20/100 of a semitone, or 20 cents, or 1.16%
The synchronization is so good now, that 10 cents would be better;
or maybe we can just 'slip in' or 'swallow' a sample once in a while
to keep the buffer centered. If the buffer gets grossly offset, maybe
it can be reset.
More that could be cleaned in sound.c:
./src/sound.c:#define SAMPLES_PER_FRAME ((nAudioFrequency+35)/nScreenRefreshRate)
./src/sound.c: int SamplePerVbl = nAudioFrequency / nScreenRefreshRate;
To:
/src/sound.c:#define SAMPLES_PER_FRAME (nAudioFrequency/nScreenRefreshRate)
/src/sound.c: int SamplePerVbl = ...Removed?...
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hatari.sound.sync.new.patch
Type: application/octet-stream
Size: 4652 bytes
Desc: not available
URL: <https://lists.berlios.de/pipermail/hatari-devel/attachments/20110118/867257bd/attachment.obj>
More information about the hatari-devel
mailing list