ゲームの中には、Wwiseですぐに利用できない非常に特定のルーティングやパニングがあるものがあります。この限界を回避する一つの方法は、"speaker matrix callback" (スピーカー マトリックス コールバック) への登録です。このコールバックは、ボイスやバスが他のバスにミックスされる際に呼び出します。このコールバックから、ボイスやバスのグローバルならびにチャンネルに特化したレベルを変更できるので、ミックスやパニングの修正ができます。
以下の例では、ボイスのコールバックを登録する方法を示しています。これはこのボイスを再生するイベントをポストした際に発生します。
VoiceCallback コールバックは、そのように出力バスの特定、ボイスを出力バスにミックスする際のベースボリュームの変更、そして異なる発生角度をシミュレートするためのパニングボリュームの変更ができるかを示しています。AkSpeakerVolumeMatrixCallbackInfo::pContext は、ボイスに関連する情報を、そして AkSpeakerVolumeMatrixCallbackInfo::pMixerContext はそのボイスがミックスされるバスに関連する情報を示します (ドライ出力バスまたはAUXセンド)。
static void VoiceCallback(
)
{
AkUniqueID eventID = pVolumeCallbackInfo->eventID;
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(
)
{
cfgThreeStereo,
mxTransmix );
{
while ( uChanOut < uNumOutputChannelsToCopy )
{
vMixOut[uChanOut] = vTransmixOut[uChanOut];
++uChanOut;
}
while ( uChanOut < in_pCallbackInfo->outputConfig.uNumChannels )
{
vMixOut[uChanOut] = 0;
++uChanOut;
}
}
}
次の例は、そのメータリングデータを問い合わせるための、バスへの登録方法を示しています。
static void MeterCallback(
)
{
AkReal32 fPower = in_pMetering->GetKWeightedPower();
{
AkReal32 fChannelPeak = vTruePeak[uChannel];
...
}
...
}
AkSpeakerVolumesMatrixPtr pVolumes
Pointer to volume matrix describing the contribution of each source channel to destination channels....
struct AkChannelConfig inputConfig
Channel configuration of the voice/bus.
struct AkChannelConfig outputConfig
Channel configuration of the output bus.
virtual AkReal32 GetSpread(AkUInt32 in_uIndex)=0
AkMeteringFlags
Metering flags. Used for specifying bus metering, through AK::SoundEngine::RegisterBusVolumeCallback(...
AkReal32 * pfBaseVolume
Base volume, common to all channels.
AkMixerPluginContextPtr pMixerContext
Output mixing bus context. Use it to access a few useful panning and mixing services,...
AkUInt64 AkGameObjectID
Game object ID
AKSOUNDENGINE_API AKRESULT RegisterBusVolumeCallback(AkUniqueID in_busID, AkBusCallbackFunc in_pfnCallback, void *in_pCookie=NULL)
AkUInt32 uNumChannels
Number of channels.
AkUInt32 uChannelMask
Channel mask (configuration).
@ AK_SpeakerVolumeMatrix
Callback triggered at each frame, letting the client modify the speaker volume matrix....
AkForceInline AkUInt32 GetRequiredSize(AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
AkMixerInputContextPtr pContext
Context of the current voice/bus about to be mixed into the output bus with specified base volume and...
AkUInt32 AkUniqueID
Unique 32-bit ID
float AkReal32
32-bit floating point
virtual AKRESULT GetGameObjectPosition(AkUInt32 in_uIndex, AkSoundPosition &out_position) const =0
virtual IAkVoicePluginInfo * GetVoiceInfo()=0
virtual AkReal32 GetFocus(AkUInt32 in_uIndex)=0
AkForceInline VectorPtr GetChannel(MatrixPtr in_pVolumeMx, AkUInt32 in_uIdxChannelIn, AkUInt32 in_uNumChannelsOut)
#define AK_SPEAKER_SETUP_3STEREO
3.0 setup channel mask
virtual AkUInt32 GetNum3DPositions()=0
#define AKASSERT(Condition)
AkSpeakerVolumesVectorPtr MatrixPtr
static const AkPlayingID AK_INVALID_PLAYING_ID
Invalid playing ID
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,...
AkSpeakerVolumesConstVectorPtr ConstVectorPtr
virtual AKRESULT ComputeSpeakerVolumesDirect(AkChannelConfig in_inputConfig, AkChannelConfig in_outputConfig, AkReal32 in_fCenterPerc, AK::SpeakerVolumes::MatrixPtr out_mxVolumes)=0
@ AK_EnableBusMeter_TruePeak
Enable computation of true peak metering (most CPU and memory intensive).
AKSOUNDENGINE_API AkUInt32 GetIDFromString(const char *in_pszString)
@ AK_EnableBusMeter_KPower
Enable computation of K-weighted power metering (used as a basis for computing loudness,...
virtual IAkGameObjectPluginInfo * GetGameObjectInfo()=0
AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
Set channel config as a standard configuration specified with given channel mask.
AkCallbackType
Type of callback. Used as a bitfield in methods AK::SoundEngine::PostEvent() and AK::SoundEngine::Dyn...
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)
AkSpeakerVolumesMatrixPtr VectorPtr
AkUInt32 AkPlayingID
A unique identifier generated whenever a PostEvent is called (or when a Dynamic Sequence is created)....
あなたのプロジェクトについて教えてください。ご不明な点はありませんか。
プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。
Wwiseからはじめよう