All of lore.kernel.org
 help / color / mirror / Atom feed
* period_size and relation to number of samples
@ 2007-09-06  5:52 Markus Korber
  2007-09-06 13:51 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Korber @ 2007-09-06  5:52 UTC (permalink / raw)
  To: alsa-devel

Hello,

one question: If my driver announces the setting below[1], how many
samples must an application provide in a single snd_pcm_writei() or
snd_pcm_mmap_writei() call?

Shouldn't it always send 8192 bytes or 2048 left and right samples (4096
in total) or is it free to send more or less?

Logging data in my chip_playback_copy() function shows the following
(S16_LE, RW_INTERLEAVED):

,----[ mplayer, aplay: ]
| chip_playback_copy (0 -> src: 0xffce1000, #bytes: 0x4000)
| chip_playback_copy (1 -> src: 0xffce1000, #bytes: 0x2000)
| chip_playback_copy (1 -> src: 0xffce1000, #bytes: 0x2000)
`----

,----[ alsaplayer: ]
| chip_playback_copy (0 -> src: 0xffce1000, #bytes: 0x2000)
| chip_playback_copy (0 -> src: 0xffce3000, #bytes: 0x2000)
| chip_playback_copy (0 -> src: 0xffce3000, #bytes: 0x2000)
| [...]
`----

Thus mplayer and aplay provide 16384 bytes (4096 l/r samples) in the
first call and 8192 bytes (2048 l/r samples) for all subsequent calls.
However, alsaplayer provides 8192 bytes (2048 l/r samples) for all
calls.

Now, what is an application allowed to send and what not?  For example,
could an application only send 1024 l/r samples and is the driver
responsible for buffering the data?  Or must it obey the announced
period_size and *always* provide 2048 l/r samples?

Thanks.

,----[ 1 ]
| stream       : PLAYBACK
| access       : RW_INTERLEAVED
| format       : S16_LE
| subformat    : STD
| channels     : 2
| rate         : 44100
| exact rate   : 44100 (44100/1)
| msbits       : 16
| buffer_size  : 4096
| period_size  : 2048
| period_time  : 46439
| tick_time    : 10000
| tstamp_mode  : NONE
| period_step  : 1
| sleep_min    : 0
| avail_min    : 2048
| xfer_align   : 1
| start_threshold  : 2048
| stop_threshold   : 4096
| silence_threshold: 0
| silence_size : 0
| boundary     : 1073741824
| start_mode: DATA
| xrun_mode: STOP
| tstamp_mode: NONE
| period_step: 1
| sleep_min: 0
| avail_min: 2048
| xfer_align: 1
| silence_threshold: 0
| silence_size: 0
| boundary: 1073741824
`----

Regards,
Markus Korber

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-09-10  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-06  5:52 period_size and relation to number of samples Markus Korber
2007-09-06 13:51 ` Takashi Iwai
2007-09-06 14:30   ` Markus Korber
2007-09-06 14:48     ` Takashi Iwai
2007-09-10  8:28       ` Markus Korber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.