某些游戏对信号通路和声像平移有非常特殊的要求,而 Wwise 中可能无法满足这些要求。解决此限制的一种方法是注册到“Speaker Matrix Callback”(扬声器矩阵回调)。当 voice(声部)或总线将混入到另一条总线时,将调用此回调。通过此回调,您可以更改全局的和声道专用的声部或总线电平,从而修改混音或声像平移。
下面示例显示您可以如何为声部注册到此回调。注册是在发送播放此声部的事件时完成的。
‘AK::SoundEngine::PostEvent( AK::EVENTS::PLAY_HELLO, GAME_OBJECT_HUMAN, AK_SpeakerVolumeMatrix, VoiceCallback );
VoiceCallback 回调描述如何识别输出总线,更改声部混入输出总线时的基础音量,以及更改声像平移音量来模拟不同的入射角。AkSpeakerVolumeMatrixCallbackInfo::pContext 暴露出声部相关信息,而 AkSpeakerVolumeMatrixCallbackInfo::pMixerContext 暴露出声部混入的总线相关信息(干信号的输出总线或辅助发送)。
static void VoiceCallback(
AkCallbackType in_eType,
)
{
AKASSERT( in_eType == AK_SpeakerVolumeMatrix );
AkUniqueID eventID = pVolumeCallbackInfo->
eventID;
AkGameObjectID objID = pVolumeCallbackInfo->
gameObjID;
AkPlayingID playingID = pVolumeCallbackInfo->
playingID;
AKASSERT( eventID == AK::EVENTS::PLAY_HELLO );
return;
if ( uNumPosition > 0 )
{
if (pBusObject)
{
listenerTop.
X = -listenerTop.
X;
listenerTop.
Y = -listenerTop.
Y;
listenerTop.
Z = -listenerTop.
Z;
posEmitter,
posListener,
);
}
}
}
以下示例显示如何注册到总线回调。在本例中,AkSpeakerVolumeMatrixCallbackInfo::pContext 暴露出总线相关信息,我们要将("My_Bus")注册到这条总线,而 AkSpeakerVolumeMatrixCallbackInfo::pMixerContext 也对总线的父总线(或信号链中的下一条混音总线)暴露出总线相关信息,该总线是要将信号混音进去的总线。
static void BusCallback(
)
{
AKASSERT( in_pCallbackInfo->
playingID == AK_INVALID_PLAYING_ID );
cfgThreeStereo.
SetStandard( AK_SPEAKER_SETUP_3STEREO );
cfgThreeStereo,
mxTransmix );
AkUInt32 uNumOutputChannelsToCopy = cfgThreeStereoANDBus.
uNumChannels;
{
AkUInt32 uChanOut = 0;
while ( uChanOut < uNumOutputChannelsToCopy )
{
vMixOut[uChanOut] = vTransmixOut[uChanOut];
++uChanOut;
}
while ( uChanOut < in_pCallbackInfo->outputConfig.uNumChannels )
{
vMixOut[uChanOut] = 0;
++uChanOut;
}
}
}
下一示例显示如何注册到总线以查询它的电平表数据。
static void MeterCallback(
AkMeteringFlags in_eMeteringFlags
)
{
AKASSERT( ( in_eMeteringFlags & AK_EnableBusMeter_TruePeak ) && ( in_eMeteringFlags & AK_EnableBusMeter_KPower ) );
for ( AkUInt32 uChannel = 0; uChannel < in_channelConfig.
uNumChannels; uChannel++ )
{
AkReal32 fChannelPeak = vTruePeak[uChannel];
...
}
...
}
AK::IAkMixerInputContext * pContext
Context of the current voice/bus about to be mixed into the output bus with specified base volume and...
Interface to retrieve metering information about a buffer.
AkGameObjectID gameObjID
Game object ID
virtual AkReal32 GetSpread(AkUInt32 in_uIndex)=0
AkReal32 * pfBaseVolume
Base volume, common to all channels.
AkChannelConfig outputConfig
Channel configuration of the output bus.
AkUInt32 uNumChannels
Number of channels.
AkChannelConfig inputConfig
Channel configuration of the voice/bus.
virtual AkReal32 GetKWeightedPower()=0
AkUInt32 uChannelMask
Channel mask (configuration).
AkForceInline AkUInt32 GetRequiredSize(AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Compute size (in bytes) required for given channel configurations.
AK::IAkMixerPluginContext * pMixerContext
Output mixing bus context. Use it to access a few useful panning and mixing services,...
virtual AKRESULT GetGameObjectPosition(AkUInt32 in_uIndex, AkSoundPosition &out_position) const =0
AKSOUNDENGINE_API AKRESULT RegisterBusMeteringCallback(AkUniqueID in_busID, AkBusMeteringCallbackFunc in_pfnCallback, AkMeteringFlags in_eMeteringFlags)
AkUniqueID eventID
Unique ID of Event, passed to PostEvent()
virtual IAkVoicePluginInfo * GetVoiceInfo()=0
AkReal32 * VectorPtr
Volume vector. Access each element with the standard bracket [] operator.
virtual AK::SpeakerVolumes::ConstVectorPtr GetTruePeak()=0
virtual AkReal32 GetFocus(AkUInt32 in_uIndex)=0
AkForceInline VectorPtr GetChannel(MatrixPtr in_pVolumeMx, AkUInt32 in_uIdxChannelIn, AkUInt32 in_uNumChannelsOut)
Get pointer to volume distribution for input channel in_uIdxChannelIn.
virtual AkUInt32 GetNum3DPositions()=0
AkReal32 * pfEmitterListenerVolume
Emitter-listener pair-specific gain. When there are multiple emitter-listener pairs,...
virtual AKRESULT Compute3DPositioning(AkReal32 in_fAngle, AkReal32 in_fElevation, AkReal32 in_fSpread, AkReal32 in_fFocus, AkChannelConfig in_inputConfig, AkChannelMask in_uInputChanSel, AkChannelConfig in_outputConfig, AkReal32 in_fCenterPerc, AK::SpeakerVolumes::MatrixPtr out_mxVolumes)=0
virtual AkUniqueID GetBusID()=0
virtual AKRESULT ComputeSpeakerVolumesDirect(AkChannelConfig in_inputConfig, AkChannelConfig in_outputConfig, AkReal32 in_fCenterPerc, AK::SpeakerVolumes::MatrixPtr out_mxVolumes)=0
Compute a direct speaker assignment volume matrix with proper downmixing rules between two channel co...
AKSOUNDENGINE_API AkUInt32 GetIDFromString(const char *in_pszString)
virtual IAkGameObjectPluginInfo * GetGameObjectInfo()=0
AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
Set channel config as a standard configuration specified with given channel mask.
AkReal32 * MatrixPtr
Volume matrix. Access each input channel vector with AK::SpeakerVolumes::Matrix::GetChannel().
virtual AkReal32 GetCenterPerc()=0
Game object information available to plugins.
AK::SpeakerVolumes::MatrixPtr pVolumes
Pointer to volume matrix describing the contribution of each source channel to destination channels....
AkPlayingID playingID
Playing ID of Event, returned by PostEvent()
const AkReal32 * ConstVectorPtr
Constant volume vector. Access each element with the standard bracket [] operator.
AKSOUNDENGINE_API AKRESULT RegisterBusVolumeCallback(AkUniqueID in_busID, AkBusCallbackFunc in_pfnCallback)
介绍一下自己的项目。我们会竭力为您提供帮助。
来注册自己的项目,我们帮您快速入门,不带任何附加条件!
开始 Wwise 之旅