1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954 |
- #ifndef _IAK_PLUGIN_H_
- #define _IAK_PLUGIN_H_
- #include <AK/SoundEngine/Common/AkCommonDefs.h>
- #include <AK/SoundEngine/Common/IAkRTPCSubscriber.h>
- #include <AK/SoundEngine/Common/IAkPluginMemAlloc.h>
- #include <AK/SoundEngine/Common/AkFPUtilities.h>
- #include <AK/Tools/Common/AkLock.h>
- #include <AK/Tools/Common/AkPlatformFuncs.h>
- #include <AK/Tools/Common/AkMonitorError.h>
- #include <AK/Tools/Common/AkRng.h>
- #include <AK/SoundEngine/Common/AkSoundEngineExport.h>
- #include <AK/SoundEngine/Common/IAkProcessorFeatures.h>
- #include <AK/SoundEngine/Common/IAkPlatformContext.h>
- #include <AK/SoundEngine/Common/AkMidiTypes.h>
- #include <AK/SoundEngine/Common/AkCallback.h>
- #include <AK/AkWwiseSDKVersion.h>
- #include <math.h>
- #if defined AK_CPU_X86 || defined AK_CPU_X86_64 || defined (AK_CPU_WASM)
- #include <xmmintrin.h>
- #endif
- struct AkPluginInfo
- {
-
- AkPluginInfo()
- : eType(AkPluginTypeNone)
- , uBuildVersion( 0 )
- , bIsInPlace(true)
- , bCanChangeRate(false)
- , bReserved(false)
- , bCanProcessObjects(false)
- , bIsDeviceEffect(false)
- , bCanRunOnObjectConfig(true)
- , bUsesGainAttribute(false)
- {}
- AkPluginType eType;
- AkUInt32 uBuildVersion;
- bool bIsInPlace;
- bool bCanChangeRate;
- bool bReserved;
- bool bCanProcessObjects;
- bool bIsDeviceEffect;
- bool bCanRunOnObjectConfig;
- bool bUsesGainAttribute;
- };
- namespace AK
- {
- class PluginRegistration;
- }
- extern "C" AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList;
- struct AkAcousticTexture;
- namespace AK
- {
- class IAkStreamMgr;
- class IAkGlobalPluginContext;
-
- class IAkGameObjectPluginInfo
- {
- protected:
-
- virtual ~IAkGameObjectPluginInfo(){}
- public:
-
- virtual AkGameObjectID GetGameObjectID() const = 0;
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AkUInt32 GetNumEmitterListenerPairs() const = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT GetEmitterListenerPair(
- AkUInt32 in_uIndex,
- AkEmitterListenerPair & out_emitterListenerPair
- ) const = 0;
-
-
-
-
-
-
- virtual AkUInt32 GetNumGameObjectPositions() const = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT GetGameObjectPosition(
- AkUInt32 in_uIndex,
- AkSoundPosition & out_position
- ) const = 0;
-
-
-
-
-
- virtual SoundEngine::MultiPositionType GetGameObjectMultiPositionType() const = 0;
-
-
-
- virtual AkReal32 GetGameObjectScaling() const = 0;
-
-
-
-
-
-
-
- virtual bool GetListeners(
- AkGameObjectID* out_aListenerIDs,
- AkUInt32& io_uSize
- ) const = 0;
-
-
-
-
-
-
- virtual AKRESULT GetListenerData(
- AkGameObjectID in_uListener,
- AkListener & out_listener
- ) const = 0;
-
-
-
-
-
-
-
-
-
- virtual AKRESULT GetDistanceProbe(
- AkGameObjectID in_uListener,
- AkWorldTransform& out_position
- ) const = 0;
- };
-
- class IAkVoicePluginInfo
- {
- protected:
-
- virtual ~IAkVoicePluginInfo(){}
- public:
-
- virtual AkPlayingID GetPlayingID() const = 0;
-
-
- virtual AkPriority GetPriority() const = 0;
-
-
- virtual AkPriority ComputePriorityWithDistance(
- AkReal32 in_fDistance
- ) const = 0;
- };
-
- class IAkPluginContextBase
- {
- protected:
-
- virtual ~IAkPluginContextBase(){}
- public:
-
-
- virtual IAkGlobalPluginContext* GlobalContext() const = 0;
-
-
- virtual IAkGameObjectPluginInfo * GetGameObjectInfo() = 0;
-
-
-
-
-
- virtual AKRESULT GetOutputID(
- AkUInt32 & out_uOutputID,
- AkPluginID & out_uDevicePlugin
- ) const = 0;
-
-
-
-
- virtual void GetPluginMedia(
- AkUInt32 in_dataIndex,
- AkUInt8* &out_rpData,
- AkUInt32 &out_rDataSize
- ) = 0;
-
-
-
-
- virtual void GetPluginCustomGameData(
- void* &out_rpData,
- AkUInt32 &out_rDataSize
- ) = 0;
-
-
-
-
-
-
-
-
-
- virtual AKRESULT PostMonitorData(
- void * in_pData,
- AkUInt32 in_uDataSize
- ) = 0;
-
-
-
- virtual bool CanPostMonitorData() = 0;
-
-
-
-
-
-
- virtual AKRESULT PostMonitorMessage(
- const char* in_pszError,
- AK::Monitor::ErrorLevel in_eErrorLevel
- ) = 0;
-
-
-
- virtual AkReal32 GetDownstreamGain() = 0;
-
-
-
-
-
- virtual AKRESULT GetParentChannelConfig(
- AkChannelConfig& out_channelConfig
- ) const = 0;
-
- virtual IAkProcessorFeatures * GetProcessorFeatures() = 0;
-
-
-
-
-
-
-
-
-
-
- virtual AkUniqueID GetAudioNodeID() const = 0;
-
-
-
-
-
- virtual AKRESULT GetSinkChannelConfig(
- AkChannelConfig& out_sinkConfig,
- Ak3DAudioSinkCapabilities& out_3dAudioCaps
- ) const = 0;
- };
-
-
-
- class IAkEffectPluginContext : public IAkPluginContextBase
- {
- protected:
-
- virtual ~IAkEffectPluginContext(){}
- public:
-
-
-
- virtual bool IsSendModeEffect() const = 0;
-
-
- virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
-
-
- virtual IAkMixerPluginContext* GetMixerCtx() = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT CreateOutputObjects(
- AkChannelConfig in_channelConfig,
- AkAudioObjects& io_objects
-
-
- ) = 0;
-
-
-
- virtual void GetOutputObjects(
- AkAudioObjects& io_objects
-
-
- ) = 0;
-
- };
-
-
-
- class IAkSourcePluginContext : public IAkPluginContextBase
- {
- protected:
-
- virtual ~IAkSourcePluginContext(){}
- public:
-
-
- virtual AkUInt16 GetNumLoops() const = 0;
-
-
- virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
-
-
-
- virtual AkMIDIEvent GetMidiEvent() const = 0;
-
-
- virtual void* GetCookie() const = 0;
- };
-
- class IAkMixerPluginContext : public IAkPluginContextBase
- {
- protected:
-
- virtual ~IAkMixerPluginContext(){}
- public:
-
-
-
-
-
- virtual AkUInt32 GetBusType() = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT GetSpeakerAngles(
- AkReal32 * io_pfSpeakerAngles,
- AkUInt32 & io_uNumAngles,
- AkReal32 & out_fHeightAngle
- ) = 0;
-
-
-
-
-
-
-
- virtual AKRESULT ComputeSpeakerVolumesDirect(
- AkChannelConfig in_inputConfig,
- AkChannelConfig in_outputConfig,
- AkReal32 in_fCenterPerc,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
-
-
-
-
-
- virtual AKRESULT ComputeSpeakerVolumesPanner(
- AkSpeakerPanningType in_ePannerType,
- const AkVector & in_position,
- AkReal32 in_fCenterPct,
- AkChannelConfig in_inputConfig,
- AkChannelConfig in_outputConfig,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
-
-
-
-
-
- virtual AKRESULT ComputePlanarVBAPGains(
- AkReal32 in_fAngle,
- AkChannelConfig in_outputConfig,
- AkReal32 in_fCenterPerc,
- AK::SpeakerVolumes::VectorPtr out_vVolumes
- ) = 0;
-
-
- virtual AKRESULT InitSphericalVBAP(
- AK::IAkPluginMemAlloc* in_pAllocator,
- const AkSphericalCoord* in_SphericalPositions,
- const AkUInt32 in_NbPoints,
- void *& out_pPannerData
- ) = 0;
-
-
-
- virtual AKRESULT ComputeSphericalVBAPGains(
- void* in_pPannerData,
- AkReal32 in_fAzimuth,
- AkReal32 in_fElevation,
- AkUInt32 in_uNumChannels,
- AK::SpeakerVolumes::VectorPtr out_vVolumes
- ) = 0;
-
-
- virtual AKRESULT TermSphericalVBAP(
- AK::IAkPluginMemAlloc* in_pAllocator,
- void* in_pPannerData
- ) = 0;
-
-
-
-
-
-
-
- virtual AKRESULT Compute3DPositioning(
- AkReal32 in_fAngle,
- AkReal32 in_fElevation,
- AkReal32 in_fSpread,
- AkReal32 in_fFocus,
- AkChannelConfig in_inputConfig,
- AkChannelMask in_uInputChanSel,
- AkChannelConfig in_outputConfig,
- AkReal32 in_fCenterPerc,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT Compute3DPositioning(
- const AkWorldTransform & in_emitter,
- const AkWorldTransform & in_listener,
- AkReal32 in_fCenterPerc,
- AkReal32 in_fSpread,
- AkReal32 in_fFocus,
- AkChannelConfig in_inputConfig,
- AkChannelMask in_uInputChanSel,
- AkChannelConfig in_outputConfig,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT ComputePositioning(
- const AkPositioningData& in_posData,
- AkChannelConfig in_inputConfig,
- AkChannelConfig in_outputConfig,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
-
-
-
-
-
-
-
- virtual void EnableMetering( AkMeteringFlags in_eFlags ) = 0;
-
- };
-
-
-
-
-
- class IAkPluginParam : public IAkRTPCSubscriber
- {
- protected:
-
- virtual ~IAkPluginParam(){}
- public:
-
-
-
-
-
- virtual IAkPluginParam * Clone(
- IAkPluginMemAlloc * in_pAllocator
- ) = 0;
-
-
-
-
-
-
-
- virtual AKRESULT Init(
- IAkPluginMemAlloc * in_pAllocator,
- const void * in_pParamsBlock,
- AkUInt32 in_uBlockSize
- ) = 0;
-
-
-
-
-
- virtual AKRESULT Term(
- IAkPluginMemAlloc * in_pAllocator
- ) = 0;
-
-
-
-
- virtual AKRESULT SetParamsBlock(
- const void *in_pParamsBlock,
- AkUInt32 in_uBlockSize
- ) = 0;
-
-
-
-
-
- virtual AKRESULT SetParam(
- AkPluginParamID in_paramID,
- const void * in_pValue,
- AkUInt32 in_uParamSize
- ) = 0;
-
-
-
-
-
-
-
- static const AkPluginParamID ALL_PLUGIN_DATA_ID = 0x7FFF;
- };
-
-
-
- class IAkPlugin
- {
- protected:
-
- virtual ~IAkPlugin(){}
- public:
-
-
-
-
-
- virtual AKRESULT Term(
- IAkPluginMemAlloc * in_pAllocator
- ) = 0;
-
-
-
-
-
- virtual AKRESULT Reset() = 0;
-
-
-
-
-
-
- virtual AKRESULT GetPluginInfo(
- AkPluginInfo & out_rPluginInfo
- ) = 0;
-
-
-
-
-
-
-
- virtual bool SupportMediaRelocation() const
- {
- return false;
- }
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT RelocateMedia(
- AkUInt8* ,
- AkUInt8*
- )
- {
- return AK_NotImplemented;
- }
- };
-
- class IAkEffectPlugin : public IAkPlugin
- {
- protected:
-
- virtual ~IAkEffectPlugin(){}
- public:
-
-
-
-
- virtual AKRESULT Init(
- IAkPluginMemAlloc * in_pAllocator,
- IAkEffectPluginContext * in_pEffectPluginContext,
- IAkPluginParam * in_pParams,
- AkAudioFormat & io_rFormat
- ) = 0;
- };
-
- class IAkInPlaceEffectPlugin : public IAkEffectPlugin
- {
- public:
-
-
-
-
-
-
-
- virtual void Execute(
- AkAudioBuffer * io_pBuffer
- ) = 0;
-
-
-
- virtual AKRESULT TimeSkip(
- AkUInt32 in_uFrames
- ) = 0;
- };
-
- class IAkOutOfPlaceEffectPlugin : public IAkEffectPlugin
- {
- public:
-
-
-
-
-
-
- virtual void Execute(
- AkAudioBuffer * in_pBuffer,
- AkUInt32 in_uInOffset,
- AkAudioBuffer * out_pBuffer
- ) = 0;
-
-
-
- virtual AKRESULT TimeSkip(
- AkUInt32 &io_uFrames
- ) = 0;
- };
-
-
-
-
-
- class IAkInPlaceObjectPlugin : public IAkEffectPlugin
- {
- public:
-
-
-
-
-
-
- virtual void Execute(
- const AkAudioObjects& io_objects
- ) = 0;
- };
-
-
-
-
-
-
- class IAkOutOfPlaceObjectPlugin : public IAkEffectPlugin
- {
- public:
-
-
-
-
-
-
-
- virtual void Execute(
- const AkAudioObjects& in_objects,
- const AkAudioObjects& out_objects
- ) = 0;
- };
- class IAkAudioDeviceEffectPluginContext : public IAkPluginContextBase
- {
- public:
-
-
-
-
-
-
- virtual AKRESULT ComputePositioning(
- const AkPositioningData& in_posData,
- AkChannelConfig in_inputConfig,
- AkChannelConfig in_outputConfig,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
- };
-
-
-
- class IAkAudioDeviceEffectPlugin : public IAkPlugin
- {
- protected:
-
- virtual ~IAkAudioDeviceEffectPlugin() {}
- public:
-
-
- virtual AKRESULT Init(
- IAkPluginMemAlloc* in_pAllocator,
- IAkAudioDeviceEffectPluginContext* in_pEffectPluginContext,
- IAkPluginParam* in_pParams,
- const AkAudioFormat& in_rFormat,
- const Ak3DAudioSinkCapabilities& in_3dCapabilities
- ) = 0;
- virtual void Execute(
- AkAudioBuffer* io_pMainMix,
- AkAudioBuffer* io_pPassthroughMix,
- const AkAudioObjects& io_objects,
- AkRamp& io_gain
- ) = 0;
- };
-
-
- class IAkMixerInputContext
- {
- protected:
-
- virtual ~IAkMixerInputContext(){}
- public:
-
-
-
-
- virtual IAkPluginParam * GetInputParam(
- AkPluginID in_attachmentPluginID
- ) = 0;
-
-
- virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
-
-
- virtual IAkGameObjectPluginInfo* GetGameObjectInfo() = 0;
-
-
- virtual AkConnectionType GetConnectionType() = 0;
-
-
-
- virtual void* GetUserData() = 0;
-
-
- virtual void SetUserData(void* in_pUserData) = 0;
-
-
-
-
-
-
-
- virtual AkReal32 GetCenterPerc() = 0;
-
-
-
-
-
- virtual AkSpeakerPanningType GetSpeakerPanningType() = 0;
-
-
-
-
-
-
-
-
- virtual void GetPannerPosition(
- AkVector & out_position
- ) = 0;
-
-
-
-
-
-
-
-
- virtual bool HasListenerRelativeRouting() = 0;
-
-
-
-
-
-
-
- virtual Ak3DPositionType Get3DPositionType() = 0;
-
-
-
-
-
-
-
- virtual AkUInt32 GetNum3DPositions() = 0;
-
-
-
-
-
-
-
-
- virtual AKRESULT Get3DPosition(
- AkUInt32 in_uIndex,
- AkEmitterListenerPair & out_soundPosition
- ) = 0;
-
-
-
-
-
-
-
-
- virtual AkReal32 GetSpread(
- AkUInt32 in_uIndex
- ) = 0;
-
-
-
-
-
-
-
-
- virtual AkReal32 GetFocus(
- AkUInt32 in_uIndex
- ) = 0;
-
-
-
- virtual bool GetMaxAttenuationDistance(
- AkReal32 & out_fMaxAttenuationDistance
- ) = 0;
-
-
-
- virtual void GetSpatializedVolumes(
- AK::SpeakerVolumes::MatrixPtr out_mxPrevVolumes,
- AK::SpeakerVolumes::MatrixPtr out_mxNextVolumes
- ) = 0;
-
-
-
-
-
- virtual Ak3DSpatializationMode Get3DSpatializationMode() = 0;
-
- };
-
-
-
- class IAkSinkPluginContext : public IAkPluginContextBase
- {
- protected:
-
- virtual ~IAkSinkPluginContext(){}
- public:
-
-
-
-
-
- virtual bool IsPrimary() = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT SignalAudioThread() = 0;
-
-
- virtual AkUInt16 GetNumRefillsInVoice() = 0;
-
-
-
-
-
-
- virtual AKRESULT ComputePositioning(
- const AkPositioningData& in_posData,
- AkChannelConfig in_inputConfig,
- AkChannelConfig in_outputConfig,
- AK::SpeakerVolumes::MatrixPtr out_mxVolumes
- ) = 0;
- };
- enum AkSinkPluginType
- {
- AkSinkPluginType_Sink,
- AkSinkPluginType_3DAudioSink
- };
-
-
-
-
-
- class IAkSinkPluginBase : public IAkPlugin
- {
- public:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT Init(
- IAkPluginMemAlloc * in_pAllocator,
- IAkSinkPluginContext * in_pSinkPluginContext,
- IAkPluginParam * in_pParams,
- AkAudioFormat & io_rFormat
- ) = 0;
-
-
-
-
-
-
-
- virtual AKRESULT IsDataNeeded(
- AkUInt32& out_uNumFramesNeeded
- ) = 0;
-
-
-
- virtual void OnFrameEnd() = 0;
-
-
- virtual bool IsStarved() = 0;
-
- virtual void ResetStarved() = 0;
- virtual AkSinkPluginType GetSinkPluginType() const = 0;
- };
-
- class IAkSinkPlugin : public IAkSinkPluginBase
- {
- protected:
-
- virtual ~IAkSinkPlugin() {}
- public:
-
-
-
-
-
-
-
-
- virtual void Consume(
- AkAudioBuffer * in_pInputBuffer,
- AkRamp in_gain
- ) = 0;
- virtual AkSinkPluginType GetSinkPluginType() const override final { return AkSinkPluginType_Sink; }
- };
-
- class IAk3DAudioSinkPlugin : public IAkSinkPluginBase
- {
- protected:
-
- virtual ~IAk3DAudioSinkPlugin() {}
- public:
-
- virtual void Get3DAudioCapabilities(
- Ak3DAudioSinkCapabilities& out_rCapabilities
- ) = 0;
-
-
-
-
-
- virtual void Consume(
- AkAudioBuffer* in_pMainMix,
- AkAudioBuffer* in_pPassthroughMix,
- const AkAudioObjects& in_objects,
- AkRamp in_gain
- ) = 0;
- virtual AkSinkPluginType GetSinkPluginType() const override final { return AkSinkPluginType_3DAudioSink; }
- };
-
- class IAkSourcePlugin : public IAkPlugin
- {
- protected:
-
- virtual ~IAkSourcePlugin(){}
- public:
-
-
-
-
- virtual AKRESULT Init(
- IAkPluginMemAlloc * in_pAllocator,
- IAkSourcePluginContext * in_pSourcePluginContext,
- IAkPluginParam * in_pParams,
- AkAudioFormat & io_rFormat
- ) = 0;
-
-
-
-
- virtual AkReal32 GetDuration() const = 0;
-
-
-
-
-
-
-
- virtual AkReal32 GetEnvelope() const
- {
- return 1.f;
- }
-
-
-
-
-
-
-
-
-
- virtual AKRESULT StopLooping(){ return AK_Success; }
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT Seek(
- AkUInt32
- ) { return AK_Success; }
-
-
-
-
-
-
- virtual AKRESULT TimeSkip(
- AkUInt32 &
- ) { return AK_NotImplemented; }
-
-
-
-
-
- virtual void Execute(
- AkAudioBuffer * io_pBuffer
- ) = 0;
- };
-
- #define AK_FLOAT_TO_SAMPLETYPE( __in__ ) (__in__)
-
- #define AK_FLOAT_TO_SAMPLETYPE_NOCLIP( __in__ ) (__in__)
-
- #define AK_SAMPLETYPE_TO_FLOAT( __in__ ) (__in__)
- #define AK_DBTOLIN( __db__ ) (powf(10.f,(__db__) * 0.05f))
- }
- AK_CALLBACK( AK::IAkPlugin*, AkCreatePluginCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
- AK_CALLBACK( AK::IAkPluginParam*, AkCreateParamCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
- AK_CALLBACK( AKRESULT, AkGetDeviceListCallback)(
- AkUInt32& io_maxNumDevices,
- AkDeviceDescription* out_deviceDescriptions
- );
- struct AkPlatformInitSettings;
- struct AkInitSettings;
- namespace AK
- {
- enum AkPluginServiceType
- {
- PluginServiceType_Mixer = 0,
- PluginServiceType_RNG = 1,
- PluginServiceType_AudioObjectAttenuation = 2,
- PluginServiceType_AudioObjectPriority = 3,
- PluginServiceType_MAX,
- };
-
- class IAkPluginService
- {
- protected:
- virtual ~IAkPluginService() {}
- };
-
-
-
- class IAkGlobalPluginContext
- {
- protected:
-
- virtual ~IAkGlobalPluginContext(){}
- public:
-
- virtual IAkStreamMgr * GetStreamMgr() const = 0;
-
-
-
- virtual AkUInt16 GetMaxBufferLength() const = 0;
-
-
- virtual bool IsRenderingOffline() const = 0;
-
-
- virtual AkUInt32 GetSampleRate() const = 0;
-
-
-
-
-
-
- virtual AKRESULT PostMonitorMessage(
- const char* in_pszError,
- AK::Monitor::ErrorLevel in_eErrorLevel
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT RegisterPlugin(
- AkPluginType in_eType,
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkCreatePluginCallback in_pCreateFunc,
- AkCreateParamCallback in_pCreateParamFunc
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT RegisterCodec(
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkCreateFileSourceCallback in_pFileCreateFunc,
- AkCreateBankSourceCallback in_pBankCreateFunc
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT RegisterGlobalCallback(
- AkPluginType in_eType,
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkGlobalCallbackFunc in_pCallback,
- AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender,
- void * in_pCookie = NULL
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT UnregisterGlobalCallback(
- AkGlobalCallbackFunc in_pCallback,
- AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender
- ) = 0;
-
- virtual AK::IAkPluginMemAlloc * GetAllocator() = 0;
-
- virtual AKRESULT SetRTPCValue(
- AkRtpcID in_rtpcID,
- AkRtpcValue in_value,
- AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT,
- AkTimeMs in_uValueChangeDuration = 0,
- AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear,
- bool in_bBypassInternalValueInterpolation = false
- ) = 0;
-
-
-
-
-
-
- virtual AKRESULT SendPluginCustomGameData(
- AkUniqueID in_busID,
- AkGameObjectID in_busObjectID,
- AkPluginType in_eType,
- AkUInt32 in_uCompanyID,
- AkUInt32 in_uPluginID,
- const void* in_pData,
- AkUInt32 in_uSizeInBytes
- ) = 0;
-
-
- virtual void ComputeAmbisonicsEncoding(
- AkReal32 in_fAzimuth,
- AkReal32 in_fElevation,
- AkChannelConfig in_cfgAmbisonics,
- AK::SpeakerVolumes::VectorPtr out_vVolumes
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT ComputeWeightedAmbisonicsDecodingFromSampledSphere(
- const AkVector in_samples[],
- AkUInt32 in_uNumSamples,
- AkChannelConfig in_cfgAmbisonics,
- AK::SpeakerVolumes::MatrixPtr out_mxVolume
- ) = 0;
-
-
- virtual const AkAcousticTexture* GetAcousticTexture(
- AkAcousticTextureID in_AcousticTextureID
- ) = 0;
-
-
- virtual AKRESULT ComputeSphericalCoordinates(
- const AkEmitterListenerPair & in_pair,
- AkReal32 & out_fAzimuth,
- AkReal32 & out_fElevation
- ) const = 0;
-
-
- virtual const AkPlatformInitSettings* GetPlatformInitSettings() const = 0;
-
-
-
- virtual const AkInitSettings* GetInitSettings() const = 0;
-
-
-
-
-
- virtual AKRESULT GetAudioSettings(
- AkAudioSettings & out_audioSettings
- ) const = 0;
-
-
-
-
- virtual AkUInt32 GetIDFromString(const char* in_pszString) const = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AkPlayingID PostEventSync(
- AkUniqueID in_eventID,
- AkGameObjectID in_gameObjectID,
- AkUInt32 in_uFlags = 0,
- AkCallbackFunc in_pfnCallback = NULL,
- void * in_pCookie = NULL,
- AkUInt32 in_cExternals = 0,
- AkExternalSourceInfo *in_pExternalSources = NULL,
- AkPlayingID in_PlayingID = AK_INVALID_PLAYING_ID
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AkPlayingID PostMIDIOnEventSync(
- AkUniqueID in_eventID,
- AkGameObjectID in_gameObjectID,
- AkMIDIPost* in_pPosts,
- AkUInt16 in_uNumPosts,
- bool in_bAbsoluteOffsets = false,
- AkUInt32 in_uFlags = 0,
- AkCallbackFunc in_pfnCallback = NULL,
- void * in_pCookie = NULL,
- AkPlayingID in_playingID = AK_INVALID_PLAYING_ID
- ) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
- virtual AKRESULT StopMIDIOnEventSync(
- AkUniqueID in_eventID = AK_INVALID_UNIQUE_ID,
- AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT,
- AkPlayingID in_playingID = AK_INVALID_PLAYING_ID
- ) = 0;
-
-
- virtual IAkPlatformContext * GetPlatformContext() const = 0;
-
-
-
- virtual IAkPluginService* GetPluginService(
- AkPluginServiceType in_pluginService
- ) const = 0;
-
-
-
- virtual AkUInt32 GetBufferTick() const = 0;
- };
-
- class IAkPluginServiceMixer : public IAkPluginService
- {
- protected:
- virtual ~IAkPluginServiceMixer() {}
- public:
-
- virtual void MixNinNChannels(
- AkAudioBuffer* in_pInputBuffer,
- AkAudioBuffer* in_pMixBuffer,
- AkReal32 in_fPrevGain,
- AkReal32 in_fNextGain,
- AK::SpeakerVolumes::ConstMatrixPtr in_mxPrevVolumes,
- AK::SpeakerVolumes::ConstMatrixPtr in_mxNextVolumes
- ) = 0;
-
- virtual void Mix1inNChannels(
- AkReal32* AK_RESTRICT in_pInChannel,
- AkAudioBuffer* in_pMixBuffer,
- AkReal32 in_fPrevGain,
- AkReal32 in_fNextGain,
- AK::SpeakerVolumes::ConstVectorPtr in_vPrevVolumes,
- AK::SpeakerVolumes::ConstVectorPtr in_vNextVolumes
- ) = 0;
-
- virtual void MixChannel(
- AkReal32* AK_RESTRICT in_pInBuffer,
- AkReal32* AK_RESTRICT in_pOutBuffer,
- AkReal32 in_fPrevGain,
- AkReal32 in_fNextGain,
- AkUInt16 in_uNumFrames
- ) = 0;
-
-
-
- virtual void ApplyGainAndInterleave(
- AkAudioBuffer* in_pInputBuffer,
- AkAudioBuffer* in_pOutputBuffer,
- AkRamp in_gain,
- bool in_convertToInt16
- ) const = 0;
-
-
-
- virtual void ApplyGain(
- AkAudioBuffer* in_pInputBuffer,
- AkAudioBuffer* in_pOutputBuffer,
- AkRamp in_gain,
- bool in_convertToInt16
- ) const = 0;
- };
-
-
-
-
-
- class IAkPluginServiceRNG : public IAkPluginService
- {
- protected:
- virtual ~IAkPluginServiceRNG() {}
- public:
-
-
- virtual AkUInt64 RandomSeed() const = 0;
-
- virtual CAkRng CreateRNG() const = 0;
- };
-
- class IAkPluginServiceAudioObjectAttenuation : public IAkPluginService
- {
- protected:
- virtual ~IAkPluginServiceAudioObjectAttenuation() {}
- public:
-
-
-
- virtual AkUniqueID GetAttenuationID(
- const AkAudioObject& in_object
- ) const = 0;
-
-
-
-
- virtual bool ExtractCurves(
- IAkPluginMemAlloc* in_pAllocator,
- const AkAudioObject & in_object,
- AkUInt32 in_curveTypesMask,
- void* out_curves[]
- ) const = 0;
-
- virtual void Delete(
- IAkPluginMemAlloc* in_pAllocator,
- void*& io_attenuationCurve
- ) = 0;
-
-
- virtual AkReal32 Evaluate(
- void*& io_attenuationCurve,
- AkReal32 x
- ) = 0;
-
- virtual void Linearize(void*& io_attenuationCurve) = 0;
-
- virtual const AkRTPCGraphPoint& GetPoint(
- const void* in_attenuationCurve,
- AkUInt32 i
- ) const = 0;
-
- virtual AkUInt32 GetNumPoints(
- const void* in_attenuationCurve
- ) const = 0;
- };
-
-
-
-
-
-
-
- class IAkPluginServiceAudioObjectPriority : public IAkPluginService
- {
- protected:
- virtual ~IAkPluginServiceAudioObjectPriority() {}
- public:
-
- virtual void GetPriorities(
- AkAudioObject** in_ppObjects,
- AkUInt32 in_uNumObjects,
- AkPriority* out_pPriorities
- ) = 0;
-
- virtual void SetPriorities(
- AkAudioObject** io_ppObjects,
- AkUInt32 in_uNumObjects,
- AkPriority* in_pPriorities
- ) = 0;
- };
- #define AK_GET_PLUGIN_SERVICE_MIXER(plugin_ctx) static_cast<AK::IAkPluginServiceMixer*>(plugin_ctx->GetPluginService(AK::PluginServiceType_Mixer))
- #define AK_GET_PLUGIN_SERVICE_RNG(plugin_ctx) static_cast<AK::IAkPluginServiceRNG*>(plugin_ctx->GetPluginService(AK::PluginServiceType_RNG))
- #define AK_GET_PLUGIN_SERVICE_AUDIO_OBJECT_ATTENUATION(plugin_ctx) static_cast<AK::IAkPluginServiceAudioObjectAttenuation*>(plugin_ctx->GetPluginService(AK::PluginServiceType_AudioObjectAttenuation))
- #define AK_GET_PLUGIN_SERVICE_AUDIO_OBJECT_PRIORITY(plugin_ctx) static_cast<AK::IAkPluginServiceAudioObjectPriority*>(plugin_ctx->GetPluginService(AK::PluginServiceType_AudioObjectPriority))
-
-
-
- class PluginRegistration
- {
- public:
- PluginRegistration(
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID
- )
- {
-
- }
- PluginRegistration(
- AkPluginType in_eType,
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkCreatePluginCallback in_pCreateFunc,
- AkCreateParamCallback in_pCreateParamFunc,
- AkGlobalCallbackFunc in_pRegisterCallback = NULL,
- void * in_pRegisterCallbackCookie = NULL
- )
- : pNext(g_pAKPluginList)
- , m_eType(in_eType)
- , m_ulCompanyID(in_ulCompanyID)
- , m_ulPluginID(in_ulPluginID)
- , m_pCreateFunc(in_pCreateFunc)
- , m_pCreateParamFunc(in_pCreateParamFunc)
- , m_pFileCreateFunc(NULL)
- , m_pBankCreateFunc(NULL)
- , m_pRegisterCallback(in_pRegisterCallback)
- , m_pRegisterCallbackCookie(in_pRegisterCallbackCookie)
- , m_pGetDeviceListFunc(NULL)
- , m_CodecDescriptor{ nullptr, nullptr, nullptr, nullptr }
- {
- g_pAKPluginList = this;
- }
- PluginRegistration(
- AkPluginType in_eType,
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkCreatePluginCallback in_pCreateFunc,
- AkCreateParamCallback in_pCreateParamFunc,
- AkGetDeviceListCallback in_pGetDeviceListFunc,
- AkGlobalCallbackFunc in_pRegisterCallback = NULL,
- void * in_pRegisterCallbackCookie = NULL
- )
- : pNext(g_pAKPluginList)
- , m_eType(in_eType)
- , m_ulCompanyID(in_ulCompanyID)
- , m_ulPluginID(in_ulPluginID)
- , m_pCreateFunc(in_pCreateFunc)
- , m_pCreateParamFunc(in_pCreateParamFunc)
- , m_pFileCreateFunc(NULL)
- , m_pBankCreateFunc(NULL)
- , m_pRegisterCallback(in_pRegisterCallback)
- , m_pRegisterCallbackCookie(in_pRegisterCallbackCookie)
- , m_pGetDeviceListFunc(in_pGetDeviceListFunc)
- , m_CodecDescriptor{ nullptr, nullptr, nullptr, nullptr }
- {
- g_pAKPluginList = this;
- }
- PluginRegistration(
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- AkCreateFileSourceCallback in_pCreateFile,
- AkCreateBankSourceCallback in_pCreateBank)
- : pNext(g_pAKPluginList)
- , m_eType(AkPluginTypeCodec)
- , m_ulCompanyID(in_ulCompanyID)
- , m_ulPluginID(in_ulPluginID)
- , m_pCreateFunc(NULL)
- , m_pCreateParamFunc(NULL)
- , m_pFileCreateFunc(in_pCreateFile)
- , m_pBankCreateFunc(in_pCreateBank)
- , m_pRegisterCallback(NULL)
- , m_pRegisterCallbackCookie(NULL)
- , m_pGetDeviceListFunc(NULL)
- , m_CodecDescriptor{ in_pCreateFile, in_pCreateBank, nullptr, nullptr }
- {
- g_pAKPluginList = this;
- }
- PluginRegistration(
- AkUInt32 in_ulCompanyID,
- AkUInt32 in_ulPluginID,
- const AkCodecDescriptor &in_Descriptor)
- : pNext(g_pAKPluginList)
- , m_eType(AkPluginTypeCodec)
- , m_ulCompanyID(in_ulCompanyID)
- , m_ulPluginID(in_ulPluginID)
- , m_pCreateFunc(NULL)
- , m_pCreateParamFunc(NULL)
- , m_pFileCreateFunc(in_Descriptor.pFileSrcCreateFunc)
- , m_pBankCreateFunc(in_Descriptor.pBankSrcCreateFunc)
- , m_pRegisterCallback(NULL)
- , m_pRegisterCallbackCookie(NULL)
- , m_pGetDeviceListFunc(NULL)
- , m_CodecDescriptor(in_Descriptor)
- {
- g_pAKPluginList = this;
- }
- PluginRegistration *pNext;
- AkPluginType m_eType;
- AkUInt32 m_ulCompanyID;
- AkUInt32 m_ulPluginID;
- AkCreatePluginCallback m_pCreateFunc;
- AkCreateParamCallback m_pCreateParamFunc;
- AkCreateFileSourceCallback m_pFileCreateFunc;
- AkCreateBankSourceCallback m_pBankCreateFunc;
- AkGlobalCallbackFunc m_pRegisterCallback;
- void * m_pRegisterCallbackCookie;
-
-
- AkGetDeviceListCallback m_pGetDeviceListFunc;
- AkCodecDescriptor m_CodecDescriptor;
- };
- }
- #define AK_IMPLEMENT_PLUGIN_FACTORY(_pluginName_, _plugintype_, _companyid_, _pluginid_) \
- AK::IAkPlugin* Create##_pluginName_(AK::IAkPluginMemAlloc * in_pAllocator); \
- AK::IAkPluginParam * Create##_pluginName_##Params(AK::IAkPluginMemAlloc * in_pAllocator); \
- AK_ATTR_USED AK::PluginRegistration _pluginName_##Registration(_plugintype_, _companyid_, _pluginid_, Create##_pluginName_, Create##_pluginName_##Params);
- #define AK_STATIC_LINK_PLUGIN(_pluginName_) \
- extern AK::PluginRegistration _pluginName_##Registration; \
- void *_pluginName_##_linkonceonly = (void*)&_pluginName_##Registration;
- #define DEFINE_PLUGIN_REGISTER_HOOK AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList = NULL;
- #define AK_GET_SINK_TYPE_FROM_DEVICE_KEY(_key) ((AkUInt32)(_key & 0xffffffff))
- #define AK_GET_DEVICE_ID_FROM_DEVICE_KEY(_key) ((AkUInt32)(_key >> 32))
- #endif
|