Java 和 USB 声卡中的声音问题
我一直在大学软件开发课程中使用 Java,最近我们一直在做一些构建 MP3 播放器的工作。
我的问题是 Java 中的声音无法正常播放。我使用的是 Ubuntu 10.10,并且有一台笔记本电脑,但我使用的是外部声卡(USB,因为我的内置声音听起来不太好)。问题是 Java 总是通过我的笔记本电脑内部声卡播放声音(尽管 Ubuntu 将内部声音列为关闭),所以我听到的声音来自我的笔记本电脑小扬声器,而不是连接到我的声卡的扬声器。
我可以使用 aoss 程序让它通过声卡播放,但这样做很痛苦。我在我的系统上使用 alsa 和 USB 声卡,它与其他声音程序和音乐播放器一起工作得很好,关于如何解决这个问题有什么想法吗?我很乐意提供任何人需要或认为有用的信息。谢谢!
I've been using Java for a college software development class, and recently we have been doing some work with building an MP3 player.
My problem is that the sound in Java does not play correctly. I'm on Ubuntu 10.10 and I have a laptop, but i'm using an external sound card (USB, because my built in sound doesn't sound very good). Problem is that Java always plays sound though my laptops internal soundcard (even though Ubuntu lists the internal sound as being off), so I hear sound from my little laptop speakers and not the speakers hooked up to my soundcard.
I can get it to play though the soundcard by using the aoss program but its a pain to do this. I'm using alsa on my system with a USB soundcard, it works fine with other sound programs and music players, any ideas on how to fix this problem? I'm happy to provide any information that anyone needs or would find helpful. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
警告:我对 JavaSound 不熟悉。
根据提供的示例代码,看起来该
行是请求播放机制的行,并且您提供的音频格式与内置声卡相匹配。
您需要找出可以使用哪些机制来明确选择给定的机制,而不仅仅是第一个“足够好”的机制。
Caveat: I am not familiar with JavaSound.
Based on the provided example code, it looks like the
line is the one that requests the playback mechanism, and that the audioformat you provide matches the built-in sound card.
You need to find out what mechanisms are available to you for selecting a given one explicitly, instead of just the first one which is "good enough".