任何XAudio2 voice都可以持有一个音频效果链。你可以使用XAUDIO2_EFFECT_DESCRIPTOR数组来指定效果链。每个描述因子都包含了由客户端提供的指向音效对象的指针。这些对象必须实现APO接口。
结构体定义为:
typedef struct XAUDIO2_EFFECT_DESCRIPTOR { IUnknown *pEffect; BOOL InitialState; UINT32 OutputChannels; } XAUDIO2_EFFECT_DESCRIPTOR;第一个参数指向XAPO对象。第二个参数表示初始化状态,如果效果需要以可用的状态开始的话,那么此值为TRUE,否则为FALSE。第三个参数表示音效需要生成的通道数。
XAPO实例以IUnknown接口的形式传递给XAudio2。XAudio2可以使用 IXAPO::QueryInterface来获取IXAPO接口,并且检测IXAPO是否实现了 IXAPOParameters接口。
将XAPO对象传递给XAudio2后,需要设置具体的参数,关联已有的音效。参数的保存需要使用XAUDIO2FX_REVERB_PARAMETERS结构体。
结构体定义为:
typedef struct XAUDIO2FX_REVERB_PARAMETERS { float WetDryMix; UINT32 ReflectionsDelay; BYTE ReverbDelay; BYTE RearDelay; BYTE SideDelay; BYTE PositionLeft; BYTE PositionRight; BYTE PositionMatrixLeft; BYTE PositionMatrixRight; BYTE EarlyDiffusion; BYTE LateDiffusion; BYTE LowEQGain; BYTE LowEQCutoff; BYTE HighEQGain; BYTE HighEQCutoff; float RoomFilterFreq; float RoomFilterMain; float RoomFilterHF; float ReflectionsGain; float ReverbGain; float DecayTime; float Density; float RoomSize; BOOL DisableLateField; } XAUDIO2FX_REVERB_PARAMETERS;
Percentage of the output that will be reverb. Allowable values are from 0 to 100.
将要混响的输出的百分比。允许的数值是0~100.
The delay time of the first reflection relative to the direct path. Permitted range is from 0 to 300 milliseconds.
相对于直接路径,第一反射的延时。允许的变化范围是从0~300毫秒。
Delay of reverb relative to the first reflection. Permitted range is from 0 to 85 milliseconds.
Delay for the left rear output and right rear output. Permitted range is from 0 to 5 milliseconds.
Delay for the left side output and right side output. Permitted range is from 0 to 5 milliseconds.
Position of the left input within the simulated space relative to the listener. With PositionLeft set to the minimum value, the left input is placed close to the listener. In this position, early reflections are dominant, and the reverb decay is set back in the sound field and reduced in amplitude. With PositionLeft set to the maximum value, the left input is placed at a maximum distance from the listener within the simulated room. PositionLeft does not affect the reverb decay time (liveness of the room), only the apparent position of the source relative to the listener. Permitted range is from 0 to 30 (no units).
在模拟空间中左输入相对于听者的位置。PositionLeft设置为最小值,左输入被放置在离听者近的位置。在这个位置,早期的反射占主导地位,且混响衰减在声音区域推迟并且在幅度上减少。PositionLeft设置为最大值,在模拟空间内左输入被放置在离听众最远的距离。PositionLeft不影响混响衰减时间(房间生命期),只是源相对于听者的明显位置。允许变化范围是0~30,无单位。
Same as PositionLeft, but affecting only the right input. Permitted range is from 0 to 30 (no units).
Gives a greater or lesser impression of distance from the source to the listener. Permitted range is from 0 to 30 (no units).
提供一种或多或少的距离上的感觉,从源到听众之间。允许变化范围是0~30,无单位。
Gives a greater or lesser impression of distance from the source to the listener. Permitted range is from 0 to 30 (no units).
Controls the character of the individual wall reflections. Set to minimum value to simulate a hard flat surface and to maximum value to simulate a diffuse surface. Permitted range is from 0 to 15 (no units).
控制单个墙壁反射的特性。最小值表示模拟坚硬平坦的表面,最大值表示模拟漫反射表面。允许变化范围是0~15,无单位。
Controls the character of the individual wall reverberations. Set to minimum value to simulate a hard flat surface and to maximum value to simulate a diffuse surface. Permitted range is from 0 to 15 (no units).
控制单个墙壁混响的特性。最小值表示模拟坚硬平坦的表面,最大值表示模拟漫反射表面。允许变化范围是0~15,无单位。
Adjusts the decay time of low frequencies relative to the decay time at 1 kHz. The values correspond to dB of gain as follows:
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Gain (dB) | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 0 | +1 | +2 | +3 | +4 |
Permitted range is from 0 to 12 (no units).
LowEQGain的值为8时,作用在低频率的衰减时间和1kHz时的衰减时间相等。允许变化范围是0~12,无单位。
Sets the corner frequency of the low pass filter that is controlled by the LowEQGain parameter. The values correspond to frequency in Hz as follows:
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
Frequency (Hz) | 50 | 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500 |
Permitted range is from 0 to 9 (no units).
允许变化范围是0~9,无单位。
Adjusts the decay time of high frequencies relative to the decay time at 1 kHz. When set to zero, high frequencies decay at the same rate as 1 kHz. When set to maximum value, high frequencies decay at a much faster rate than 1 kHz.
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|---|---|
Gain (dB) | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 0 |
Permitted range is from 0 to 8 (no units).
允许变化范围是0~8,无单位。
Sets the corner frequency of the high pass filter that is controlled by the HighEQGain parameter. The values correspond to frequency in kHz as follows:
Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Frequency (kHz) | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5 | 5.5 | 6 | 6.5 | 7 | 7.5 | 8 |
Permitted range is from 0 to 14 (no units).
允许变化范围是0~14,无单位。
Sets the corner frequency of the low pass filter for the room effect. Permitted range is from 20 to 20,000 Hz.
Sets the pass band intensity level of the low-pass filter for both the early reflections and the late field reverberation. Permitted range is from -100 to 0 dB.
为早期反射和晚期区域回响设置低通滤波器的传动带强度水平。允许变化范围是-100~0dB.
Sets the intensity of the low-pass filter for both the early reflections and the late field reverberation at the corner frequency (RoomFilterFreq). Permitted range is from -100 to 0 dB.
在拐角频率基础上为早期反射和晚期区域回响设置低通滤波器的强度。允许变化范围是-100~0dB.
Adjusts the intensity of the early reflections. Permitted range is from -100 to 20 dB.
调节早期反射的强度。允许变化范围是-100~20dB.
Adjusts the intensity of the reverberations. Permitted range is from -100 to 20 dB.
调节混响的强度。允许变化范围是-100~20dB.
Reverberation decay time at 1 kHz. This is the time that a full scale input signal decays by 60 dB. Permitted range is from 0.1 to infinity seconds.
1Hz时的回响衰减时间。这是完全比例的输入信息衰减60dB的时间。允许变化范围是0.1到无穷大秒。
Controls the modal density in the late field reverberation. For colorless spaces, Density should be set to the maximum value (100). As Density is decreased, the sound becomes hollow (comb filtered). This is an effect that can be useful if you are trying to model a silo. Permitted range as a percentage is from 0 to 100.
控制晚场混响的模态密度。对于无色彩的空间,密度应该设置为最大值100.随着密度减少,声音变为中空(梳状滤波)。如果你想要创建一个筒状模型,这是非常有用的效果。允许变化百分比是0~100.
The apparent size of the acoustic space. Permitted range is from 1 to 100 feet.
听觉空间的明显尺寸。允许变化范围是1~100英尺。
If set to TRUE, disables late field reflection calculations. Disabling late field reflection calculations results in a significant CPU time savings.
如果设置为TRUE,禁止晚场反射计算。禁止晚场反射计算可以带来很大的CPU时间节省。
注意:XAudio2的DirectX SDK版本不支持这个成员。
All parameters related to sampling rate or time are relative to a 48kHz voice and must be scaled for use with other sampling rates. For example, setting ReflectionsDelay to 300ms gives a true 300ms delay when the reverb is hosted in a 48kHz voice, but becomes a 150ms delay when hosted in a 24kHz voice.
所有和采样率或者时间相关的参数都是相对于48kHz的 voice,如果使用其他采样率,必须进行缩放。例如,设置 ReflectionsDelay 为300ms,当混响被一个48kHz的voice持有时就会出现真实的300ms的延时,但是如果24kHz 的voice持有的话,那么就是150ms的延迟。交流QQ:1245178753
本文地址:http://blog.csdn.net/u011417605/article/details/51168392