All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Guilhem Tardy <guilhem_tardy@yahoo.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: playback audio overwritten before it is sent to the card
Date: Tue, 30 Jul 2002 17:03:21 +0200	[thread overview]
Message-ID: <s5hvg6x8dhi.wl@alsa2.suse.de> (raw)
In-Reply-To: <20020726205101.32789.qmail@web11502.mail.yahoo.com>

At Fri, 26 Jul 2002 13:51:01 -0700 (PDT),
Guilhem Tardy wrote:
> 
> 
> I am getting to know all the internals (although I didn't really want to)...
> the ops->pointer() is called only from snd_pcm_update_hw_ptr(), which updates
> the runtime->status->hw_ptr. But it doesn't:
> 
>   playback_copy() on sound dev0,  hwoff:0  pos:0 ->160
> 
>   playback_pointer() on sound dev0,  last:160  pos:160
>      ptr:160  {hw:0, appl:160}
>      hw_ptr_base:0  min_align:1  avail_min:160  avail_max:0
> 
> So far, so good. In snd_pcm_update_hw_ptr(), new_hw_ptr = runtime->hw_ptr_base
> + pos = 160, so the next time around it should read "hw:160"...
> 
>   playback_prepare() on sound dev0,  bsize:320  boundary:1342177280
> 
> Is it normal that boundary is so high?

the boundary is not the buffer size (although it's aligned to the
buffer size).
it's the maximal size of the buffer pointer which is countable by an
(long) integer.  the buffer pointer will be rewound to zero after it
reaches this value.


> 
>   playback_copy() on sound dev0,  hwoff:0  pos:160 ->320
> 
>   playback_pointer() on sound dev0,  last:160  pos:320  ptr:160
>      {hw:0, appl:160}
>      hw_ptr_base:0  min_align:1  avail_min:160  avail_max:320
> 
> Ouch! "hw:0"... Why didn't change? And runtime->control->appl_ptr hasn't
> changed either?

because the prepare() was called before this operation.

> 
>   playback_copy() on sound dev0,  hwoff:160  pos:0 ->160
> 
> Keep copying to the buffer in runtime->dma_area...
> 
>   playback_prepare() on sound dev0,  bsize:320  boundary:1342177280
>   playback_copy() on sound dev0,  hwoff:0  pos:160 ->320
> 
> Ouch! This one hasn't been sent to the card yet.
 
again prepare() was called.  hence, the hwoff was rewound.

but i don't know what happens here:  why prepare() is called.
does your application calls snd_pcm_prepare() so often?

basically, prepare callback is called only from snd_pcm_prepare() in
pcm_native.c, i.e. only via ioctl.  (or, in the case of OSS emulation,
via snd_pcm_oss_prepare(), which can be called multiple times at each
change of configuration).


ciao,

Takashi


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

  reply	other threads:[~2002-07-30 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-26 15:28 playback audio overwritten before it is sent to the card Guilhem Tardy
2002-07-26 20:51 ` Guilhem Tardy
2002-07-30 15:03   ` Takashi Iwai [this message]
     [not found]     ` <20020730151916.59073.qmail@web11508.mail.yahoo.com>
2002-07-30 15:39       ` Takashi Iwai
2002-07-30 19:07     ` success (WAS: playback audio overwritten before it is sent to the card) Guilhem Tardy
2002-08-16 22:12     ` PCM ioctls Guilhem Tardy
2002-08-17 11:59       ` Paul Davis
2002-08-16 22:47     ` ADPCM 16kbps and other formats Guilhem Tardy

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=s5hvg6x8dhi.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=guilhem_tardy@yahoo.com \
    /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 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.