本文整理汇总了C++中fmod::DSP::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ DSP::getType方法的具体用法?C++ DSP::getType怎么用?C++ DSP::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::DSP
的用法示例。
在下文中一共展示了DSP::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateInteriorVolumes
// Taken mostly from ActiveSound.cpp
void UFMODAudioComponent::UpdateInteriorVolumes()
{
// Result of the ambient calculations to apply to the instance
float AmbientVolumeMultiplier = 1.0f;
float AmbientHighFrequencyGain = 1.0f;
FInteriorSettings Ambient;
const FVector& Location = GetOwner()->GetTransform().GetTranslation();
AAudioVolume* AudioVolume = GetWorld()->GetAudioSettings(Location, NULL, &Ambient);
const FFMODListener& Listener = IFMODStudioModule::Get().GetNearestListener(Location);
if( InteriorLastUpdateTime < Listener.InteriorStartTime )
{
SourceInteriorVolume = CurrentInteriorVolume;
SourceInteriorLPF = CurrentInteriorLPF;
InteriorLastUpdateTime = FApp::GetCurrentTime();
}
bool bAllowSpatialization = true;
if( Listener.Volume == AudioVolume || !bAllowSpatialization )
{
// Ambient and listener in same ambient zone
CurrentInteriorVolume = ( SourceInteriorVolume * ( 1.0f - Listener.InteriorVolumeInterp ) ) + Listener.InteriorVolumeInterp;
AmbientVolumeMultiplier *= CurrentInteriorVolume;
CurrentInteriorLPF = ( SourceInteriorLPF * ( 1.0f - Listener.InteriorLPFInterp ) ) + Listener.InteriorLPFInterp;
AmbientHighFrequencyGain *= CurrentInteriorLPF;
//UE_LOG(LogFMOD, Verbose, TEXT( "Ambient in same volume. Volume *= %g LPF *= %g" ), CurrentInteriorVolume, CurrentInteriorLPF);
}
else
{
// Ambient and listener in different ambient zone
if( Ambient.bIsWorldSettings )
{
// The ambient sound is 'outside' - use the listener's exterior volume
CurrentInteriorVolume = ( SourceInteriorVolume * ( 1.0f - Listener.ExteriorVolumeInterp ) ) + ( Listener.InteriorSettings.ExteriorVolume * Listener.ExteriorVolumeInterp );
AmbientVolumeMultiplier *= CurrentInteriorVolume;
CurrentInteriorLPF = ( SourceInteriorLPF * ( 1.0f - Listener.ExteriorLPFInterp ) ) + ( Listener.InteriorSettings.ExteriorLPF * Listener.ExteriorLPFInterp );
AmbientHighFrequencyGain *= CurrentInteriorLPF;
//UE_LOG(LogFMOD, Verbose, TEXT( "Ambient in diff volume, ambient outside. Volume *= %g LPF *= %g" ), CurrentInteriorVolume, CurrentInteriorLPF);
}
else
{
// The ambient sound is 'inside' - use the ambient sound's interior volume multiplied with the listeners exterior volume
CurrentInteriorVolume = (( SourceInteriorVolume * ( 1.0f - Listener.InteriorVolumeInterp ) ) + ( Ambient.InteriorVolume * Listener.InteriorVolumeInterp ))
* (( SourceInteriorVolume * ( 1.0f - Listener.ExteriorVolumeInterp ) ) + ( Listener.InteriorSettings.ExteriorVolume * Listener.ExteriorVolumeInterp ));
AmbientVolumeMultiplier *= CurrentInteriorVolume;
CurrentInteriorLPF = (( SourceInteriorLPF * ( 1.0f - Listener.InteriorLPFInterp ) ) + ( Ambient.InteriorLPF * Listener.InteriorLPFInterp ))
* (( SourceInteriorLPF * ( 1.0f - Listener.ExteriorLPFInterp ) ) + ( Listener.InteriorSettings.ExteriorLPF * Listener.ExteriorLPFInterp ));
AmbientHighFrequencyGain *= CurrentInteriorLPF;
//UE_LOG(LogFMOD, Verbose, TEXT( "Ambient in diff volume, ambient inside. Volume *= %g LPF *= %g" ), CurrentInteriorVolume, CurrentInteriorLPF);
}
}
StudioInstance->setVolume(AmbientVolumeMultiplier);
FMOD::ChannelGroup* ChanGroup = nullptr;
StudioInstance->getChannelGroup(&ChanGroup);
if (ChanGroup)
{
int NumDSP = 0;
ChanGroup->getNumDSPs(&NumDSP);
for (int Index=0; Index<NumDSP; ++Index)
{
FMOD::DSP* ChanDSP = nullptr;
ChanGroup->getDSP(Index, &ChanDSP);
if (ChanDSP)
{
FMOD_DSP_TYPE DSPType = FMOD_DSP_TYPE_UNKNOWN;
ChanDSP->getType(&DSPType);
if (DSPType == FMOD_DSP_TYPE_LOWPASS || DSPType == FMOD_DSP_TYPE_LOWPASS_SIMPLE)
{
static float MAX_FREQUENCY = 8000.0f;
float Frequency = MAX_FREQUENCY * AmbientHighFrequencyGain;
ChanDSP->setParameterFloat(FMOD_DSP_LOWPASS_CUTOFF, MAX_FREQUENCY * AmbientHighFrequencyGain);
break;
}
}
}
}
}