本文整理汇总了C++中FAkAudioDevice::PostEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ FAkAudioDevice::PostEvent方法的具体用法?C++ FAkAudioDevice::PostEvent怎么用?C++ FAkAudioDevice::PostEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FAkAudioDevice
的用法示例。
在下文中一共展示了FAkAudioDevice::PostEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostEvent
void UAkGameplayStatics::PostEvent(class UAkAudioEvent* in_pAkEvent, class AActor* in_pActor, bool in_stopWhenAttachedToDestroyed, FString EventName)
{
if (in_pAkEvent == NULL && EventName.IsEmpty())
{
UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEvent: No Event specified!"));
return;
}
if ( in_pActor == NULL )
{
UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEvent: NULL Actor specified!"));
return;
}
FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get();
UWorld* CurrentWorld = in_pActor->GetWorld();
if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice )
{
if (in_pAkEvent != NULL)
{
AkAudioDevice->PostEvent(in_pAkEvent, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed);
}
else
{
AkAudioDevice->PostEvent(EventName, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed);
}
}
}
示例2: UpdateTrack
void UInterpTrackAkAudioEvent::UpdateTrack(float NewPosition, UInterpTrackInst* TrInst, bool bJump)
{
if (Events.Num() <= 0)
{
//UE_LOG(LogMatinee, Warning,TEXT("No sounds for sound track %s"),*GetName());
return;
}
UInterpTrackInstAkAudioEvent* EventInst = CastChecked<UInterpTrackInstAkAudioEvent>(TrInst);
// Only play AkEvents if we are playing Matinee forwards, and
if(NewPosition > EventInst->LastUpdatePosition && !bJump)
{
// Find which sound we are starting in. -1 Means before first sound.
int32 StartEventIdx = -1;
for( StartEventIdx = -1; StartEventIdx<Events.Num()-1 && Events[StartEventIdx+1].Time < EventInst->LastUpdatePosition; StartEventIdx++);
// Find which sound we are ending in. -1 Means before first sound.
int32 EndEventIdx = -1;
for( EndEventIdx = -1; EndEventIdx<Events.Num()-1 && Events[EndEventIdx+1].Time < NewPosition; EndEventIdx++);
// If we have moved into a new sound, we should start playing it now.
if(StartEventIdx != EndEventIdx)
{
FAkAudioEventTrackKey & AkEvenTrackKey = GetAkEventTrackKeyAtPosition(NewPosition);
UAkAudioEvent* AkEvent = AkEvenTrackKey.AkAudioEvent;
AActor* Actor = TrInst->GetGroupActor();
FAkAudioDevice * AudioDevice = FAkAudioDevice::Get();
if (AudioDevice)
{
if (AkEvent)
{
AudioDevice->PostEvent(AkEvent, Actor);
}
else
{
AudioDevice->PostEvent(AkEvenTrackKey.EventName, Actor);
}
}
}
}
// Finally update the current position as the last one.
EventInst->LastUpdatePosition = NewPosition;
}
示例3: PostEventByName
void UAkGameplayStatics::PostEventByName(const FString& EventName, class AActor* in_pActor, bool in_stopWhenAttachedToDestroyed)
{
if ( in_pActor == NULL )
{
UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEventByName: NULL Actor specified!"));
return;
}
FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get();
UWorld* CurrentWorld = in_pActor->GetWorld();
if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice )
{
AkAudioDevice->PostEvent(EventName, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed);
}
}