Visualizer 示波器 [中文翻译小组]

The Visualizer class enables application to retrieve part of the currently playing audio for visualization purpose.

Visualizer类使应用程序能够检索当前播放的音频的一部分,以便进行可视化。

It is not an audio recording interface and only returns partial and low quality audio content.

它不是音频录制接口,只返回部分和低质量的音频内容。

However, to protect privacy of certain audio data (e.g voice mail) the use of the visualizer requires the permission android.permission.RECORD_AUDIO.
但是,为了保护某些音频数据(如语音邮件)的隐私,使用可视化工具需要获得android.permission.RECORD_audio的许可。


The audio session ID passed to the constructor indicates which audio content should be visualized:
传递给构造函数的音频会话ID指示应可视化哪些音频内容:


If the session is 0, the audio output mix is visualized
如果会话为0,则显示音频输出混合


If the session is not 0, the audio from a particular android.media.MediaPlayer or android.media.AudioTrack using this audio session is visualized
如果会话不是0,则显示使用此音频会话的特定android.media.MediaPlayer或android.media.AudioTrack中的音频


Two types of representation of audio content can be captured:
可以捕获两种类型的音频内容表示:


Waveform data: consecutive 8-bit (unsigned) mono samples by using the getWaveForm(byte[]) method
波形数据:使用getWaveForm(byte[])方法连续8位(无符号)单声道采样


Frequency data: 8-bit magnitude FFT by using the getFft(byte[]) method
频率数据:使用getFft(byte[])方法进行8位幅度FFT


The length of the capture can be retrieved or specified by calling respectively getCaptureSize() and setCaptureSize(int) methods. The capture size must be a power of 2 in the range returned by getCaptureSizeRange().
可以通过分别调用getCaptureSize()和setCaptureSize(int)方法来检索或指定捕获的长度。在getCaptureSizeRange()返回的范围内,捕获大小必须是2的幂。

 

In addition to the polling capture mode described above with getWaveForm(byte[]) and getFft(byte[]) methods,

除了上面用getWaveForm(byte[])和getFft(byte[])方法描述的轮询捕获模式外,

a callback mode is also available by installing a listener by use of the setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener,int,boolean,boolean) method.

还可以通过使用setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener,int,boolean,boolean)方法安装侦听器来使用回调模式。

The rate at which the listener capture method is called as well as the type of data returned is specified.
指定调用侦听器捕获方法的速率以及返回的数据类型。

 


Before capturing data, the Visualizer must be enabled by calling the setEnabled(boolean) method. When data capture is not needed any more, the Visualizer should be disabled.
在捕获数据之前,必须通过调用setEnabled(boolean)方法来启用可视化工具。当不再需要数据捕获时,应禁用可视化工具。
It is good practice to call the release() method when the Visualizer is not used anymore to free up native resources associated to the Visualizer instance.
当不再使用可视化工具来释放与可视化工具实例关联的本机资源时,调用release()方法是一种很好的做法。
Creating a Visualizer on the output mix (audio session 0) requires permission android.Manifest.permission#MODIFY_AUDIO_SETTINGS
在输出混音(音频会话0)上创建可视化工具需要权限android.Manifest.permission#MODIFY _audio_SETTINGS
The Visualizer class can also be used to perform measurements on the audio being played back. The measurements to perform are defined by setting a mask of the requested measurement modes with setMeasurementMode(int). Supported values are MEASUREMENT_MODE_NONE to cancel any measurement, and MEASUREMENT_MODE_PEAK_RMS for peak and RMS monitoring. Measurements can be retrieved through getMeasurementPeakRms(android.media.audiofx.Visualizer.MeasurementPeakRms).
Visualizer类还可用于对正在播放的音频执行测量。要执行的测量是通过使用setMeasurementMode(int)设置请求的测量模式的掩码来定义的。支持的值是MEASUREMENT_MODE_NONE以取消任何测量,MEASUREMENT_MODE_PEAK_RMS用于峰值和RMS监视。可以通过getMeasurementPeakRms(android.media.audiofx.Visualizer.MeasurementPeakRms)检索测量值。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值