From: Troy Kisky <troy.kisky@boundarydevices.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: Question about snd_dma_buffer bytes field
Date: Mon, 25 May 2009 14:15:44 -0700 [thread overview]
Message-ID: <4A1B0A80.3090600@boundarydevices.com> (raw)
In-Reply-To: <s5hmy91d9c9.wl%tiwai@suse.de>
Takashi Iwai wrote:
> At Sun, 24 May 2009 19:26:42 -0700,
> Troy Kisky wrote:
>> Does
>>
>> (substream->dma_buffer.bytes) need to equal (snd_pcm_lib_period_bytes(substream) * runtime->periods) ?
>>
>> When this is not true, it seems like the buffer is not being filled correctly.
>>
>>
>> for testing, this works
>> .buffer_bytes_max = 16 * 7 * 512,
>> .period_bytes_min = 32,
>> .period_bytes_max = 7 * 512, /* This is size of ping + pong buffer*/
>>
>> and this doesn't.
>> .buffer_bytes_max = 16 * 7 * 512 + 512,
>> .period_bytes_min = 32,
>> .period_bytes_max = 7 * 512, /* This is size of ping + pong buffer*/
>>
>>
>> When playing back a sine wave, I can hear breaks.
>
> Well, there are two misunderstandings here:
>
> - substream->dma_buffer.bytes doesn't define the actual buffer size.
> It's substream->runtime->buffer_size (in frames). The former is the
> allocated buffer size which can be larger.
>
> - The buffer size doesn't have to be aligned to period_size as default,
> i.e. it's not always equal with period_size * periods, and periods
> isn't always an integer.
>
> To align the buffer size to period size, call below in the open
> callback
> snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
>
>
> HTH,
>
> Takashi
>
Yes, that fixed my problem.
Thanks you
Troy
prev parent reply other threads:[~2009-05-25 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-25 2:26 Question about snd_dma_buffer bytes field Troy Kisky
2009-05-25 5:45 ` Takashi Iwai
2009-05-25 21:15 ` Troy Kisky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A1B0A80.3090600@boundarydevices.com \
--to=troy.kisky@boundarydevices.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox