123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605 |
- #pragma once
- #include "AkEnvironmentIndex.h"
- #include "AkGameplayTypes.h"
- #include "AkGroupValue.h"
- #include "AkInclude.h"
- #include "WwiseUnrealDefines.h"
- #include "AkJobWorkerScheduler.h"
- #include "Wwise/WwiseSharedLanguageId.h"
- #include "Engine/EngineTypes.h"
- #include "Wwise/Stats/AkAudio.h"
- #include "Wwise/AkPortalObstructionAndOcclusionService.h"
- #include "Wwise/WwiseSoundEngineUtils.h"
- #if WITH_EDITORONLY_DATA
- #include "EditorViewportClient.h"
- #endif
- #define GET_AK_EVENT_NAME(AkEvent, EventName) ((AkEvent) ? ((AkEvent)->GetName()) : (EventName))
- DECLARE_EVENT(FAkAudioDevice, SoundbanksLoaded);
- DECLARE_EVENT(FAkAudioDevice, FOnWwiseProjectModification);
- DECLARE_EVENT_OneParam(FAkAudioDevice, FOnSwitchValueLoaded, UAkGroupValue*);
- DECLARE_DELEGATE_OneParam(FOnSetCurrentAudioCultureCompleted, bool);
- class UAkPortalComponent;
- class AkCallbackInfoPool;
- class AkLegacyFileCustomParamPolicy;
- class CAkDiskPackage;
- class FAkComponentCallbackManager;
- class FWwiseIOHook;
- class UAkComponent;
- class UAkGameObject;
- class UAkGroupValue;
- class UAkLateReverbComponent;
- class UAkRoomComponent;
- class UAkStateValue;
- class UAkSwitchValue;
- class UAkAudioType;
- class UAkAudioEvent;
- class UAkEffectShareSet;
- class AkXMLErrorMessageTranslator;
- class AkWAAPIErrorMessageTranslator;
- class AkUnrealErrorTranslator;
- typedef TSet<UAkComponent*> UAkComponentSet;
- #define DUMMY_GAMEOBJ ((AkGameObjectID)0x2)
- #define SOUNDATLOCATION_GAMEOBJ ((AkGameObjectID)0x3)
- struct AKAUDIO_API FAkAudioDeviceDelegates
- {
- DECLARE_MULTICAST_DELEGATE_TwoParams(FOnAkGlobalCallback, AK::IAkGlobalPluginContext*, AkGlobalCallbackLocation);
- };
-
- class AKAUDIO_API FAkAudioDevice final
- {
- public:
- UE_NONCOPYABLE(FAkAudioDevice);
- FAkAudioDevice() {}
-
- bool Init( void );
-
- bool Update( float DeltaTime );
-
-
- void Teardown();
-
- void StopAllSounds( bool bShouldStopUISounds = false );
-
- void StopAllSounds(EAkAudioContext AudioContext);
-
- void Flush(UWorld* WorldToFlush);
-
- bool WorldSpatialAudioVolumesUpdated(UWorld* World);
-
- void ClearSoundBanksAndMedia();
-
- AKRESULT LoadBank(
- const FString& in_BankName,
- AkBankID & out_bankID
- );
-
- AKRESULT LoadBank(
- const FString& in_BankName,
- AkBankCallbackFunc in_pfnBankCallback,
- void * in_pCookie,
- AkBankID & out_bankID
- );
-
-
- AKRESULT LoadBank(
- const FString& in_BankName,
- FWaitEndBankAction* LoadBankLatentAction
- );
-
- AKRESULT LoadBankFromMemory(
- const void* MemoryPtr,
- uint32 MemorySize,
- AkBankType BankType,
- AkBankID& OutBankID
- );
-
- AKRESULT LoadBankAsync(
- const FString& in_BankName,
- const FOnAkBankCallback& BankLoadedCallback,
- AkBankID & out_bankID
- );
-
- AKRESULT UnloadBank(
- const FString& in_BankName
- );
-
- AKRESULT UnloadBank(
- const FString& in_BankName,
- AkBankCallbackFunc in_pfnBankCallback,
- void * in_pCookie
- );
-
- AKRESULT UnloadBank(
- const FString& in_BankName,
- FWaitEndBankAction* UnloadBankLatentAction
- );
-
- AKRESULT UnloadBankFromMemory(
- AkBankID in_bankID,
- const void* in_memoryPtr
- );
-
- AKRESULT UnloadBankFromMemoryAsync(
- AkBankID in_bankID,
- const void* in_memoryPtr,
- AkBankCallbackFunc in_pfnBankCallback,
- void* in_pCookie,
- uint32 BankType
- );
-
- AKRESULT UnloadBankAsync(
- const FString& in_BankName,
- const FOnAkBankCallback& BankUnloadedCallback
- );
-
-
- static AkUInt32 GetShortIDFromString(const FString& InString);
-
- static AkUInt32 GetShortID(UAkAudioType* AudioAsset, const FString& BackupName);
-
- AKRESULT SetMedia(AkSourceSettings* in_pSourceSettings, uint32 in_uNumSourceSettings);
-
- AKRESULT TryUnsetMedia(AkSourceSettings* in_pSourceSettings, uint32 in_uNumSourceSettings, AKRESULT* out_pUnsetResults = nullptr);
-
-
- AKRESULT UnsetMedia(AkSourceSettings* in_pSourceSettings, uint32 in_uNumSourceSettings);
-
- FString GetCurrentAudioCulture() const;
-
- FString GetDefaultLanguage();
-
- TArray<FString> GetAvailableAudioCultures() const;
-
- FWwiseLanguageCookedData GetLanguageCookedDataFromString(const FString& WwiseLanguage);
-
- void SetCurrentAudioCulture(const FString& AudioCulture);
-
- void SetCurrentAudioCultureAsync(const FString& AudioCulture, FSetCurrentAudioCultureAction* LatentAction);
-
-
- void SetCurrentAudioCultureAsync(const FString& AudioCulture, const FOnSetCurrentAudioCultureCompleted& CompletedCallback);
-
- class UAkComponent* SpawnAkComponentAtLocation( class UAkAudioEvent* AkEvent, FVector Location, FRotator Orientation, bool AutoPost, const FString& EventName, bool AutoDestroy, class UWorld* in_World );
-
- AKRESULT SeekOnEvent(
- const AkUInt32 EventShortID,
- AActor* Actor,
- AkReal32 Percent,
- bool bSeekToNearestMarker = false,
- AkPlayingID PlayingID = AK_INVALID_PLAYING_ID
- );
-
- AKRESULT SeekOnEvent(
- const AkUInt32 EventShortID,
- UAkComponent* Component,
- AkReal32 Percent,
- bool bSeekToNearestMarker = false,
- AkPlayingID PlayingID = AK_INVALID_PLAYING_ID
- );
-
- AKRESULT PostTrigger(
- const TCHAR * in_pszTrigger,
- AActor * in_pActor
- );
-
- AKRESULT PostTrigger(
- class UAkTrigger const* in_TriggerValue,
- AActor * in_pActor
- );
-
- AKRESULT SetRTPCValue(
- const TCHAR * in_pszRtpcName,
- AkRtpcValue in_value,
- int32 in_interpolationTimeMs,
- AActor * in_pActor
- );
-
- AKRESULT SetRTPCValue(
- AkRtpcID in_Rtpc,
- AkRtpcValue in_value,
- int32 in_interpolationTimeMs,
- AActor * in_pActor
- );
-
- AKRESULT SetRTPCValue(
- class UAkRtpc const* in_RtpcValue,
- AkRtpcValue in_value,
- int32 in_interpolationTimeMs,
- AActor * in_pActor
- );
-
- AKRESULT SetRTPCValueByPlayingID(
- AkRtpcID in_Rtpc,
- AkRtpcValue in_value,
- AkPlayingID in_playingID,
- int32 in_interpolationTimeMs
- );
-
- AKRESULT GetRTPCValue(
- const TCHAR * in_pszRtpcName,
- AkGameObjectID in_gameObjectID,
- AkPlayingID in_playingID,
- AkRtpcValue& out_rValue,
- AK::SoundEngine::Query::RTPCValue_type& io_rValueType
- );
-
- AKRESULT GetRTPCValue(
- AkRtpcID in_Rtpc,
- AkGameObjectID in_gameObjectID,
- AkPlayingID in_playingID,
- AkRtpcValue& out_rValue,
- AK::SoundEngine::Query::RTPCValue_type& io_rValueType
- );
-
- AKRESULT GetRTPCValue(
- class UAkRtpc const* in_RtpcValue,
- AkGameObjectID in_gameObjectID,
- AkPlayingID in_playingID,
- AkRtpcValue& out_rValue,
- AK::SoundEngine::Query::RTPCValue_type& io_rValueType
- );
-
-
-
-
-
-
-
-
-
- AKRESULT ResetRTPCValue(
- const UAkRtpc* in_RtpcValue,
- AkGameObjectID in_gameObjectID,
- int32 in_interpolationTimeMs
- );
-
-
-
-
-
-
-
-
-
- AKRESULT ResetRTPCValue(
- AkRtpcID in_rtpcID,
- AkGameObjectID in_gameObjectID,
- int32 in_interpolationTimeMs
- );
-
-
-
-
-
-
-
-
-
- AKRESULT ResetRTPCValue(
- const TCHAR * in_pszRtpcName,
- AkGameObjectID in_gameObjectID,
- int32 in_interpolationTimeMs
- );
-
- AKRESULT SetState(
- const TCHAR* in_pszStateGroup,
- const TCHAR* in_pszState
- );
-
- AKRESULT SetState(
- AkStateGroupID in_StateGroup,
- AkStateID in_State
- );
-
- AKRESULT SetState(
- const UAkStateValue* in_stateValue
- );
-
-
- AKRESULT SetSwitch(
- const TCHAR * in_pszSwitchGroup,
- const TCHAR * in_pszSwitchState,
- AActor * in_pActor
- );
-
- AKRESULT SetSwitch(
- AkSwitchGroupID in_SwitchGroup,
- AkSwitchStateID in_SwitchState,
- AActor* in_pActor
- );
-
-
- AKRESULT SetSwitch(
- const UAkSwitchValue* in_switchValue,
- AActor * in_pActor
- );
-
- AKRESULT SetMultiplePositions(
- UAkComponent* in_pGameObjectAkComponent,
- TArray<FTransform> in_aPositions,
- AkMultiPositionType in_eMultiPositionType = AkMultiPositionType::MultiDirections
- );
-
- AKRESULT SetMultiplePositions(
- UAkComponent* in_pGameObjectAkComponent,
- const TArray<AkChannelConfiguration>& in_aChannelConfigurations,
- const TArray<FTransform>& in_aPositions,
- AkMultiPositionType in_eMultiPositionType = AkMultiPositionType::MultiDirections
- );
-
- AKRESULT SetMultiplePositions(
- UAkComponent* in_pGameObjectAkComponent,
- const TArray<FAkChannelMask>& in_channelMasks,
- const TArray<FTransform>& in_aPositions,
- AkMultiPositionType in_eMultiPositionType = AkMultiPositionType::MultiDirections
- );
-
- AKRESULT SetMultiplePositions(
- AkGameObjectID in_GameObjectID,
- const AkSoundPosition * in_pPositions,
- AkUInt16 in_NumPositions,
- AK::SoundEngine::MultiPositionType in_eMultiPositionType = AK::SoundEngine::MultiPositionType_MultiDirections
- );
-
- AKRESULT SetMultiplePositions(
- AkGameObjectID in_GameObjectID,
- const AkChannelEmitter * in_pPositions,
- AkUInt16 in_NumPositions,
- AK::SoundEngine::MultiPositionType in_eMultiPositionType = AK::SoundEngine::MultiPositionType_MultiDirections
- );
-
- AKRESULT SetAuxSends(
- const UAkComponent* in_akComponent,
- TArray<AkAuxSendValue>& in_AuxSendValues
- );
-
- AKRESULT SetInSpatialAudioRoom(
- const AkGameObjectID in_GameObjId,
- AkRoomID in_RoomID
- );
-
- AKRESULT SetBusConfig(
- const FString& in_BusName,
- AkChannelConfig in_Config
- );
-
- AKRESULT SetPanningRule(
- AkPanningRule in_ePanningRule
- );
-
- AkOutputDeviceID GetOutputID(
- const FString& in_szShareSet,
- AkUInt32 in_idDevice = 0
- );
-
- AKRESULT ReplaceMainOutput(const AkOutputSettings& MainOutputSettings);
-
- AKRESULT GetSpeakerAngles(
- TArray<AkReal32>& io_pfSpeakerAngles,
- AkReal32& out_fHeightAngle,
- AkOutputDeviceID in_idOutput = 0
- );
-
- AKRESULT SetSpeakerAngles(
- const TArray<AkReal32>& in_pfSpeakerAngles,
- AkReal32 in_fHeightAngle,
- AkOutputDeviceID in_idOutput = 0
- );
-
- AKRESULT SetGameObjectOutputBusVolume(
- const UAkComponent* in_pEmitter,
- const UAkComponent* in_pListener,
- float in_fControlValue
- );
-
- FDelegateHandle RegisterGlobalCallback(FAkAudioDeviceDelegates::FOnAkGlobalCallback::FDelegate Callback, AkGlobalCallbackLocation Location);
-
- void UnregisterGlobalCallback(FDelegateHandle Handle, AkGlobalCallbackLocation Location);
-
- AKRESULT RegisterOutputDeviceMeteringCallback(AkOutputDeviceID OutputID,
- AkOutputDeviceMeteringCallbackFunc Callback,
- AkMeteringFlags MeteringFlags,
- void* Cookie);
-
- AKRESULT UnregisterOutputDeviceMeteringCallback(AkOutputDeviceID OutputID);
-
- static FAkAudioDevice* Get();
-
- static bool IsInitialized() { return m_bSoundEngineInitialized; }
-
- AkUInt32 GetSampleRate();
-
- AKRESULT SetOfflineRendering(bool bEnable);
-
- AKRESULT SetOfflineRenderingFrameTime(AkReal32 FrameTimeInSeconds);
-
- AKRESULT RegisterCaptureCallback(AkCaptureCallbackFunc Callback, AkOutputDeviceID OutputId = AK_INVALID_OUTPUT_DEVICE_ID, void* Cookie = nullptr);
-
- AKRESULT UnregisterCaptureCallback(AkCaptureCallbackFunc Callback, AkOutputDeviceID OutputId = AK_INVALID_OUTPUT_DEVICE_ID, void* Cookie = nullptr);
-
- void StopGameObject(UAkComponent * in_pComponent);
-
- void StopPlayingID( AkPlayingID in_playingID,
- AkTimeMs in_uTransitionDuration = 0,
- AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear);
-
- void RegisterComponent(UAkComponent * in_pComponent);
-
- void RegisterComponent(AkGameObjectID GameObjectID);
-
- void UnregisterComponent(UAkComponent * in_pComponent);
-
- void UnregisterComponent(AkGameObjectID GameObjectID);
-
-
- AKRESULT SetGeometry(AkGeometrySetID GeometrySetID, const AkGeometryParams& Params);
-
- AKRESULT SetGeometryInstance(AkGeometryInstanceID GeometryInstanceID, const AkGeometryInstanceParams& Params);
-
- AKRESULT RemoveGeometrySet(AkGeometrySetID GeometrySetID);
-
- AKRESULT RemoveGeometryInstance(AkGeometryInstanceID GeometryInstanceID);
-
- AKRESULT SetEarlyReflectionsAuxBus(UAkComponent* in_pComponent, const AkUInt32 AuxBusID);
-
- AKRESULT SetEarlyReflectionsVolume(UAkComponent* in_pComponent, float in_fSendVolume);
-
- AKRESULT SetReflectionsOrder(int Order, bool RefreshPaths);
-
- AKRESULT SetObjectObstructionAndOcclusion(AkGameObjectID in_Object, AkGameObjectID in_listener, AkReal32 Obstruction, AkReal32 Occlusion);
-
- AKRESULT SetMultipleObstructionAndOcclusion(AkGameObjectID in_Object, AkGameObjectID in_listener, AkObstructionOcclusionValues* ObstructionAndOcclusionValues, AkUInt32 in_uNumObstructionAndOcclusion);
-
- AKRESULT SetPortalObstructionAndOcclusion(const UAkPortalComponent* in_pPortal, float in_fObstructionValue, float in_fOcclusionValue);
-
- AKRESULT SetGameObjectToPortalObstruction(const UAkComponent* in_pComponent, const UAkPortalComponent* in_pPortal, float in_fObstructionValue);
-
- AKRESULT SetPortalToPortalObstruction(const UAkPortalComponent* in_pPortal0, const UAkPortalComponent* in_pPortal1, float in_fObstructionValue);
-
- AKRESULT SetOutputDeviceEffect(AkOutputDeviceID InDeviceID, AkUInt32 InFXIndex, AkUniqueID InFXShareSetID);
-
- AKRESULT SetBusEffect(const FString& InBusName, AkUInt32 InFXIndex, AkUniqueID InFXShareSetID);
-
- AKRESULT SetBusEffect(AkUniqueID InBusID, AkUInt32 InFXIndex, AkUniqueID InFXShareSetID);
-
- AKRESULT SetActorMixerEffect(AkUniqueID InAudioNodeID, AkUInt32 InFXIndex, AkUniqueID InShareSetID);
- AKRESULT SetActorMixerEffect(const FString& InBusName, AkUInt32 InFXIndex, AkUniqueID InFXShareSetID);
-
- static class UAkComponent* GetAkComponent(
- class USceneComponent* AttachToComponent, FName AttachPointName, const FVector * Location, EAttachLocation::Type LocationType);
- static class UAkComponent* GetAkComponent(
- class USceneComponent* AttachToComponent, FName AttachPointName, const FVector * Location, EAttachLocation::Type LocationType, bool& ComponentCreated);
-
- void CancelEventCallbackCookie(void* in_cookie);
- void CancelEventCallbackDelegate(const FOnAkPostEventCallback& in_Delegate);
-
- AKRESULT SetAttenuationScalingFactor(AActor* Actor, float ScalingFactor);
-
- AKRESULT SetAttenuationScalingFactor(UAkComponent* AkComponent, float ScalingFactor);
-
- AKRESULT SetDistanceProbe(UAkComponent* Listener, UAkComponent* DistanceProbe);
-
- void StartOutputCapture(const FString& Filename);
-
- void AddOutputCaptureMarker(const FString& MarkerText);
-
- void StopOutputCapture();
-
- void StartProfilerCapture(const FString& Filename);
-
- void StopProfilerCapture();
-
- AKRESULT RegisterPluginDLL(const FString& in_DllName, const FString& in_DllPath);
-
- FString GetBasePath();
-
- void Suspend(bool in_bRenderAnyway = false);
-
- void WakeupFromSuspend();
-
- FOnWwiseProjectModification OnWwiseProjectModification;
- static inline void FVectorToAKVector( const FVector & in_vect, AkVector & out_vect )
- {
- #if UE_5_0_OR_LATER
- checkf(in_vect.X <= FLT_MAX && in_vect.Y <= FLT_MAX && in_vect.Z <= FLT_MAX, TEXT("FVectorToAKVector: Data truncation when converting from FVector to AkVector."));
- #endif
- out_vect.X = in_vect.X;
- out_vect.Y = in_vect.Y;
- out_vect.Z = in_vect.Z;
- }
- static inline AkVector FVectorToAKVector(const FVector& in_vect)
- {
- #if UE_5_0_OR_LATER
- checkf(in_vect.X <= FLT_MAX && in_vect.Y <= FLT_MAX && in_vect.Z <= FLT_MAX, TEXT("FVectorToAKVector: Data truncation when converting from FVector to AkVector."));
- #endif
- return AkVector{ (float)in_vect.X, (float)in_vect.Y, (float)in_vect.Z };
- }
- static inline void FVectorToAKVector64( const FVector & in_vect, AkVector64 & out_vect )
- {
- out_vect.X = in_vect.X;
- out_vect.Y = in_vect.Y;
- out_vect.Z = in_vect.Z;
- }
-
- static inline AkVector64 FVectorToAKVector64(const FVector& in_vect)
- {
- return AkVector64{ in_vect.X, in_vect.Y, in_vect.Z };
- }
- static inline AkExtent FVectorToAkExtent(const FVector& in_vect)
- {
- #if UE_5_0_OR_LATER
- checkf(in_vect.X <= FLT_MAX && in_vect.Y <= FLT_MAX && in_vect.Z <= FLT_MAX, TEXT("FVectorToAkExtent: Data truncation when converting from FVector to AkExtent."));
- #endif
-
- return AkExtent{ (float)in_vect.Y, (float)in_vect.Z, (float)in_vect.X };
- }
- static inline void FVectorsToAKWorldTransform(const FVector& in_Position, const FVector& in_Front, const FVector& in_Up, AkWorldTransform& out_AkTransform)
- {
-
- out_AkTransform.Set(FVectorToAKVector64(in_Position), FVectorToAKVector(in_Front), FVectorToAKVector(in_Up));
- }
- static inline void AKVectorToFVector(const AkVector & in_vect, FVector & out_vect)
- {
- out_vect.X = in_vect.X;
- out_vect.Y = in_vect.Y;
- out_vect.Z = in_vect.Z;
- }
- static inline FVector AKVectorToFVector(const AkVector& in_vect)
- {
- return FVector(in_vect.X, in_vect.Y, in_vect.Z);
- }
-
- static inline void AKVector64ToFVector(const AkVector64 & in_vect, FVector & out_vect)
- {
- out_vect.X = (float)in_vect.X;
- out_vect.Y = (float)in_vect.Y;
- out_vect.Z = (float)in_vect.Z;
- }
-
- static inline FVector AKVector64ToFVector(const AkVector64& in_vect)
- {
- return FVector((float)in_vect.X, (float)in_vect.Y, (float)in_vect.Z);
- }
- FAkJobWorkerScheduler* GetAkJobWorkerScheduler() { return &AkJobWorkerScheduler; }
- uint8 GetMaxAuxBus() const { return MaxAuxBus; }
- AkCallbackInfoPool* GetAkCallbackInfoPool()
- {
- return CallbackInfoPool;
- }
-
- #if WITH_EDITOR
- void SetMaxAuxBus(uint8 ValToSet) { MaxAuxBus = ValToSet; }
- #endif
- static const int32 FIND_COMPONENTS_DEPTH_INFINITE = -1;
-
- TArray<class UAkLateReverbComponent*> FindLateReverbComponentsAtLocation(const FVector& Loc, const UWorld* in_World);
-
- void IndexLateReverb(class UAkLateReverbComponent* ComponentToAdd);
-
- void UnindexLateReverb(class UAkLateReverbComponent* ComponentToRemove);
-
- void ReindexLateReverb(class UAkLateReverbComponent* ComponentToAdd);
-
- bool WorldHasActiveRooms(UWorld* World);
-
- TArray<class UAkRoomComponent*> FindRoomComponentsAtLocation(const FVector& Loc, const UWorld* World);
-
- bool UsingSpatialAudioRooms(const UWorld* World);
-
- void GetAuxSendValuesAtLocation(FVector Loc, TArray<AkAuxSendValue>& AkAuxSendValues, const UWorld* in_World);
-
- void UpdateAllSpatialAudioPortals(UWorld* InWorld);
-
-
- void PortalsNeedRoomUpdate(UWorld* World) { WorldsInNeedOfPortalRoomsUpdate.Add(World); }
-
- void SetSpatialAudioPortal(UAkPortalComponent* in_Portal);
-
-
- void RemoveSpatialAudioPortal(UAkPortalComponent* in_Portal);
-
- void OnActorSpawned(AActor* SpawnedActor);
- UAkComponentSet& GetDefaultListeners() { return m_defaultListeners; }
- void SetListeners(UAkComponent* in_pEmitter, const TArray<UAkComponent*>& in_listenerSet);
- void AddDefaultListener(UAkComponent* in_pListener);
- void RemoveDefaultListener(UAkComponent* in_pListener);
- void UpdateDefaultActiveListeners();
- #if WITH_EDITORONLY_DATA
- FTransform GetEditorListenerPosition(int32 ViewIndex) const;
- #endif
-
- bool SetSpatialAudioListener(UAkComponent* in_pListener);
-
-
- UAkComponent* GetSpatialAudioListener() const;
- AKRESULT SetPosition(UAkComponent* in_akComponent, const AkSoundPosition& in_SoundPosition);
-
- void IndexRoom(class UAkRoomComponent* ComponentToAdd);
-
- void UnindexRoom(class UAkRoomComponent* ComponentToRemove);
-
- void ReindexRoom(class UAkRoomComponent* ComponentToAdd);
- AKRESULT AddRoom(UAkRoomComponent* in_pRoom, const AkRoomParams& in_RoomParams);
- AKRESULT UpdateRoom(UAkRoomComponent* in_pRoom, const AkRoomParams& in_RoomParams);
- AKRESULT RemoveRoom(UAkRoomComponent* in_pRoom);
- AKRESULT SetGameObjectRadius(UAkComponent* in_akComponent, float in_outerRadius, float in_innerRadius);
- AKRESULT SetImageSource(class AAkSpotReflector* in_pSpotReflector, const AkImageSourceSettings& in_ImageSourceInfo, AkUniqueID in_AuxBusID, UAkComponent* in_AkComponent);
- AKRESULT RemoveImageSource(class AAkSpotReflector* in_pSpotReflector, AkUniqueID in_AuxBusID, UAkComponent* in_AkComponent);
- AKRESULT ClearImageSources(AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, UAkComponent* in_AkComponent = NULL);
- static void GetChannelConfig(AkChannelConfiguration ChannelConfiguration, AkChannelConfig& config);
- static void GetChannelConfig(FAkChannelMask SpeakerConfiguration, AkChannelConfig& config);
- FAkEnvironmentIndex& GetRoomIndex() { return RoomIndex; }
- void AddPortalConnectionToOutdoors(const UWorld* in_world, UAkPortalComponent* in_pPortal);
- void RemovePortalConnectionToOutdoors(const UWorld* in_world, AkPortalID in_portalID);
- void GetObsOccServicePortalMap(const UAkRoomComponent* InRoom, const UWorld* InWorld, AkObstructionAndOcclusionService::PortalMap& OutPortalMap) const;
- struct SetCurrentAudioCultureAsyncTask
- {
- enum CompletionType
- {
- LatentAction,
- Callback
- };
- FWwiseLanguageCookedData Language;
- FThreadSafeBool IsDone = false;
- FThreadSafeBool Succeeded = false;
- SetCurrentAudioCultureAsyncTask(FWwiseLanguageCookedData NewLanguage, FSetCurrentAudioCultureAction* LatentAction);
- SetCurrentAudioCultureAsyncTask(FWwiseLanguageCookedData NewLanguage, const FOnSetCurrentAudioCultureCompleted& CompletedCallback);
- bool Start();
- void Update();
- private:
- TSharedPtr<FPendingLatentActionValidityToken, ESPMode::ThreadSafe> LatentActionValidityToken;
- CompletionType CompletionActionType;
- FSetCurrentAudioCultureAction* SetAudioCultureLatentAction;
- FOnSetCurrentAudioCultureCompleted SetAudioCultureCompletedCallback;
- };
- void AddPlayingID(uint32 EventID, uint32 PlayingID, EAkAudioContext AudioContext);
- bool IsPlayingIDActive(uint32 EventID, uint32 PlayingID);
- bool IsEventIDActive(uint32 EventID);
- void RemovePlayingID(uint32 EventID, uint32 PlayingID);
- void StopEventID(uint32 EventID);
- FOnSwitchValueLoaded& GetOnSwitchValueLoaded(uint32 SwitchID);
- void BroadcastOnSwitchValueLoaded(UAkGroupValue* GroupValue);
- void SetLocalOutput();
- FAkComponentCallbackManager* GetCallbackManager() { return CallbackManager; }
- AKRESULT RegisterGameObject(AkGameObjectID GameObjectID, const FString& Name);
-
- static bool ShouldNotifySoundEngine(EWorldType::Type WorldType);
- static void LoadAudioObjectsAfterInitialization(TWeakObjectPtr<UAkAudioType>&& InAudioType);
- void LoadDelayedObjects();
- private:
- bool EnsureInitialized();
- void* AllocatePermanentMemory( int32 Size, bool& AllocatedInPool );
-
- AKRESULT GetGameObjectID(AActor * in_pActor, AkGameObjectID& io_GameObject );
- template<typename FCreateCallbackPackage>
- AkPlayingID PostEventWithCallbackPackageOnAkGameObject(
- const AkUInt32 EventShortID,
- UAkGameObject* GameObject,
- const TArray<AkExternalSourceInfo>& ExternalSources,
- FCreateCallbackPackage CreateCallbackPackage,
- EAkAudioContext AudioContext
- );
- template<typename ChannelConfig>
- AKRESULT SetMultiplePositions(
- UAkComponent* in_pGameObjectAkComponent,
- const TArray<ChannelConfig>& in_aChannelConfigurations,
- const TArray<FTransform>& in_aPositions,
- AkMultiPositionType in_eMultiPositionType
- );
-
- AKRESULT GetGameObjectID(AActor * in_pActor, AkGameObjectID& io_GameObject, bool in_bStopWhenOwnerDestroyed );
-
- void UpdateRoomsForPortals();
- #if WITH_EDITORONLY_DATA
- UAkComponent* CreateListener(UWorld* World, FEditorViewportClient* ViewportClient = nullptr);
- TArray<FTransform> ListenerTransforms;
- UAkComponent* EditorListener = nullptr;
-
- void EndPIE(const bool bIsSimulating);
- void BeginPIE(const bool bIsSimulating);
- void PausePIE(const bool bIsSimulating);
- void ResumePie(const bool bIsSimulating);
- void OnSwitchBeginPIEAndSIE(const bool bIsSimulating);
- #endif
-
- TMap<UWorld*, bool> WorldVolumesUpdatedMap;
- void SAComponentAddedRemoved(UWorld* World);
-
- FAkEnvironmentIndex LateReverbIndex;
-
- FAkEnvironmentIndex RoomIndex;
-
- TMap<UWorld*, TArray<TWeakObjectPtr<UAkPortalComponent>>> WorldPortalsMap;
- typedef WwiseUnrealHelper::AkSpatialAudioIDKeyFuncs<UAkPortalComponent*, false> PortalComponentSpatialAudioIDKeyFuncs;
- typedef TMap<AkPortalID, UAkPortalComponent*, FDefaultSetAllocator, PortalComponentSpatialAudioIDKeyFuncs> PortalComponentMap;
- TMap<const UWorld*, PortalComponentMap> OutdoorsConnectedPortals;
- void CleanupComponentMapsForWorld(UWorld* World);
- bool FindWwiseLanguage(const FString& NewAudioCulture, FString& FoundWwiseLanguage);
- void UpdateSetCurrentAudioCultureAsyncTasks();
- static bool m_bSoundEngineInitialized;
- UAkComponentSet m_defaultListeners;
- UAkComponent* m_SpatialAudioListener;
- bool m_isSuspended = false;
- uint8 MaxAuxBus;
- FAkComponentCallbackManager* CallbackManager;
- AkCallbackInfoPool* CallbackInfoPool;
- FAkJobWorkerScheduler AkJobWorkerScheduler;
- FWwiseIOHook* IOHook = nullptr;
- static bool m_EngineExiting;
-
- FDelegateHandle ProjectLoadedHandle;
- FDelegateHandle ConnectionLostHandle;
- FDelegateHandle ClientBeginDestroyHandle;
- struct FWaapiSubscriptionIds
- {
- uint64 Renamed = 0;
- uint64 PreDeleted = 0;
- uint64 ChildRemoved = 0;
- uint64 ChildAdded = 0;
- uint64 Created = 0;
- } WaapiSubscriptionIds;
- TArray<SetCurrentAudioCultureAsyncTask*> AudioCultureAsyncTasks;
- TSet<UWorld*> WorldsInNeedOfPortalRoomsUpdate;
- #if !WITH_EDITOR
- TMap<FCulturePtr, FString> CachedUnrealToWwiseCulture;
- #endif
- static FCriticalSection EventToPlayingIDMapCriticalSection;
- static TMap<uint32, TArray<uint32>> EventToPlayingIDMap;
- static TMap<uint32, EAkAudioContext> PlayingIDToAudioContextMap;
- static void PostEventAtLocationEndOfEventCallback(AkCallbackType in_eType, AkCallbackInfo* in_pCallbackInfo);
- static TMap<uint32, FOnSwitchValueLoaded> OnSwitchValueLoadedMap;
- static TArray<TWeakObjectPtr<UAkAudioType>> AudioObjectsToLoadAfterInitialization;
- #if WITH_EDITORONLY_DATA
- #ifndef AK_OPTIMIZED
- static AkErrorMessageTranslator* m_UnrealErrorTranslator;
- #if AK_SUPPORT_WAAPI
- static AkWAAPIErrorMessageTranslator m_waapiErrorMessageTranslator;
- #endif
- #endif
- #endif
- };
|