0

如何在 JMF 中获取麦克风音量控制器?

这就是我所拥有的:

我尝试了你的这个实现概念,但是当我尝试获取流时,我一直从第一个卷处理器得到一个空值,我是这样做的:

// the device is the media device specifically audio
Processor processorForVolume = Manager.createProcessor(device.getLocator());

// wait until configured
ProcessorStates newState = new ProcessorStateListener(Processor.Configured).waitForProcessorState(processorForVolume);
System.out.println("volumeProcessorState: "+newState);

// setting the content descriptor to null - read in another thread this allows to get the gain control
processorForVolume.setContentDescriptor(null);

// set the track control format to one supported by the device and the track control.
// I didn't match it to an RTP allowed format, but I don't think this has anything to do with it...
TrackControl[] trackControls = processorForVolume.getTrackControls();
if (trackControls.length == 0)
    throw new MC_Exception("No track controls where found for this device:", new Object[]{device});
for (TrackControl control : trackControls)
    trackManipulator.manipulateTrackControls(control);

// wait until the processor is realized
newState = new ProcessorStateListener(Controller.Realized).waitForProcessorState(processorForVolume);
System.out.println("volumeProcessorState: "+newState);

// receives the gain control
micVolumeController = processorForVolume.getGainControl();

// cannot get the output stream to process further... any suggestions?
processor = Manager.createProcessor(processorForVolume.getDataOutput());
new ProcessorStateListener(Processor.Configured).waitForProcessorState(processor);
processor.setContentDescriptor(DeviceCapturingManager.RAW_RTP);
new ProcessorStateListener(Controller.Realized).waitForProcessorState(processor);

这是它生成的输出:

volumeProcessorState:配置格式设置为跟踪控制 - com.sun.media.ProcessEngine$ProcTControl@1627c16:LINEAR,48000.0 Hz,16 位,立体声,LittleEndian,签名 volumeProcessorState:已实现

处理器输出的数据为Null。

我应该明确一点,当内容描述符 != null 我得到一个输出流但没有音量控制器,当它为空时我得到控制器,但没有流。

我尝试连接到音频麦克风设备

亚当。

4

1 回答 1

0

麦克风没有音量组件!必须自己实现一个。

于 2011-04-25T12:55:59.533 回答