All of lore.kernel.org
 help / color / mirror / Atom feed
* Click after draining
@ 2004-09-21 20:13 Giuliano Pochini
  2004-10-07 18:58 ` Giuliano Pochini
  0 siblings, 1 reply; 19+ messages in thread
From: Giuliano Pochini @ 2004-09-21 20:13 UTC (permalink / raw)
  To: Alsa-devel


With both the powermac driver and my echoaudio driver, playback ends with a
"click". With properly choosen buffer/period/file sizes I can make the card
play almost a whole period of old data before the substream is actually
stopped. It seems that periods after the last one are not silenced, but I'm
not having luck at findind the cause. This is not a recent problem.

For example, I made a test sound that is a pure tone with a quick fade to
silence at the end:
-rw-rw-r--    1 Giu      Giu        606884 set 19 18:56 t2.wav

I played it with: "aplay -B1486077 -F600000 -v t2.wav" because it's slow
enough I can follow debug messages on the screen. I got this trace from the
irq handler (printed just before calling snd_pcm_period_elapsed()):

pcm_trigger start
irq per=1 state=3 bytes=105984, t=1095614506322223
irq per=2 state=3 bytes=211840, t=1095614506921131
irq per=0 state=3 bytes=262272, t=1095614507206088
irq per=1 state=3 bytes=368128, t=1095614507804997
irq per=2 state=3 bytes=473984, t=1095614508403906
irq per=0 state=5 bytes=524416, t=1095614508688863
irq per=1 state=5 bytes=630272, t=1095614509287772 ***
irq per=2 state=5 bytes=736128, t=1095614509886681
pcm_trigger stop

per is the period, state is the runtime state (3=running, 5=draining), bytes
are the number of bytes the DSP read from memory, t is the time_t in useconds.

The line marked with "***" is the period that should be silent (it's past
the end of the file) but still contains old data. Also I don't understand
why it didn't stop the card at that point.

I also looked for this problem on a PC with an intel8x0 chip, but it worked
fine. Any hint to debug this issue is VERY welcome because I'm stuck. 



--
Giuliano.


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Click after draining
@ 2007-01-05 22:48 Andrew Johnson
  0 siblings, 0 replies; 19+ messages in thread
From: Andrew Johnson @ 2007-01-05 22:48 UTC (permalink / raw)
  To: alsa-devel

Hi All,

This bug
(http://thread.gmane.org/gmane.linux.alsa.devel/14700/focus=14700)
appears to exist for the pxa2xx-pcm driver on a PXA270 platform.  

- It appears that Takashi's patch isn't included in the ALSA Drivers as
of 2.6.16 - is there any reason why?
- Takashi commented in the thread that the period sizes must all be the
same.  Is this still true?  If the sizes are not the same (as in the
pxa2xx-pcm driver), could this cause this problem?

I've done some analysis by toggling a GPIO when a period ends.  The
result is (N indicates sound, the two N's at the end indicate unwanted
sound which appears to come from earlier in the circular buffer):

     |-------------------|-------------------|-------------------|
     NNNN                                   NN
                  ^                          ^
End of audio data |                          | SNDRV_PCM_TRIGGER_STOP


So the IRQ is occurring but the ALSA core is not turning off the DMA
until the next IRQ.  I've experimented with setting 

	runtime->stop_threshold = runtime->buffer_size -
runtime->period_size;

And this works but ends up cutting other .wav files short.  I have found
that setting 

	runtime->silence_size = runtime->period_size * 2;
	runtime->silence_threshold = runtime->period_size * 2;

causes this problem to go away however this causes issues when playing
multiple sound files back to back.

Any help on this would be much appreciated!

Kind Regards,

Andrew

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

end of thread, other threads:[~2007-01-05 22:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21 20:13 Click after draining Giuliano Pochini
2004-10-07 18:58 ` Giuliano Pochini
2004-10-08 15:34   ` Takashi Iwai
2004-10-08 16:07     ` Takashi Iwai
2004-10-08 20:26       ` Giuliano Pochini
2004-10-16 19:31       ` Giuliano Pochini
2004-10-18 11:14         ` Takashi Iwai
2004-10-18 14:56           ` Giuliano Pochini
2004-10-18 15:10             ` Takashi Iwai
2004-10-18 15:34               ` Giuliano Pochini
2004-10-19 11:03                 ` Takashi Iwai
2004-10-19 15:09                   ` Giuliano Pochini
2004-10-19 15:39                     ` Takashi Iwai
2004-10-20  8:35                       ` Giuliano Pochini
2004-10-20  9:38                         ` Takashi Iwai
2004-11-01 19:29           ` Giuliano Pochini
2004-11-09  9:29             ` Takashi Iwai
2004-11-09 10:00               ` Giuliano Pochini
  -- strict thread matches above, loose matches on Subject: below --
2007-01-05 22:48 Andrew Johnson

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.