일부 게임은 라우팅 및 패닝과 관련해 매우 특정한 요구사항이 있는데, Wwise에서 준비된 기능이 없는 경우가 있습니다. 이를 위한 해결책으로 'speaker matrix callback'에 등록하는 방법이 있습니다. 보이스나 버스가 다른 버스로 믹싱되려고 할 때 이 콜백이 호출됩니다. 이 콜백에서 전역적 또는 특정 채널에 국한된 보이스나 버스 레벨을 변경할 수 있어, 믹스나 패닝을 수정할 수 있습니다.
다음 예제는 한 보이스에 대해 콜백을 등록하는 방법을 보여줍니다. 해당 보이스를 재생하는 이벤트를 발송할 때 이런 작업이 발생합니다.
VoiceCallback 콜백은, 출력 버스를 구별해내는 방법, 보이스가 출력 버스에 믹싱돼 들어갈 때 기본 볼륨을 변경하는 방법, 그리고 패닝 볼륨을 변경해 다양한 입사각을 시뮬레이션하는 방법을 보여줍니다. AkSpeakerVolumeMatrixCallbackInfo::pContext 는 보이스와 관련 있는 정보를 나타내며, AkSpeakerVolumeMatrixCallbackInfo::pMixerContext 는 믹싱되는 버스와 관련된 정보를 나타냅니다 (dry 출력 버스, 또는 보조 센드).
static void VoiceCallback(
)
{
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(
)
{
cfgThreeStereo,
mxTransmix );
{
while ( uChanOut
{
vMixOut[uChanOut] = vTransmixOut[uChanOut];
++uChanOut;
}
while ( uChanOut outputConfig.uNumChannels )
{
vMixOut[uChanOut] = 0;
++uChanOut;
}
}
}
다음 예제는 버스에 등록해 미터링 데이터를 쿼리하는 방법을 보여줍니다.
static void MeterCallback(
)
{
AkReal32 fPower = in_pMetering->GetKWeightedPower();
for (
AkUInt32 uChannel = 0; uChannel 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...
AkGameObjectID gameObjID
Game object ID
virtual AkReal32 GetSpread(AkUInt32 in_uIndex)=0
AkReal32 * pfBaseVolume
Base volume, common to all channels.
@ AK_EnableBusMeter_KPower
Enable computation of K-weighted power metering (used as a basis for computing loudness,...
AkChannelConfig outputConfig
Channel configuration of the output bus.
AKSOUNDENGINE_API AKRESULT RegisterBusVolumeCallback(AkUniqueID in_busID, AkBusCallbackFunc in_pfnCallback, void *in_pCookie=NULL)
AkUInt32 uNumChannels
Number of channels.
AkChannelConfig inputConfig
Channel configuration of the voice/bus.
AkUInt64 AkGameObjectID
Game object ID
AkUInt32 uChannelMask
Channel mask (configuration).
AkMeteringFlags
Metering flags. Used for specifying bus metering, through AK::SoundEngine::RegisterBusVolumeCallback(...
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,...
AkCallbackType
Type of callback. Used as a bitfield in methods AK::SoundEngine::PostEvent() and AK::SoundEngine::Dyn...
float AkReal32
32-bit floating point
virtual AKRESULT GetGameObjectPosition(AkUInt32 in_uIndex, AkSoundPosition &out_position) const =0
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.
AkUInt32 AkUniqueID
Unique 32-bit ID
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.
@ AK_EnableBusMeter_TruePeak
Enable computation of true peak metering (most CPU and memory intensive).
#define AK_SPEAKER_SETUP_3STEREO
3.0 setup channel mask
virtual AkUInt32 GetNum3DPositions()=0
#define AKASSERT(Condition)
AKSOUNDENGINE_API AKRESULT RegisterBusMeteringCallback(AkUniqueID in_busID, AkBusMeteringCallbackFunc in_pfnCallback, AkMeteringFlags in_eMeteringFlags, void *in_pCookie=NULL)
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
Struct containing metering information about a buffer. Depending on when this struct is generated,...
static const AkPlayingID AK_INVALID_PLAYING_ID
Invalid playing ID
virtual AKRESULT ComputeSpeakerVolumesDirect(AkChannelConfig in_inputConfig, AkChannelConfig in_outputConfig, AkReal32 in_fCenterPerc, AK::SpeakerVolumes::MatrixPtr out_mxVolumes)=0
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
uint32_t AkUInt32
Unsigned 32-bit integer
Game object information available to plugins.
3D vector for some operations in 3D space. Typically intended only for localized calculations due to ...
AKSOUNDENGINE_API AkPlayingID PostEvent(AkUniqueID in_eventID, AkGameObjectID in_gameObjectID, AkUInt32 in_uFlags=0, AkCallbackFunc in_pfnCallback=NULL, void *in_pCookie=NULL, AkUInt32 in_cExternals=0, AkExternalSourceInfo *in_pExternalSources=NULL, AkPlayingID in_PlayingID=AK_INVALID_PLAYING_ID)
@ AK_SpeakerVolumeMatrix
Callback triggered at each frame, letting the client modify the speaker volume matrix....
AK::SpeakerVolumes::MatrixPtr pVolumes
Pointer to volume matrix describing the contribution of each source channel to destination channels....
AkUInt32 AkPlayingID
A unique identifier generated whenever a PostEvent is called (or when a Dynamic Sequence is created)....
AkPlayingID playingID
Playing ID of Event, returned by PostEvent()
const AkReal32 * ConstVectorPtr
Constant volume vector. Access each element with the standard bracket [] operator.