[alsa-devel] snd_pcm_sw_params_set_xfer_align replacement?
snd_pcm_sw_params_set_xfer_align() has been deprecated but the docs don't mention what it was replaced with.
I don't ever want or need partial reads and writes -- my app would actually be happiest being completely synchronous to the hardware with fixed-size buffers. any suggestions how to get ALSA to do this?
Aaron J. Grier wrote:
snd_pcm_sw_params_set_xfer_align() has been deprecated but the docs don't mention what it was replaced with.
There is no replacement; the transfer alignment always is one frame, i.e., there is none.
I don't ever want or need partial reads and writes
You get partial reads/writes only when you ask for it (by using non- blocking mode) or when an error occurs.
HTH Clemens
On Mon, Jul 21, 2008 at 10:37:09AM +0200, Clemens Ladisch wrote:
Aaron J. Grier wrote:
snd_pcm_sw_params_set_xfer_align() has been deprecated but the docs don't mention what it was replaced with.
There is no replacement; the transfer alignment always is one frame, i.e., there is none.
would it be possible for a note to be added to the documentation explaining this?
I don't ever want or need partial reads and writes
You get partial reads/writes only when you ask for it (by using non- blocking mode) or when an error occurs.
I want non-blocking behavior (return immediately if there is no data available), but I don't want to have to deal with partial reads. I figured out a workaround using snd_pcm_avail_update(), but I'm wondering if there isn't a better way.
if I switched to using callbacks, how would I control the amount of data passed to the callbacks now that set_xfer_align() is gone?
Aaron J. Grier wrote:
On Mon, Jul 21, 2008 at 10:37:09AM +0200, Clemens Ladisch wrote:
You get partial reads/writes only when you ask for it (by using non- blocking mode) or when an error occurs.
I want non-blocking behavior (return immediately if there is no data available), but I don't want to have to deal with partial reads. I figured out a workaround using snd_pcm_avail_update(), but I'm wondering if there isn't a better way.
You could write your own read function that calls snd_pcm_read*() repeatedly until you have as much data as you want, but this is probably more complex than just checking for data before doing a blocking read.
Regards, Clemens
At Mon, 21 Jul 2008 11:31:35 -0700, Aaron J. Grier wrote:
On Mon, Jul 21, 2008 at 10:37:09AM +0200, Clemens Ladisch wrote:
Aaron J. Grier wrote:
snd_pcm_sw_params_set_xfer_align() has been deprecated but the docs don't mention what it was replaced with.
There is no replacement; the transfer alignment always is one frame, i.e., there is none.
would it be possible for a note to be added to the documentation explaining this?
Patch please :)
Note that the transfer alignment was really buggy, and didn't work at all like what you imagined from its name. This has nothing to do with the period size and wake-up setting.
Takashi
Signed-off-by: Aaron J. Grier agrier@poofygoof.com
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index ee2300e..a937b40 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -5694,6 +5694,17 @@ int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *v * \param params Software configuration container * \param val Chunk size (frames are attempted to be transferred in chunks) * \return 0 otherwise a negative error code + * + * "There is no replacement; the transfer alignment always is one + * frame[.]" -- Clemens Ladisch clemens@ladisch.de + * + * "Note that the transfer alignment was really buggy, and didn't work + * at all like what you imagined from its name." -- Takashi Iwai + * tiwai@suse.de + * + * If fixed-size transfers are required, use \ref snd_pcm_avail_update + * if to determine the number of frames available before reading or + * writing. */ #ifndef DOXYGEN int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t val ATTRIBUTE_UNUSED)
Signed-off-by: Aaron J. Grier agrier@poofygoof.com
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index a937b40..ada697a 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -5703,7 +5703,7 @@ int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *v * tiwai@suse.de * * If fixed-size transfers are required, use \ref snd_pcm_avail_update - * if to determine the number of frames available before reading or + * to determine the number of frames available before reading or * writing. */ #ifndef DOXYGEN
participants (3)
-
Aaron J. Grier
-
Clemens Ladisch
-
Takashi Iwai