Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2023-12-15 11:10:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-12-15 11:10:39 +0800
Commit
ad72e7afc3d1cbf6fd3006a943062192df97b583
ad72e7af
1 parent
33c03f78
Print informative error messages for sherpa-onnx-alsa on errors. (#486)
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
19 行增加
和
1 行删除
sherpa-onnx/csrc/alsa.cc
sherpa-onnx/csrc/sherpa-onnx-alsa.cc
sherpa-onnx/csrc/alsa.cc
查看文件 @
ad72e7a
...
...
@@ -144,6 +144,24 @@ const std::vector<float> &Alsa::Read(int32_t num_samples) {
// count is in frames. Each frame contains actual_channel_count_ samples
int32_t
count
=
snd_pcm_readi
(
capture_handle_
,
samples_
.
data
(),
num_samples
);
if
(
count
==
-
EPIPE
)
{
static
int32_t
n
=
0
;
if
(
++
n
>
5
)
{
fprintf
(
stderr
,
"Too many overruns. It is very likely that the RTF on your board is "
"larger than 1. Please use ./bin/sherpa-onnx to compute the RTF.
\n
"
);
exit
(
-
1
);
}
fprintf
(
stderr
,
"XRUN.
\n
"
);
snd_pcm_prepare
(
capture_handle_
);
static
std
::
vector
<
float
>
tmp
;
return
tmp
;
}
else
if
(
count
<
0
)
{
fprintf
(
stderr
,
"Can't read PCM device: %s
\n
"
,
snd_strerror
(
count
));
exit
(
-
1
);
}
samples_
.
resize
(
count
*
actual_channel_count_
);
...
...
sherpa-onnx/csrc/sherpa-onnx-alsa.cc
查看文件 @
ad72e7a
...
...
@@ -104,7 +104,7 @@ as the device_name.
int32_t
segment_index
=
0
;
while
(
!
stop
)
{
const
std
::
vector
<
float
>
samples
=
alsa
.
Read
(
chunk
);
const
std
::
vector
<
float
>
&
samples
=
alsa
.
Read
(
chunk
);
stream
->
AcceptWaveform
(
expected_sample_rate
,
samples
.
data
(),
samples
.
size
());
...
...
请
注册
或
登录
后发表评论