我在无线电数据模式解码程序中使用 javax.sound.sampled 包。 要使用该程序,用户将无线电接收器中的音频输入到 PC 的线路输入中。 用户还需要使用他们的混音器程序来选择线路作为录音输入。 问题是有些用户不知道如何执行此操作,有时其他程序也会更改录音输入设置。 所以我的问题是我的程序如何检测线路是否设置为录音输入? 如果我的程序检测到录音输入设置不正确,是否可以更改录音输入设置?
谢谢你的时间。
伊恩
I'm using the javax.sound.sampled package in a radio data mode decoding program. To use the program the user feeds audio from their radio receiver into their PC's line input. The user is also required to use their mixer program to select the line in as the recording input. The trouble is some users don't know how to do this and also sometimes other programs alter the recording input setting. So my question is how can my program detect if the line in is set as the recording input ? Also is it possible for my program to change the recording input setting if it detects it is incorrect ?
Thanks for your time.
Ian
发布评论
评论(1)
要回答您的第一个问题,您可以检查 Line.Info 录音输入对象与 Port.Info.LINE_IN 如下所示:
但是,这不适用于不提供每个可用混音器通道类型的操作系统或声卡驱动程序 API。 因此,当我在 Windows 上测试它时,它可以工作,但在 Linux 或 Mac 上则不行。 如需了解更多信息和建议,请参阅此常见问题解答。
关于第二个问题,您可以尝试通过 控制类。 特别是,请参见 FloatControl.Type< /a> 一些常见的设置。 请记住,这些控件的可用性取决于操作系统和声卡驱动程序,就像线路输入检测一样。
To answer your first question, you can check if the Line.Info object for your recording input matches Port.Info.LINE_IN like this:
However, this doesn't work with operating systems or soundcard driver APIs that don't provide the type of each available mixer channel. So when I test it on Windows it works, but not on Linux or Mac. For more information and recommendations, see this FAQ.
Regarding your second question, you can try changing the recording input settings through a Control class. In particular, see FloatControl.Type for some common settings. Keep in mind that the availability of these controls depends on the operating system and soundcard drivers, just like line-in detection.