From AlsaProject
Revision as of 01:05, 7 August 2007 by EliotBlennerhassett (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1. The buffer and period sizes for the sound card between the sound card hardware and the ALSA resampler are limited to the max buffer and period sizes available on the hardware. As a result, the available buffer and period sizes vary depending on hardware utilised.

2. The resampler converts one hardware period size at a time. This results in the buffer and period size constraints explained in (1) arriving at the application as a direct ratio of source and destination sample rate. e.g. hardware has 2 periods of 1024 frames running at 48000 Hz. application will see 2 periods of 1024 * 44100 / 48000 = 940.8. This is rounded down to 940 frames. So the user application sees 2 periods of 940 frames. If user space asks for 2 periods of 1024 at 44100 hz it will fail.

3. The alsa-lib software resampler is only used if (possible hardware sample rates != requested sample rate)

4. It is possible to detect if the resampler will be used at the requested sampling rate. While opening the ALSA device, use the function:

#if SND_LIB_VERSION >= 0x010009
/* Restrict a configuration space to contain only real hardware rates */
err = snd_pcm_hw_params_set_rate_resample(this->audio_fd, params, 0);

This will result in the application only being able to open the sound card at the sample rates that the sound card can do in hardware. So, taking rule (3) above, the alsa-lib software resampler will therefore never be used.

Original created on 2006-09-24 by User:JamesCourtierDutton

Custom Search
Personal tools