JMF麦克风音量控制器
如何在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: 线性、48000.0 Hz、16 位、立体声、 LittleEndian,签名 VolumeProcessorState:已实现
,处理器输出的数据为Null。
我应该明确的是,当内容描述符!= null 时,我确实获得了输出流,但没有音量控制器,而当内容描述符为 null 时,我获得了控制器,但没有流。
我尝试连接到音频麦克风设备
Adam。
How to obtain the Microphone volume controller in JMF?
this is what I have:
I tried this implementation concept of yours, but I keep getting a null from the first volume processor when I try to get the stream, here is how I do it:
// 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);
this is the output It generates:
volumeProcessorState: Configured
format set to track control -
com.sun.media.ProcessEngine$ProcTControl@1627c16:
LINEAR, 48000.0 Hz, 16-bit, Stereo,
LittleEndian, Signed
volumeProcessorState: Realized
and the data output from the processor is Null.
I should make clear that when the content descriptor != null I do get an output stream but not the volume controller, and the when it is null I get the controller, but no stream.
I try to connect to an audio microphone device
Adam.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
麦克风没有音量组件!必须自己实施一项。
The Microphone does not have a Volume component! Must implement one yourself.