[alsa-devel] Getting pcm_usb_stream plugin to know its limits. [Kind of SOLVED]

Michaël Cadilhac michael at cadilhac.name
Thu Dec 31 05:57:46 CET 2009


michael at cadilhac.name (Michaël Cadilhac) writes:

> michael at cadilhac.name (Michaël Cadilhac) writes:
>
>> Next, Audacity stopped segfaulting but still didn't work: it couldn't
>> manage to configure the plugin properly.
>
> My second idea was to allow usb_stream to fix its own rate and
> period_size, as in:
>
> pcm.!usb_stream {
> 	type usb_stream
> 	period_size 128
> 	rate 44100
> 	card "1"
> }
>
> This would be great because it would prevent PortAudio from doing lots
> of test (which are pretty slow).  This is what I thought would work:
>
[...]
> +	unsigned rate_min = us->rate ? us->rate : 44100,
> +		rate_max = us->rate ? us->rate : 96000,
> +		period_size_min = us->period_size ? us->period_size : 128,
> +		period_size_max = us->period_size ? us->period_size : 64*4096;
[...]

Ah!  Sorry, I got mixed up between period_size and period_bytes (I'm new
to all that stuff).  Multiplying period_size by the frame_size (which is
hardcoded as 6) get it to work.

So, my final saying is the following patch.  It fixes the segfault on
stopping a non-started usb_stream, plus it adds the ability to set a
period size and sound rate.  The latter offers a workaround for the
second issue I came with (that the default values for period bytes, and
hence period size, were too high for us122l to work).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: all.patch
Type: text/x-patch
Size: 3528 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20091230/2bb6d34b/attachment.patch 
-------------- next part --------------

Again, happy new year to everyone.

-- 
Michaël `Micha' Cadilhac (LITQ, U. de Montréal) -- http://michael.cadilhac.name
	||     Emacs is GNU, Emacs is free
	||     For more information,
	||     Type C-h C-p


More information about the Alsa-devel mailing list