All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] buffersize and constraints on pmac
@ 2004-12-15 20:31 danny
  2004-12-15 21:23 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: danny @ 2004-12-15 20:31 UTC (permalink / raw)
  To: alsa-devel


Ok as promised a small patch to fix choppy sound when buffer/period size 
are set to certain values. I was only able to test this on 'Snapper', so I 
hope some people with other cards can verify that this helps (to reproduce 
the choppy sound you could try xmms (or bmp) with the alsaplugin and set 
period/buffer time to arbitrary values while playing a 32 kHz or 
lower mp3 or OGG file. 
Setting it both very low works best for testing).

----------



Buffersize is a bit small compared to the OSS driver (dmasound.h says 128kb is limit for Amiga, 
for pmac 256kb is used). At least on Snapper, some samplerates cause choppy sound when periods<3 
or buffersize is not a multiple of periodsize.

Signed-off-by: Danny Tholen <obiwan@mailmij.org>

--- linux-2.6.7/sound/ppc/pmac.c.old    2004-11-21 15:14:50.000000000 -0500
+++ linux-2.6.7/sound/ppc/pmac.c        2004-11-21 15:17:13.000000000 -0500
@@ -425,7 +425,7 @@
        .rate_max =             44100,
        .channels_min =         2,
        .channels_max =         2,
-       .buffer_bytes_max =     32768,
+       .buffer_bytes_max =     131072,
        .period_bytes_min =     256,
        .period_bytes_max =     16384,
        .periods_min =          1,
@@ -444,7 +444,7 @@
        .rate_max =             44100,
        .channels_min =         2,
        .channels_max =         2,
-       .buffer_bytes_max =     32768,
+       .buffer_bytes_max =     131072,
        .period_bytes_min =     256,
        .period_bytes_max =     16384,
        .periods_min =          1,
@@ -550,6 +550,9 @@
        if (chip->can_duplex)
                snd_pcm_set_sync(subs);

+       /* constraints to fix choppy sound */
+       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 3, UINT_MAX);
+       snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
        return 0;
 }





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: [PATCH] buffersize and constraints on pmac
  2004-12-15 20:31 [PATCH] buffersize and constraints on pmac danny
@ 2004-12-15 21:23 ` Takashi Iwai
  2004-12-15 21:40   ` danny
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2004-12-15 21:23 UTC (permalink / raw)
  To: danny; +Cc: alsa-devel

At Wed, 15 Dec 2004 21:31:30 +0100 (CET),
<danny@mailmij.org> wrote:
> 
> +       /* constraints to fix choppy sound */
> +       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 3, UINT_MAX);

This should be specified in snd_pmac_playback.periods_min and
snd_pmac_capture.periods_min statically.

Others look fine.  Could you regenerate the patch?


thanks,

Takashi


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: [PATCH] buffersize and constraints on pmac
  2004-12-15 21:23 ` Takashi Iwai
@ 2004-12-15 21:40   ` danny
  2004-12-15 21:50     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: danny @ 2004-12-15 21:40 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: danny, alsa-devel

On Wed, 15 Dec 2004, Takashi Iwai wrote:

> At Wed, 15 Dec 2004 21:31:30 +0100 (CET),
> <danny@mailmij.org> wrote:
> > 
> > +       /* constraints to fix choppy sound */
> > +       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 3, UINT_MAX);
> 
> This should be specified in snd_pmac_playback.periods_min and
> snd_pmac_capture.periods_min statically.
duh...ofcourse, sorries :)

> 
> Others look fine.  Could you regenerate the patch?
> 
here you are..I wondered btw, why PMAC_MAX_FRAGS is set to what it is (32) 
since for me higher values seem to work as well. But since it doesn't seem 
broken I didn't touch it:)

danny

------

Buffersize is a bit small compared to the OSS driver (dmasound.h says 128kb is limit for Amiga, for pmac 256kb is used)
At least on Snapper, some samplerates cause choppy sound when periods<3 or buffersize is not a multiple of periodsize.

Signed-off-by: Danny Tholen <obiwan@mailmij.org>

--- linux-2.6.7/sound/ppc/pmac.c.old    2004-12-15 22:30:47.085121008 +0100
+++ linux-2.6.7/sound/ppc/pmac.c        2004-12-15 22:34:28.284493592 +0100
@@ -425,10 +425,10 @@
        .rate_max =             44100,
        .channels_min =         2,
        .channels_max =         2,
-       .buffer_bytes_max =     32768,
+       .buffer_bytes_max =     131072,
        .period_bytes_min =     256,
        .period_bytes_max =     16384,
-       .periods_min =          1,
+       .periods_min =          3,
        .periods_max =          PMAC_MAX_FRAGS,
 };

@@ -444,10 +444,10 @@
        .rate_max =             44100,
        .channels_min =         2,
        .channels_max =         2,
-       .buffer_bytes_max =     32768,
+       .buffer_bytes_max =     131072,
        .period_bytes_min =     256,
        .period_bytes_max =     16384,
-       .periods_min =          1,
+       .periods_min =          3,
        .periods_max =          PMAC_MAX_FRAGS,
 };

@@ -550,6 +550,8 @@
        if (chip->can_duplex)
                snd_pcm_set_sync(subs);

+       /* constraints to fix choppy sound */
+       snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
        return 0;
 }






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: [PATCH] buffersize and constraints on pmac
  2004-12-15 21:40   ` danny
@ 2004-12-15 21:50     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2004-12-15 21:50 UTC (permalink / raw)
  To: danny; +Cc: alsa-devel

At Wed, 15 Dec 2004 22:40:03 +0100 (CET),
<danny@mailmij.org> wrote:
> 
> On Wed, 15 Dec 2004, Takashi Iwai wrote:
> 
> > At Wed, 15 Dec 2004 21:31:30 +0100 (CET),
> > <danny@mailmij.org> wrote:
> > > 
> > > +       /* constraints to fix choppy sound */
> > > +       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 3, UINT_MAX);
> > 
> > This should be specified in snd_pmac_playback.periods_min and
> > snd_pmac_capture.periods_min statically.
> duh...ofcourse, sorries :)
> 
> > 
> > Others look fine.  Could you regenerate the patch?
> > 
> here you are..I wondered btw, why PMAC_MAX_FRAGS is set to what it is (32) 
> since for me higher values seem to work as well. But since it doesn't seem 
> broken I didn't touch it:)

Yep, usually 32 periods are enough :)

I applied your patch now to CVS, but it was done manually because your
mailer broke the patch with tab/space conversion.  Please check the
CVS tree later whether I did correctly.


thanks,

Takashi


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

end of thread, other threads:[~2004-12-15 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-15 20:31 [PATCH] buffersize and constraints on pmac danny
2004-12-15 21:23 ` Takashi Iwai
2004-12-15 21:40   ` danny
2004-12-15 21:50     ` Takashi Iwai

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.