XAudio2的三种Voice

XAudio2 Voices : https://msdn.microsoft.com/en-us/library/windows/desktop/ee415825(v=vs.85).aspx

There are three types of XAudio2 voice objects: sourcesubmix, and mastering voices. Source voices operate on audio data provided by the client. Source and submix voices send their output to one or more submix or mastering voices. Submix and mastering voices mix the audio from all voices feeding them, and operate on the result. Mastering voices write audio data to an audio device.

总共有三种XAudio2 voice对象:source(源)、submix(子混合)、mastering(主)声音。Source声音对客户端提供的音频数据进行操作。Source和submix声音将它们的输出发送到一个或者多个submix或者mastering声音。Submix和mastering声音混合所有其他声音提供给他们的音频数据,并且对结果进行操作。Mastering声音将音频数据写到音频输出设备。

Actions Performed by All Voices

All voices perform the following actions in order on the audio that travels though them.

所有voices在通过它们的音频数据上依次呈现以下动作:


1.Overall volume adjustment, affecting all audio channels. See IXAudio2Voice::SetVolume.
整体音量调节,影响多有音频通道。可以参考:IXAudio2Voice::SetVolume.


2.An optional client-specified chain of one or more DSP effects, such as the built-in reverb or a user effect defined by the IXAPO interface. SeeXAudio2 Audio Effects.

一个或者多个DSP(数字信号处理)效果的其中一个可以选择指定客户端的效果链,比如内置的混响或者一个用户效果,是有IXAPO接口来定义的。参考XAudio2 Audio Effects.


Per-channel output volume adjustment. See IXAudio2Voice::SetChannelVolumes.

单通道输出音量调节。参考IXAudio2Voice::SetChannelVolumes。


Separate matrix mix to each of the destination voices or to the audio output device for mastering voices. This mix changes the number of channels in the audio, if necessary.

将矩阵混合分别输出到每个目的voice或者输出到和音频输出设备关联的mastering voices。如果必要的话,这种混合会改变音频中的通道数。


Source Voices

Use source voices to submit audio data into the XAudio2 processing pipeline. They are the entry points into the XAudio2 Audio Graph. You must send voice data to a mastering voice to be heard, either directly or through intermediate submix voices.

使用source voices来提交音频数据到XAudio2处理管道线。它们是XAudio2 音频图的入口。你必须要将音频数据直接或者通过submix voices输出到一个mastering voice才可以被听到。

In addition to the actions performed by all voices, source voices perform the following actions.

除了其他voices都可以呈现的操作外,source voices还可以呈现下述操作:

·)If necessary, a decoder runs first to convert encoded source data to Pulse Code Modulation (PCM).

如果需要的话,可以先运行一个解码器来将解码的数据转化为PCM。


·)A variable-rate sample rate conversion (SRC) converts the voice's source audio data to the sample rate expected by its destination voices, if necessary, and also supports dynamic pitch changes.

一种可变化的采样率转换可以将voice的源音频数据转为目的voice期望的采样率。如果需要的话,还支持动态音调变化。


·)An optional state-variable filter can be used to color the sound in various ways. See IXAudio2Voice::SetFilterParameters.

一种可选择的状态多变过滤器可以用不同的方式来润色声音。参考IXAudio2Voice::SetFilterParameters。


·)An optional filter can be applied to the voice's outputs. See IXAudio2Voice::SetOutputFilterParameters.

一个可选择的过滤器可以应用到voice的输出上。参考IXAudio2Voice::SetOutputFilterParameters


Submix Voices

A submix voice is used primarily for performance improvements and effects processing. You cannot submit data buffers directly to submix voices. It will not be audible unless you submit it to a mastering voice. You can use a submix voice to ensure that a particular set of voice data is converted to the same format and to have a particular effect chain processed on the collective result.

submix voice主要是用来做性能提升和效果处理。不能直接向submix voice提交音频数据。除非你把输出指向一个mastering voice,否则它是不会播出声音的。你可以使用一个submix voice来保证,每一个音频数据集都被转为统一格式,并且在处理结果集上拥有同一个效果链。

In addition to the actions performed by all voices, submix voices perform the following actions.

除了其他声音都共有的特性外,submix voice还有如下特性:

A fixed-rate SRC runs on the voice's output, if necessary, to convert the audio to the sample rate expected by its destination voices.
固定的采样率转运行在voice的输出上,如果必要的话,把音频转为目的voice期望的采样率。


An optional state-variable filter can be used to color the sound in various ways. See IXAudio2Voice::SetFilterParameters.
一种可选择的状态多变过滤器可以用不同的方式来润色声音。参考IXAudio2Voice::SetFilterParameters。

An optional filter can be applied to the voice's outputs. See IXAudio2Voice::SetOutputFilterParameters.

一个可选择的过滤器可以应用到voice的输出上。参考IXAudio2Voice::SetOutputFilterParameters


Mastering Voices

Use a mastering voice to represent the audio output device. You cannot submit data buffers directly to mastering voices, but data submitted to other types of voices must go to a mastering voice to be heard.
使用mastering voice来展现音频输出设备。不能直接提交音频数据给mastering voice,但是提交给其他类型的voice的数据一定要流向mastering voice才可以被听到。

In addition to the actions performed by all voices, mastering voices perform the following actions.

除了共有的特性外,mastering voice还有如下特性:

If you create the mastering voice with an explicit  InputSampleRate  value that is not supported by the audio device, a fixed-rate SRC is used to convert to the closest sample rate supported by the device.

如果你使用一个明确的但是音频设备并不支持InputSampleRate(输入采样率)值,一个固定速率的采样率转换会用来转换为设备支持的最相近的采样率。


Clip the final output audio, if it is required by the output device.

裁剪最终的输出音频,如果输出设备有要求。


交流QQ:1245178753

你可能感兴趣的:(XAudio2)