[alsa-devel] Questions about virtual ALSA driver (dummy), PortAudio and full-duplex drops

Clemens Ladisch clemens at ladisch.de
Thu Jul 25 10:37:25 CEST 2013


Smilen Dimitrov wrote:
>> [...] and you are not correctly
>> reporting the number of samples transferred to the hardware?
>
> I agree that it must be the core of the problem - but I have problem
> understanding why, given I currently perceive that I'm doing
> everything right: I know I have a rate of 44100 frames per second; I
> choose either a period for timer functions, and calculate bytes per
> period to match the rate, or vice versa; and in each period, I
> increase stream buffer positions for that bytes per period amount
> (taking care of buffer wrapping).

Your driver's .pointer callback must report the *actual* position at
which the hardware has finished reading from the buffer.  You *must*
read some hardware register of your DMA controller for this.  It is not
possible to deduce this from the current time because the clocks do not
run at the same speed, and any kind of buffering will introduce more
errors.

The dummy driver uses a timer because there is no actual hardware.


Regards,
Clemens


More information about the Alsa-devel mailing list