nearest conv_rates matching
PATCH 1/1 nearest conv_rates matching
Hi all,
attached you can find a simple patch to match
"uncommon" rate in some USB speaker to the fixedconv_rates in usbaudio.c.
I had problem using ALSA with "Typhoon Desktop Mini USB Speakers" (0e6a:0310 Megawin Technology Co., Ltd).
mpg123 told me "No supported rate found!".
# cat /proc/asound/card1/stream0
USB Audio Device at usb-0000:00:1d.0-2.4, full speed :
USB Audio
Interface 2
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 2 OUT (ADAPTIVE)
Rates: 46875With this patch now I get:
USB Audio Device at usb-0000:00:1d.0-2.4, full speed :
USB Audio
Interface 2
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 2 OUT (ADAPTIVE)
Rates: 44100and mpg123 works JustFine(TM) :)
Hope you find it useful.
Best regards,
S. Effendi
_______________________________________________________________________________
Apakah Anda Yahoo!?
Kunjungi halaman depan Yahoo! Indonesia yang baru!
http://beta.id.yahoo.com/
sound/usb/usbaudio.c +19 -1
@@ -2394,17 +2394,35 @@ fp->nr_rates = nr_rates; fp->rate_min = fp->rate_max =combine_triple (&fmt[8 ]);for (r =0 , idx = offset +1 ; r < nr_rates; r++, idx +=3 ) { +unsigned int last_rate; +unsigned int rate_supported;unsigned int rate = fp->rate_table[r] =combine_triple (&fmt[idx]);if (rate < fp->rate_min) fp->rate_min = rate;else if (rate > fp->rate_max) fp->rate_max = rate; + rate_supported =0 ; + last_rate =0 ;for (c =0 ; c < (int )ARRAY_SIZE (conv_rates); c++) {if (rate == conv_rates[c]) { - fp->rates |= (1 << c); +/* conv_rate matched */ + rate_supported = (1 << c); +break ; + }else if (rate > conv_rates[c]) { +/* nearest conv_rate matched */ + rate_supported = (1 << c); + last_rate = conv_rates[c]; + }else {break ; } } + fp->rates |= rate_supported; +if (last_rate >0 ) { +if (fp->rate_min > last_rate) + fp->rate_min = last_rate;/* fix to nearest conv_rate matched */ +/* nearest supported conv_rate */ + fp->rate_table[r] = last_rate; + } } }else {/* continuous rates */
Quoted 5 lines · S. Effendi
Hi all,
attached you can find a simple patch to match
"uncommon" rate in some USB speaker to the fixedconv_ratesinusbaudio.c.
So it just plays the file off-speed? Or is the device reporting a wrong sample rate?
Lee
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642