You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- changing GetDuration(), IsLooping(), and IsOneShot() to be const for better consistency on API (const-cast the one case that is not const for caching data) - Renaming SoundCue param in GameplayCueNotify for sounds to Sound since it's not a SoundCue. #rb Rob.Gay, Maxwell.Hayes #jira UE-138532 #preflight https://horde.devtools.epicgames.com/job/61e73d73b56c33b8ecfadb1a #p4v-preflight-copy 18647645 #ROBOMERGE-AUTHOR: aaron.mcleran #ROBOMERGE-SOURCE: CL 18650552 in //UE5/Release-5.0/... via CL 18650576 via CL 18650607 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592) [CL 18650642 by aaron mcleran in ue5-main branch]
65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "Sound/SoundSourceBus.h"
|
|
#include "AudioDeviceManager.h"
|
|
#include "EngineGlobals.h"
|
|
#include "Engine/Engine.h"
|
|
#include "UObject/UObjectIterator.h"
|
|
#include "ActiveSound.h"
|
|
|
|
USoundSourceBus::USoundSourceBus(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
// This is a bus. This will result in the decompression type to be set as DTYPE_Bus. Audio won't be generated from this object but from instance data in audio mixer.
|
|
bIsSourceBus = true;
|
|
|
|
Init();
|
|
}
|
|
|
|
void USoundSourceBus::PostLoad()
|
|
{
|
|
Super::PostLoad();
|
|
|
|
Init();
|
|
}
|
|
|
|
void USoundSourceBus::Init()
|
|
{
|
|
// Allow users to manually set the source bus duration
|
|
Duration = GetDuration();
|
|
|
|
// This sound wave is looping if the source bus duration is 0.0f
|
|
bLooping = (SourceBusDuration == 0.0f);
|
|
|
|
// Set the channels equal to the users channel count choice
|
|
switch (SourceBusChannels)
|
|
{
|
|
case ESourceBusChannels::Mono:
|
|
NumChannels = 1;
|
|
break;
|
|
|
|
case ESourceBusChannels::Stereo:
|
|
NumChannels = 2;
|
|
break;
|
|
}
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
void USoundSourceBus::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
|
{
|
|
Init();
|
|
}
|
|
#endif
|
|
|
|
bool USoundSourceBus::IsPlayable() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
float USoundSourceBus::GetDuration() const
|
|
{
|
|
return (SourceBusDuration > 0.0f) ? SourceBusDuration : INDEFINITELY_LOOPING_DURATION;
|
|
}
|
|
|