Hey folks!
So I'm trying to crowbar in multi position emitters to our existing engine I have the base implementation set up and working, but I'm having a little trouble with occlusion. Our engine works by applying an RTPC based on the occlusion zone the game object is in; this obviously isn't going to work for multi position game objects as I could have a point in an occlusion zone, and another outside.So I'm trying to use the AK_SpeakerVolumeMatrix callback to fake occlusion:
AkSpeakerVolumeMatrixCallbackInfo* info = reinterpret_cast<AkSpeakerVolumeMatrixCallbackInfo*>( callbackInfo );
if( info == nullptr )
{
break;
}
// set up the speaker volumes event and broadcast the (in my test case, 2)
int numPoints = info->pContext->GetNum3DPositions();
// initialize the event that retrieves the occlusion values
speakerVolumeEvent->SetPlaylistData( ndSoundHandle(info->playingID), info->gameObjID, numPoints );
// broadcast the event and retrieve the occlusion values (in my test case, [0.0f, 1.0f])
vector<ndFloat> occlusionValues = speakerVolumeEvent->GetPointOcclusionValues();
AkEmitterListenerPair emitterListenerPair;
for( ndU32 i = 0; i < numPoints; ++i )
{
info->pContext->Get3DPosition( i, emitterListenerPair );
emitterListenerPair.fDryMixGain = 1.0f - occlusionValues[i];
emitterListenerPair.fGameDefAuxMixGain = 1.0f - occlusionValues[i];
emitterListenerPair.fUserDefAuxMixGain = 1.0f - occlusionValues[i];
emitterListenerPair.fOcclusion = occlusionValues[i];
if( occlusionValues[i] > 0.0f )
{
emitterListenerPair.fDistance *= 1000.0f;
}
}
In my test case I have one game object in an occlusion zone, and one outside it - so I set the occluded game object's occlusion value to 1.0f, and the other to 0.0f. But no matter how I adjust the emitter-listener pairs it doesn't seem to make a difference to the final output volume.
Is it possible to control an individual point's volume?
Cheers!
/Oliver