本文整理汇总了C++中IXAudio2SourceVoice::SetOutputFilterParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ IXAudio2SourceVoice::SetOutputFilterParameters方法的具体用法?C++ IXAudio2SourceVoice::SetOutputFilterParameters怎么用?C++ IXAudio2SourceVoice::SetOutputFilterParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXAudio2SourceVoice
的用法示例。
在下文中一共展示了IXAudio2SourceVoice::SetOutputFilterParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAudio
//.........这里部分代码省略.........
XMVECTOR vDelta = v1 - v2;
g_audioState.fListenerAngle = float( atan2( XMVectorGetX( vDelta ), XMVectorGetZ( vDelta ) ) );
vDelta = XMVectorSetY( vDelta, 0.f );
vDelta = XMVector3Normalize( vDelta );
XMFLOAT3 tmp;
XMStoreFloat3( &tmp, vDelta );
g_audioState.listener.OrientFront.x = tmp.x;
g_audioState.listener.OrientFront.y = 0.f;
g_audioState.listener.OrientFront.z = tmp.z;
}
if (g_audioState.fUseListenerCone)
{
g_audioState.listener.pCone = (X3DAUDIO_CONE*)&Listener_DirectionalCone;
}
else
{
g_audioState.listener.pCone = nullptr;
}
if (g_audioState.fUseInnerRadius)
{
g_audioState.emitter.InnerRadius = 2.0f;
g_audioState.emitter.InnerRadiusAngle = X3DAUDIO_PI/4.0f;
}
else
{
g_audioState.emitter.InnerRadius = 0.0f;
g_audioState.emitter.InnerRadiusAngle = 0.0f;
}
if( fElapsedTime > 0 )
{
XMVECTOR v1 = XMLoadFloat3( &g_audioState.vListenerPos );
XMVECTOR v2 = XMVectorSet( g_audioState.listener.Position.x, g_audioState.listener.Position.y, g_audioState.listener.Position.z, 0 );
XMVECTOR lVelocity = ( v1 - v2 ) / fElapsedTime;
g_audioState.listener.Position.x = g_audioState.vListenerPos.x;
g_audioState.listener.Position.y = g_audioState.vListenerPos.y;
g_audioState.listener.Position.z = g_audioState.vListenerPos.z;
XMFLOAT3 tmp;
XMStoreFloat3( &tmp, lVelocity );
g_audioState.listener.Velocity.x = tmp.x;
g_audioState.listener.Velocity.y = tmp.y;
g_audioState.listener.Velocity.z = tmp.z;
v1 = XMLoadFloat3( &g_audioState.vEmitterPos );
v2 = XMVectorSet( g_audioState.emitter.Position.x, g_audioState.emitter.Position.y, g_audioState.emitter.Position.z, 0.f );
XMVECTOR eVelocity = ( v1 - v2 ) / fElapsedTime;
g_audioState.emitter.Position.x = g_audioState.vEmitterPos.x;
g_audioState.emitter.Position.y = g_audioState.vEmitterPos.y;
g_audioState.emitter.Position.z = g_audioState.vEmitterPos.z;
XMStoreFloat3( &tmp, eVelocity );
g_audioState.emitter.Velocity.x = tmp.x;
g_audioState.emitter.Velocity.y = tmp.y;
g_audioState.emitter.Velocity.z = tmp.z;
}
DWORD dwCalcFlags = X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER
| X3DAUDIO_CALCULATE_LPF_DIRECT | X3DAUDIO_CALCULATE_LPF_REVERB
| X3DAUDIO_CALCULATE_REVERB;
if (g_audioState.fUseRedirectToLFE)
{
// On devices with an LFE channel, allow the mono source data
// to be routed to the LFE destination channel.
dwCalcFlags |= X3DAUDIO_CALCULATE_REDIRECT_TO_LFE;
}
X3DAudioCalculate( g_audioState.x3DInstance, &g_audioState.listener, &g_audioState.emitter, dwCalcFlags,
&g_audioState.dspSettings );
IXAudio2SourceVoice* voice = g_audioState.pSourceVoice;
if( voice )
{
// Apply X3DAudio generated DSP settings to XAudio2
voice->SetFrequencyRatio( g_audioState.dspSettings.DopplerFactor );
voice->SetOutputMatrix( g_audioState.pMasteringVoice, INPUTCHANNELS, g_audioState.nChannels,
g_audioState.matrixCoefficients );
voice->SetOutputMatrix(g_audioState.pSubmixVoice, 1, 1, &g_audioState.dspSettings.ReverbLevel);
XAUDIO2_FILTER_PARAMETERS FilterParametersDirect = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * g_audioState.dspSettings.LPFDirectCoefficient), 1.0f }; // see XAudio2CutoffFrequencyToRadians() in XAudio2.h for more information on the formula used here
voice->SetOutputFilterParameters(g_audioState.pMasteringVoice, &FilterParametersDirect);
XAUDIO2_FILTER_PARAMETERS FilterParametersReverb = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * g_audioState.dspSettings.LPFReverbCoefficient), 1.0f }; // see XAudio2CutoffFrequencyToRadians() in XAudio2.h for more information on the formula used here
voice->SetOutputFilterParameters(g_audioState.pSubmixVoice, &FilterParametersReverb);
}
}
g_audioState.nFrameToApply3DAudio++;
g_audioState.nFrameToApply3DAudio &= 1;
return S_OK;
}