您的位置:首页 > 其它

XAudio2音量和音调控制

2016-03-30 12:31 281 查看

This topic describes XAudio2 volume and pitch control.


Volume
Control

Volume levels are expressed as floating-point amplitude multipliers between -XAUDIO2_MAX_VOLUME_LEVEL and XAUDIO2_MAX_VOLUME_LEVEL (-224 to 224), with a maximum
gain of 144.5 dB. A volume of 1.0 means there is no attenuation or gain; 0 means silence; and negative levels can be used to invert the audio's phase. Two inline functions are provided in XAudio2.h to convert between volume units: XAudio2DecibelsToAmplitudeRatio and
 XAudioAmplitudeRatioToDecibels.

音量电平表示为浮点振幅乘数因子,位于-XAUDIO2_MAX_VOLUME_LEVEL(-2的24次方)和XAUDIO2_MAX_VOLUME_LEVEL(2的24次方)之间,最大增益是144.5dB.音量为1.0表示没有衰减或者增益;0表示静音;负音量来表示反转音量的相位。

You can apply a volume level to the audio at several points as it flows through the XAudio2 graph:

音频在XAudio2数据流图中流动时你可以在几个地方施加音量电平:
All voice types apply an overall volume level to their input, which they control using the IXAudio2Voice::SetVolumemethod.
In submix and mastering voices, the overall volume level is applied just before the voice's built-in filter and effect chain. In source voices, the overall volume level is applied after the voice's built-in filter and effect chain.
所有类型的voice施加一个整体音量电平到输入,使用IXAudio2Voice::SetVolume方法来控制。在submix和mastering voices中,整体音量电平应用在voice的内置过滤器和效果链之前。在source voices中,整体音量电平应用在voice的内置过滤器和效果链之后。

Voices apply a per-channel volume level to their output, which they control using theIXAudio2Voice::SetChannelVolumes method.
The per-channel volume level is applied just after the voice's final sample rate conversion, and before it is sent to other voices.
voices应用一个单通道音量电平到输出,使用IXAudio2Voice::SetChannelVolumes来控制。单通道音量电平应用在voice的最终采样率转换之后,并且在输送到其他voices之前。

Every connection between one voice and another has a table of levels used to send audio from each source channel to each target channel, which is controlled using the IXAudio2Voice::SetOutputMatrix method.
voice和其他voice之间的每个连接都有一张电平表,用来发送音频数据从一个源通道到每一个目的通道,使用IXAudio2Voice::SetOutputMatrix来控制。

All overall volumes and channel volumes default to 1.0 initially. All send-level matrices default to appropriate values that preserve signal power and channel positioning as accurately as possible. See the XAudio2
Default Channel Mapping overview for details.

所有整体音量和通道音量在初始化的时候默认为1.0。所有输送音量矩阵默认为适当的数值来尽可能准确地保持信号强度和通道定位。详细请参考XAudio2 Default Channel Mapping概述。
Note  XAudio2 automatically adjusts volume levels based on the user's speaker settings to maintain a consistent volume level across configurations. If the user's settings don't match their physical
configuration the volume will either be too loud or too soft compared to a system with accurate settings. For example, a system configured for 5.1 surround sound speakers that only has two speakers connected will sound too soft. XAudio2 is unable to detect
whether the user speaker settings correctly match their physical setup.
 XAudio2基于用户的扬声器设置自动调节音量电平来保持一致的音量在整个配置中。如果用户的设置和物理配置不匹配,那么音量和系统准确配置比起来要么太响要么太柔和。例如,系统配置为5.1环绕立体声扬声器,但是只有两个扬声器连接着,就会听起来很柔和。XAudio2不能检测用户的扬声器设置是否可以正确的匹配他们的物理设置。


Pitch
Control

Pitches are expressed as input rate/output rate ratios between 1/1,024 and 1,024/1, inclusive. A ratio of 1/1,024 lowers pitch by 10 octaves, while a ratio of 1,024/1 raises it by 10 octaves. You can only use theIXAudio2SourceVoice::SetFrequencyRatio method
to apply pitch adjustments to source voices, and only if they were not created with the XAUDIO2_VOICE_NOPITCH flag. The default frequency ratio is 1/1: that is, no pitch change. Two inline functions are provided in XAudio2.h to convert between frequency ratios
and semitones:XAudio2FrequencyRatioToSemitones and XAudio2SemitonesToFrequencyRatio.

音调表示为输入率和输出率的比值,在1/1,024和1,024/1之间,包括两端(闭区间)。一个1/1,024的比例降低10个八度音节的音高,而一个1,024/1的比例提升了10个八度音节的音高。你只能用IXAudio2SourceVoice::SetFrequencyRatio方法来应用音调调节到source voices,并且只有当他们不是使用XAUDIO2_VOICE_NOPITCH标志来创建的才可以。默认的频率比是1/1,:表示的是,没有音调变化。在XAudio2.h头文件中提供了两个内联函数来进行频率比和半音程之间的相互转换:XAudio2FrequencyRatioToSemitones
和 XAudio2SemitonesToFrequencyRatio。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: