JMF麦克风音量控制器

时间:2010-06-13 17:48:11

标签: controller media volume microphone jmf

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

这就是我所拥有的:

我尝试了你的这个实现概念,但是当我尝试获取流时,我继续从第一个卷处理器获取null,这是我的工作方式:

// 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位,立体声,   小恩迪安,签名   volumeProcessorState:已实现

并且处理器输出的数据为Null。

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

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

亚当。

1 个答案:

答案 0 :(得分:0)

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