From 5baa9289cfe2d81e0888aaa6e6b7ba3e2616e2f0 Mon Sep 17 00:00:00 2001 From: Baozhu Zuo Date: Mon, 18 Sep 2017 09:40:50 +0800 Subject: [PATCH] ac108_plugin version 1: only support channel=4 --- ac108_plugin/libasound_module_pcm_ac108.so | Bin 32624 -> 32668 bytes ac108_plugin/pcm_ac108.c | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ac108_plugin/libasound_module_pcm_ac108.so b/ac108_plugin/libasound_module_pcm_ac108.so index a1ee3b387b886f1c73163e29b4128bca21c2a3a2..68ee4847015ae9a25e4d5e6fdab956a3dba9676e 100755 GIT binary patch delta 3690 zcmZWs4Nz3q6+ZX9x3W)n;jI#Zuq(^L0xHO2M5!2mF$009L}zpiGfD)}&Z7Lp zSn)(HSbnV1@BvqXGO^uGbQkXY_+EiHNg(tvqD1fuz`MYA4FzT+x&v7{_(enI-Xu@h z=H4o1yRSTR-A%*#O49fBDefKD3}5+mmEOFm(&n2JqB19BagfD9=BCs>cfr0s)wkoC z;tuta5$Zi9gPx?venxbQQTD)y0P+XfpFX0HrJ66)t3j$jTK?Um+g8N1`cnId=J#5O z-e(<-qe4f8PAmJA^E{e^5m5+#KrBEenbA-pGnz6n)cX<;4M;AK)QEmDyg)hx(sbGB zNg8?_HE740kRZSGyj~EG6bz(bz>0T$BSU;H zJMq3Md+`2?v}9(8E;%|gRZN$&Gncs9U`M`C4{xc6=<$m`u^%GOW)@pkr-gbOr0|xz za>qwXNWM4vVAJdNM9S|RzOTA$a4gx)J@bJnBsqmGZJT!`Tuoe#~-vv`JeX z`}(9UD@XiX7G~9n7P%)Y$#wXLN4JyVBsp4Xjp(jFW%QDi4f8m|TRg#-AwS2_3w}KF4 zn}p9~@D9>gobVQMN@!GAl%}z=F=neAHM!U>A+f#(!8~Jrvs^y;S+Pf+n%o`;p%_{- zUe>2^BIg+|?m=brt#}!mPU1~^5XaAWg=tMM#5RpzT?TE{$3fqC<34Dc{;UCdC+isc z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`W-wVm#>^etItN91w>7~}JUq|th z2wvy9gg)mboUXUzuMO9}ly{3WORdTGqx9k^J&Z30ej9iWT3!n`e>z?W++Ji&u8HE= z({T^*jYZb1n^D{l!7IY+8zZ%=^9)e!6mA#6qJlN|LD%cbaLVB$AzeF?I409lIp3lq zd5><2DH;FQNDJ&ib9uEBc`w{h>vJzt-@k7c&SmvU0|ZmW&W8(Dm#1+rbc@%Qr6eWJ zjG%oH)Z4Tj-P2boK3kR?M;|J*d)VV_w@`{xl4_$KJ<~jTD#fDWWNdpAI7g$LpG}K- zyjvUqnukA_T1Gz%qZRq_)DJ%z7emFFSmDd!JZlj+dfkGlN|3HqB9_T{V&QU268%lp zR%w_Pqp@2wEO%P_HUI1>f6_I7Gm}qJ|%E)ElnCfX|*dvm(JvvX;T4OuiVpyyB|F9ii7t zTP1!{WR>-Vu9SHtE8Vf8SmS=_WnN^8k)>BnW}^);=ot&y*E}090+o5O?KsmC)VLC( zYNqgezAgSy*=HZl3^R2MR|3!Il#V9D(-gY2bqnXi!m}-hkAyaFYvg=XT&h~kRbj67 z@odpiy_hc$m#W|3Wn%YsVWxZ}7Q;5c`--sEq}u5V9e%>rdH4)P^*^8=E5zoS#qquW zWqkl^uQ*+k!w1Cmn$-9vIuz}RWe(J>NtkOF+oK*7?Fm>1kUKg)936VEsIN`M3LTic zLZ@qy`f$klbexWlg*^3hb^P&ARa1WqH;SazR6SKX?sf?@~k6uT+Z(R!Zq z>!P$Rjh_?sZRz@brT9RKBhdTAAau(b#$FP)p`Q?DUpl`a3NV+6&AxQYwHExVL0O_t GRQxx(oEs+q diff --git a/ac108_plugin/pcm_ac108.c b/ac108_plugin/pcm_ac108.c index 8b5da04..5d7a19f 100644 --- a/ac108_plugin/pcm_ac108.c +++ b/ac108_plugin/pcm_ac108.c @@ -267,7 +267,7 @@ static int ac108_hw_params(snd_pcm_ioplug_t *io) { snd_pcm_uframes_t buffer_size; int err; if (!rec->hw_params) { - err = ac108_slave_hw_params_half(rec, io->rate*2,io->format); + err = ac108_slave_hw_params_half(rec, 2*io->rate,io->format); if (err < 0) { fprintf(stderr, "ac108_slave_hw_params_half error\n"); return err; @@ -363,6 +363,12 @@ static int ac108_set_hw_constraint(struct ac108_t *rec) { }; unsigned int formats[] = { SND_PCM_FORMAT_S32, SND_PCM_FORMAT_S16 }; + + unsigned int rates[] = { + 8000, + 16000, + 48000 + }; int err; snd_pcm_uframes_t buffer_max; unsigned int period_bytes, max_periods; @@ -377,9 +383,9 @@ static int ac108_set_hw_constraint(struct ac108_t *rec) { if ((err = snd_pcm_ioplug_set_param_list(&rec->io, SND_PCM_IOPLUG_HW_FORMAT, ARRAY_SIZE(formats), formats)) < 0 || (err = snd_pcm_ioplug_set_param_minmax(&rec->io, SND_PCM_IOPLUG_HW_CHANNELS, - 1, 4)) < 0 || - (err = snd_pcm_ioplug_set_param_minmax(&rec->io, SND_PCM_IOPLUG_HW_RATE, - 8000, 96000)) < 0) return err; + 4, 4)) < 0 || + (err = snd_pcm_ioplug_set_param_list(&rec->io, SND_PCM_IOPLUG_HW_RATE, + ARRAY_SIZE(rates), rates)) < 0) return err; err = snd_pcm_ioplug_set_param_minmax(&rec->io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1, 4 * 1024 * 1024);