michael@cadilhac.name (Michaël Cadilhac) writes:
michael@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).
Again, happy new year to everyone.