我正在寻找类似的东西,test -x
但只有当文件可由“其他”执行时才会成功,例如在chmod o+x FILE
.
我可以尝试解析ls -l
,
-rw-r--r-x 1 me me 0 Dec 23 10:47 t
但有更优雅的方式吗?
根据一篇名为Pulseaudio And Latencymodule-alsa-sink
的博客文章的建议,我尝试使用特殊fragments
和参数加载fragment_size
以确保低延迟。但是,我不确定这些到底在做什么。报告的延迟pactl list sinks
与我在这些参数中输入的值没有明显的对应关系。这是我编写的用于测试各种设置的简短脚本:
pulseaudio &
# unload all sinks
pactl list sinks | grep "Owner Module" | \
cut -d : -f 2 | \
while read i; do
pactl unload-module $i;
done
# try different settings
patest () {
pactl load-module module-alsa-sink device=$DEV \
tsched=no \
fixed_latency_range=yes \
fragments=$F fragment_size=$FS > /tmp/modnum.out;
pactl list sinks | grep Latency;
pactl unload-module $(cat /tmp/modnum.out)
}
patest_nofix () {
pactl load-module module-alsa-sink device=$DEV > /tmp/modnum.out;
pactl list sinks | grep Latency;
pactl unload-module $(cat /tmp/modnum.out)
}
fragments
现在我可以尝试(F)和fragment_size
(FS)的各种设置。对于硬件设备“hw:0”,延迟很低,但我看不出它与两个参数的对应关系:
F=1; FS=15; DEV=hw:0; patest
# Latency: 2516 usec, configured 1451 usec
F=1; FS=30; DEV=hw:0; patest
# Latency: 2484 usec, configured 1451 usec
F=5; FS=15; DEV=hw:0; patest
# Latency: 2475 usec, configured 1451 usec
F=50; FS=200; DEV=hw:0; patest
# Latency: 57628 usec, configured 56689 usec
# (default minimum latency:)
DEV=hw:0; patest_nofix
# Latency: 1983968 usec, configured 2000000 usec
对于“dmix” ALSA 设备,它有点高,不知道为什么:
F=1; FS=15; DEV=dmix; patest
# Latency: 42752 usec, configured 42666 usec
# (default:)
DEV=dmix; patest_nofix
# Latency: 326596 usec, configured 341333 usec
但是,当我创建自己的“dmix”设备以输出到 hw:0 时,
$ cat ~/.asoundrc
...
pcm.hw0mix {
type dmix
ipc_key 2498 # unique random number
slave {
pcm "hw:0,0"
channels 2
rate 48000
}
}
然后我可以看到延迟要高得多,并且似乎固定在 0.25 秒:
F=1; FS=15; DEV=hw0mix; patest
# Latency: 251132 usec, configured 250000 usec
F=50; FS=200; DEV=hw0mix; patest
# Latency: 251126 usec, configured 250000 usec
# (default:)
DEV=hw0mix; patest_nofix
# Latency: 356292 usec, configured 375000 usec
fragments
参数和和“配置的延迟”之间有什么关系fragment_size
,如何将配置的最小延迟更改为更低,即使对于非硬件 ALSA 设备也是如此?