我正在寻找一种方法来选择一个特定的麦克风来捕捉声音。我发现有搅拌器,有isLineSupported(Port.Info.MICROPHONE)==true
。什么是com.sun.media.sound.PortMixer-s类?
但这些混合器是无证的类com.sun.media.sound.PortMixer
,我无能为力。
例如,我无法从这些混音器的TargetLines
中读取数据,因为它们不是TargetDataLine
类型。
这些调音台是什么?只是为了创造一些混乱?
我正在寻找一种方法来选择一个特定的麦克风来捕捉声音。我发现有搅拌器,有isLineSupported(Port.Info.MICROPHONE)==true
。什么是com.sun.media.sound.PortMixer-s类?
但这些混合器是无证的类com.sun.media.sound.PortMixer
,我无能为力。
例如,我无法从这些混音器的TargetLines
中读取数据,因为它们不是TargetDataLine
类型。
这些调音台是什么?只是为了创造一些混乱?
我希望这个source code可以对你有任何用处。
在仔细观察后,我认为这可能有所帮助。
从AudioSystem.getMixerInfo()
mixerDetails.getDescription()
mixerDetails.getName()
上的返回值运行此给出以下:
Direct Audio Device: DirectSound Playback
Primary Sound Driver
Direct Audio Device: DirectSound Playback
Realtek HD Audio output
Direct Audio Device: DirectSound Playback
Microsoft LifeChat LX-3000
Direct Audio Device: DirectSound Capture
Primary Sound Capture Driver
Direct Audio Device: DirectSound Capture
Microsoft LifeChat LX-3000
Direct Audio Device: DirectSound Capture
Realtek HD Audio Input
Software mixer and synthesizer
Java Sound Audio Engine
Port Mixer
Port Realtek HD Audio output
Port Mixer
Port Realtek HD Audio Input
Port Mixer
Port Microsoft LifeChat LX-3000
我有同样的问题与“端口混频器“港口微软LifeChat LX -3000',这是'com.sun.media.sound.PortMixer'的一个实例。在此混频器调用
AudioSystem.getTargetDataLine(format, mixerInfo)
给出如下:
Exception in thread "main" java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine
下载源和Eclipse中的调试运行表明,我的这个端口的情况下,它只有javax.sound.sampled中.Port.class可用,因此调用AudioSystem.getTargetDataLine其在幕后做:
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
Mixer mixer = AudioSystem.getMixer(mixerinfo);
return (TargetDataLine) mixer.getLine(info);
失败 - 只有使用javax线。 sound.sampled.Port.class在portMixer中可用。在我的港口,那条线是一个扬声器,但即使不是,内部存储的目标线似乎都是端口,这不是特别有用。甚至在课堂上的评论都说'只提供端口的混音器'。
因此,无论它用于什么,它似乎都没有获取源/目标行。说实话,我看不到它的用途。我会试着看看你系统上的其他混音器。如果你的是我的,那么会有一个directsound捕捉,你可以用它来代替。