ubuntu 上的工具包没有发出蜂鸣声
我在使用 Toolkit 的蜂鸣声时遇到问题。我在 /etc/modprobe.d/blacklist.conf
中注释掉了两条扬声器禁用行。我无法使用控制台代码 7
发出蜂鸣声,因为我需要它在 Swing 中工作,并且我希望它在 Eclipse IDE 中能够听到(而不是在类似控制台的窗格中显示特殊符号)蚀)。当不在 Eclipse IDE 中时,我测试了代码 7
并发现可以听到它的声音,所以我知道这不是连接器松动的问题。我确实通过 .wav 文件获得了不错的声音效果,但有时我只想要一个简单的蜂鸣声,并且不想使用大量 CPU 周期来实现它。目前我正在使用 Runtime.getRuntime().exec("beep") ,但这似乎也有点过度。我用的是ubuntu 10.10。电脑板是技嘉MA 770 UD3。下面是有问题的程序。
import java.awt.Toolkit;
public class Beeper
{
public static void main(String[] args)
{
Toolkit.getDefaultToolkit().beep();
}
}
来自 blacklist.conf 的内容如下。
# low-quality, just noise when being used for sound playback, causes
# hangs at desktop session start (Ubuntu: #246969)
#blacklist snd_pcsp
# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
#blacklist pcspkr
I am having problems with Toolkit's beep. I commented out the two speaker disabling lines in /etc/modprobe.d/blacklist.conf
. I cannot use the console code 7
to beep because I need it to work in Swing and I would like it to be audible in Eclipse IDE (rather than to show a special symbol in the console-like pane in Eclipse). When not in the Eclipse IDE, I have tested code 7
and found it to be audible so I know it is not a loose connector problem. I do have nice sound effects via .wav files but sometimes I just want a simple beep and I don't want to use a lot of CPU cycles to achieve it. Presently I am using Runtime.getRuntime().exec("beep")
but that also seems a bit excessive. I am on ubuntu 10.10. The computer board is a Gigabyte MA 770 UD3. Below is the offending program.
import java.awt.Toolkit;
public class Beeper
{
public static void main(String[] args)
{
Toolkit.getDefaultToolkit().beep();
}
}
From blacklist.conf is the following.
# low-quality, just noise when being used for sound playback, causes
# hangs at desktop session start (Ubuntu: #246969)
#blacklist snd_pcsp
# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
#blacklist pcspkr
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜你的 pcspks 模块没有加载...我遇到了同样的问题,发现在我的系统(14.04 LTS)上,它没有加载。
通过执行 lsmod | 检查它是否已加载grep pcspkr 在终端中。如果您得到类似的行,
则已加载。如果您没有从命令中得到任何输出,请尝试加载模块:
这对我来说很有效。
I guess that your
pcspks
module isn't loaded... I had the same problem and found out that on my system (14.04 LTS), it wasn't.Check if it's loaded by doing a
lsmod | grep pcspkr
in a terminal. If you get a line similar toit is loaded. If you do not get any output back from the command, try to load the module:
That did the trick for me.