版本

menu_open

include/AK/SoundEngine/Common/IAkPlugin.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
00003 released in source code form as part of the SDK installer package.
00004 
00005 Commercial License Usage
00006 
00007 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
00008 may use this file in accordance with the end user license agreement provided 
00009 with the software or, alternatively, in accordance with the terms contained in a
00010 written agreement between you and Audiokinetic Inc.
00011 
00012 Apache License Usage
00013 
00014 Alternatively, this file may be used under the Apache License, Version 2.0 (the 
00015 "Apache License"); you may not use this file except in compliance with the 
00016 Apache License. You may obtain a copy of the Apache License at 
00017 http://www.apache.org/licenses/LICENSE-2.0.
00018 
00019 Unless required by applicable law or agreed to in writing, software distributed
00020 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
00021 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
00022 the specific language governing permissions and limitations under the License.
00023 
00024   Version: <VERSION>  Build: <BUILDNUMBER>
00025   Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
00026 *******************************************************************************/
00027 
00030 
00031 #ifndef _IAK_PLUGIN_H_
00032 #define _IAK_PLUGIN_H_
00033 
00034 #include <AK/SoundEngine/Common/AkCommonDefs.h>
00035 #include <AK/SoundEngine/Common/IAkRTPCSubscriber.h>
00036 #include <AK/SoundEngine/Common/IAkPluginMemAlloc.h>
00037 #include <AK/SoundEngine/Common/AkFPUtilities.h>
00038 #include <AK/Tools/Common/AkLock.h>
00039 #include <AK/Tools/Common/AkPlatformFuncs.h>
00040 #include <AK/Tools/Common/AkMonitorError.h>
00041 #include <AK/SoundEngine/Common/AkSoundEngineExport.h>
00042 #include <AK/SoundEngine/Common/IAkProcessorFeatures.h>
00043 #include <AK/SoundEngine/Common/AkMidiTypes.h>
00044 #include <AK/SoundEngine/Common/AkCallback.h>
00045 #include <AK/AkWwiseSDKVersion.h>
00046 
00047 #ifndef AK_WII
00048 // math.h may cause conflicts on the Wii due to inclusion order.
00049 #include <math.h>
00050 #endif
00051 
00052 #if defined AK_CPU_X86  || defined AK_CPU_X86_64
00053 #include <xmmintrin.h>
00054 #endif
00055 
00056 #ifdef AK_XBOX360
00057 #include "ppcintrinsics.h"
00058 #endif
00059 
00060 #ifdef __PPU__
00061 #include <altivec.h>
00062 #include <ppu_intrinsics.h>
00063 #include <stdlib.h>
00064 #include <string.h>
00065 #endif
00066 
00067 #ifdef AK_PS3
00068 #include <AK/Plugin/PluginServices/PS3/MultiCoreServices.h>
00069 #endif
00070 
00071 #ifdef AK_WII
00072 #include <revolution/ax.h>
00073 #endif
00074 
00075 #ifdef AK_WIIU
00076 #include <cafe/ax.h>
00077 #endif
00078 
00079 #ifdef AK_3DS
00080 #include <nn/snd.h>
00081 #endif
00082 
00083 #ifdef AK_VITA_HW
00084 #include <ngs.h>
00085 #endif
00086 
00087 
00088 #define AK_OLDEST_SUPPORTED_WWISESDK_VERSION ((2016<<8) | 1)
00089 
00093 enum AkPluginType
00094 {
00095     AkPluginTypeNone            = 0,    
00096     AkPluginTypeCodec           = 1,    
00097     AkPluginTypeSource          = 2,    
00098     AkPluginTypeEffect          = 3,    
00099     AkPluginTypeMotionDevice    = 4,    
00100     AkPluginTypeMotionSource    = 5,    
00101     AkPluginTypeMixer           = 6,    
00102     AkPluginTypeSink            = 7,    
00103     AkPluginTypeMask            = 0xf   
00104 };
00105 
00111 struct AkPluginInfo
00112 {
00114     AkPluginInfo()
00115         : eType(AkPluginTypeNone)
00116         , uBuildVersion( 0 )
00117         , bIsInPlace(true)
00118         , bCanChangeRate(false)
00119         , bIsAsynchronous(false)
00120     {}
00121 
00122     AkPluginType eType;            
00123     AkUInt32     uBuildVersion;    
00124     bool         bIsInPlace;       
00125     bool         bCanChangeRate;   
00126     bool         bIsAsynchronous;  
00127 };
00128 
00129 //Forward declarations.
00130 namespace AK
00131 {
00132     class PluginRegistration;
00133 }
00134 extern "C" AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList;
00135 
00136 struct AkAcousticTexture;
00137 struct AkDiffuseReverberator;
00138 
00139 namespace AK
00140 {
00141     class IAkStreamMgr;
00142     class IAkGlobalPluginContext;
00143 
00145     class IAkGameObjectPluginInfo
00146     {
00147     protected:
00149         virtual ~IAkGameObjectPluginInfo(){}
00150 
00151     public:
00152 
00154         virtual AkGameObjectID GetGameObjectID() const = 0;
00155 
00170         virtual AkUInt32 GetNumEmitterListenerPairs() const = 0;
00171 
00186         virtual AKRESULT GetEmitterListenerPair(
00187             AkUInt32 in_uIndex,             
00188             AkEmitterListenerPair & out_emitterListenerPair 
00189             ) const = 0;
00190 
00197         virtual AkUInt32 GetNumGameObjectPositions() const = 0;
00198 
00207         virtual AKRESULT GetGameObjectPosition(
00208             AkUInt32 in_uIndex,             
00209             AkSoundPosition & out_position  
00210             ) const = 0;
00211 
00217         virtual SoundEngine::MultiPositionType GetGameObjectMultiPositionType() const = 0;
00218 
00222         virtual AkReal32 GetGameObjectScaling() const = 0;
00223 
00232         virtual AkUInt32 GetListenerMask() const = 0;
00233 
00242         virtual AKRESULT GetListenerData(
00243             AkUInt32 in_uListenerMask,      
00244             AkListener & out_listener       
00245             ) const = 0;
00246     };
00247 
00250     class IAkVoicePluginInfo : public IAkGameObjectPluginInfo
00251     {
00252     protected:
00254         virtual ~IAkVoicePluginInfo(){}
00255 
00256     public:
00257 
00259         virtual AkPlayingID GetPlayingID() const = 0;
00260 
00263         virtual AkPriority GetPriority() const = 0;
00264 
00267         virtual AkPriority ComputePriorityWithDistance(
00268             AkReal32 in_fDistance               
00269             ) const = 0;
00270     };
00271 
00273     class IAkPluginContextBase
00274     {
00275     protected:
00277         virtual ~IAkPluginContextBase(){}
00278 
00279     public:
00280 
00283         virtual IAkGlobalPluginContext* GlobalContext() const = 0;
00284 
00292         virtual AKRESULT GetOutputID(
00293             AkUInt32 &          out_uOutputID,      
00294             AkUInt32 &          out_uDeviceType     
00295             ) const = 0;
00296 
00301         virtual void GetPluginMedia(
00302             AkUInt32 in_dataIndex,      
00303             AkUInt8* &out_rpData,       
00304             AkUInt32 &out_rDataSize     
00305             ) = 0;
00306 
00311         virtual void GetPluginCustomGameData( 
00312             void* &out_rpData,          
00313             AkUInt32 &out_rDataSize     
00314             ) = 0;
00315 
00329         virtual AKRESULT PostMonitorData(
00330             void *      in_pData,       
00331             AkUInt32    in_uDataSize    
00332             ) = 0;
00333 
00340         virtual bool     CanPostMonitorData() = 0;
00341 
00348         virtual AKRESULT PostMonitorMessage(
00349             const char* in_pszError,                
00350             AK::Monitor::ErrorLevel in_eErrorLevel  
00351             ) = 0;
00352 
00357         virtual AkReal32 GetDownstreamGain() = 0;
00358 
00363         virtual AKRESULT GetParentChannelConfig(
00364             AkChannelConfig& out_channelConfig  
00365             ) const = 0;
00366 
00367 #if (defined AK_CPU_X86 || defined AK_CPU_X86_64) && !(defined AK_IOS)
00368 
00369         virtual IAkProcessorFeatures * GetProcessorFeatures() = 0;
00370 #endif
00371     };
00372 
00376     class IAkEffectPluginContext : public IAkPluginContextBase
00377     {
00378     protected:
00380         virtual ~IAkEffectPluginContext(){}
00381 
00382     public:
00383 
00387         virtual bool IsSendModeEffect() const = 0;
00388 
00391         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00392 
00402         virtual AkUniqueID GetNodeID() const = 0;
00403     };
00404 
00408     class IAkSourcePluginContext : public IAkPluginContextBase
00409     {
00410     protected:
00412         virtual ~IAkSourcePluginContext(){}
00413 
00414     public:
00415 
00418         virtual AkUInt16 GetNumLoops() const = 0;
00419 
00422         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00423 
00427         virtual AkMIDIEvent GetMidiEvent() const = 0;
00428 
00438         virtual AkUniqueID GetNodeID() const = 0;
00439 
00442         virtual void* GetCookie() const = 0;    
00443 
00444     };
00445 
00447     class IAkMixerPluginContext : public IAkPluginContextBase
00448     {
00449     protected:
00451         virtual ~IAkMixerPluginContext(){}
00452 
00453     public:
00454 
00458         virtual AkUniqueID GetBusID() = 0;
00459 
00464         virtual AkBusType GetBusType() = 0;
00465 
00482         virtual AKRESULT GetSpeakerAngles(
00483             AkReal32 *          io_pfSpeakerAngles,         
00484             AkUInt32 &          io_uNumAngles,              
00485             AkReal32 &          out_fHeightAngle            
00486             ) = 0;
00487 
00489 
00490 
00492         virtual void ComputeSpeakerVolumesDirect(
00493             AkChannelConfig     in_inputConfig,             
00494             AkChannelConfig     in_outputConfig,            
00495             AkReal32            in_fCenterPerc,             
00496             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     
00497             ) = 0;
00498 
00500         virtual void ComputeSpeakerVolumesPanner(
00501             const AkVector &    in_position,                
00502             AkReal32            in_fCenterPct,              
00503             AkChannelConfig     in_inputConfig,             
00504             AkChannelConfig     in_outputConfig,            
00505             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     
00506             ) = 0;
00507 
00510         virtual AKRESULT ComputePlanarVBAPGains(
00511             AkReal32            in_fAngle,                  
00512             AkChannelConfig     in_outputConfig,            
00513             AkReal32            in_fCenterPerc,             
00514             AK::SpeakerVolumes::VectorPtr out_vVolumes      
00515             ) = 0;
00516 
00519         virtual AKRESULT InitSphericalVBAP(
00520             AK::IAkPluginMemAlloc* in_pAllocator,           
00521             const AkSphericalCoord* in_SphericalPositions,  
00522             const AkUInt32 in_NbPoints,                     
00523             void *& out_pPannerData                         
00524             ) = 0;
00525 
00528         virtual AKRESULT ComputeSphericalVBAPGains(
00529             void*               in_pPannerData,             
00530             AkReal32            in_fAzimuth,                
00531             AkReal32            in_fElevation,              
00532             AkUInt32            in_uNumChannels,            
00533             AK::SpeakerVolumes::VectorPtr out_vVolumes      
00534             ) = 0;
00535 
00538         virtual AKRESULT TermSphericalVBAP(
00539             AK::IAkPluginMemAlloc*  in_pAllocator,          
00540             void*                   in_pPannerData          
00541             ) = 0;
00542 
00545         virtual AKRESULT Compute3DPositioning(
00546             AkReal32            in_fAngle,                  
00547             AkReal32            in_fElevation,              
00548             AkReal32            in_fSpread,                 
00549             AkReal32            in_fFocus,                  
00550             AkChannelConfig     in_inputConfig,             
00551             AkChannelMask       in_uInputChanSel,           
00552             AkChannelConfig     in_outputConfig,            
00553             AkReal32            in_fCenterPerc,             
00554             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     
00555             ) = 0;
00556 
00558 
00560 
00561 
00566         virtual void EnableMetering( AkMeteringFlags in_eFlags ) = 0;
00567 
00569     };
00570 
00576     class IAkPluginParam : public IAkRTPCSubscriber
00577     {
00578     protected:
00580         virtual ~IAkPluginParam(){}
00581 
00582     public:
00588         virtual IAkPluginParam * Clone(
00589             IAkPluginMemAlloc * in_pAllocator   
00590             ) = 0;
00591 
00599         virtual AKRESULT Init(
00600             IAkPluginMemAlloc * in_pAllocator,      
00601             const void *        in_pParamsBlock,    
00602             AkUInt32            in_uBlockSize       
00603             ) = 0;
00604 
00610         virtual AKRESULT Term(
00611             IAkPluginMemAlloc * in_pAllocator       
00612             ) = 0;
00613 
00618         virtual AKRESULT SetParamsBlock(
00619             const void *in_pParamsBlock,    
00620             AkUInt32    in_uBlockSize       
00621             ) = 0;
00622 
00628         virtual AKRESULT SetParam(
00629             AkPluginParamID in_paramID,     
00630             const void *    in_pValue,      
00631             AkUInt32        in_uParamSize   
00632             ) = 0;
00633 
00641         static const AkPluginParamID ALL_PLUGIN_DATA_ID = 0x7FFF;
00642     };
00643 
00647     class IAkPlugin
00648     {
00649     protected:
00651         virtual ~IAkPlugin(){}
00652 
00653     public:
00659         virtual AKRESULT Term(
00660             IAkPluginMemAlloc * in_pAllocator   
00661             ) = 0;
00662 
00668         virtual AKRESULT Reset() = 0;
00669 
00675         virtual AKRESULT GetPluginInfo(
00676             AkPluginInfo & out_rPluginInfo  
00677             ) = 0;
00678 
00686         virtual bool SupportMediaRelocation() const
00687         {
00688             return false;
00689         }
00690 
00703         virtual AKRESULT RelocateMedia(
00704             AkUInt8* /*in_pNewMedia*/,
00705             AkUInt8* /*in_pOldMedia*/
00706             )
00707         {
00708             return AK_NotImplemented;
00709         }
00710 
00711     };
00712 
00714     class IAkEffectPlugin : public IAkPlugin
00715     {
00716     protected:
00718         virtual ~IAkEffectPlugin(){}
00719 
00720     public:
00725         virtual AKRESULT Init(
00726             IAkPluginMemAlloc *         in_pAllocator,              
00727             IAkEffectPluginContext *    in_pEffectPluginContext,    
00728             IAkPluginParam *            in_pParams,                 
00729             AkAudioFormat &             io_rFormat                  
00730             ) = 0;
00731 
00732 #if defined AK_WII_FAMILY_HW
00733 
00734         virtual AXAuxCallback GetFXCallback() = 0;
00735 
00737         virtual void* GetFXParams() = 0;
00738 
00744         virtual AkUInt32 GetTailTime() = 0;
00745 #endif
00746 #ifdef AK_3DS
00747 
00748         virtual void Update() = 0;
00749 
00751         virtual nn::snd::CTR::AuxCallback GetFXCallback() = 0;
00752 
00758         virtual AkUInt32 GetTailTime() = 0;
00759 #endif
00760 #ifdef AK_VITA_HW
00761         virtual const SceNgsVoiceDefinition * GetVoiceDefinition(){ AKASSERT( false && "Non hardware plugin called on Vita HW" ); return NULL; }
00762         virtual AKRESULT AttachVoice( SceNgsHVoice in_hVoice){ AKASSERT( false && "Non hardware plugin called on Vita HW" ); return AK_Fail; }
00763         virtual AkReal32 GetTailTime() const { AKASSERT( false && "Non hardware plugin called on Vita HW" ); return 0; }
00764         virtual AKRESULT SetBypass( SceUInt32 in_uBypassFlag ) { AKASSERT( false && "Non hardware plugin called on Vita HW" ); return AK_Fail; }
00765 #endif
00766     };
00767 
00769     class IAkInPlaceEffectPlugin : public IAkEffectPlugin
00770     {
00771     public:
00779         virtual void Execute(
00780                 AkAudioBuffer *                         io_pBuffer      
00781 #ifdef AK_PS3
00782                 , AK::MultiCoreServices::DspProcess*&   out_pDspProcess 
00783 #endif
00784                 ) = 0;
00785 
00789         virtual AKRESULT TimeSkip(
00790             AkUInt32 in_uFrames 
00791             ) = 0;
00792     };
00793 
00794 
00796     class IAkOutOfPlaceEffectPlugin : public IAkEffectPlugin
00797     {
00798     public:
00805         virtual void Execute(
00806                 AkAudioBuffer *                         in_pBuffer,     
00807                 AkUInt32                                in_uInOffset,   
00808                 AkAudioBuffer *                         out_pBuffer     
00809 #ifdef AK_PS3
00810                 , AK::MultiCoreServices::DspProcess*&   out_pDspProcess 
00811 #endif
00812                 ) = 0;
00813 
00817         virtual AKRESULT TimeSkip(
00818             AkUInt32 &io_uFrames    
00819             ) = 0;
00820     };
00821 
00823     class IAkMixerInputContext
00824     {
00825     protected:
00827         virtual ~IAkMixerInputContext(){}
00828 
00829     public:
00830 
00835         virtual IAkPluginParam * GetInputParam() = 0;
00836 
00839         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00840 
00843         virtual AkConnectionType GetConnectionType() = 0;
00844 
00854         virtual AkUniqueID GetAudioNodeID() = 0;
00855 
00859         virtual void * GetUserData() = 0;
00860 
00864         virtual void SetUserData( void * in_pUserData ) = 0;
00865 
00868 
00869 
00875         virtual bool IsSpatializationEnabled() = 0;
00876 
00882         virtual AkReal32 GetCenterPerc() = 0;
00883 
00888         virtual AkPannerType GetPannerType() = 0;
00889 
00894         virtual AkPositionSourceType GetPositionSourceType() = 0;
00895 
00902         virtual void GetPannerPosition(
00903             AkVector & out_position         
00904             ) = 0;
00905 
00909         virtual AkUInt32 GetNum3DPositions() = 0;
00910 
00919         virtual AKRESULT Get3DPosition(
00920             AkUInt32 in_uIndex,                         
00921             AkEmitterListenerPair & out_soundPosition   
00922             ) = 0;
00923 
00930         virtual AkReal32 GetSpread(
00931             AkUInt32 in_uIndex              
00932             ) = 0;
00933 
00940         virtual AkReal32 GetFocus(
00941             AkUInt32 in_uIndex              
00942             ) = 0;
00943 
00946         virtual bool GetMaxAttenuationDistance(
00947             AkReal32 & out_fMaxAttenuationDistance  
00948             ) = 0;
00949 
00951         virtual void GetSpatializedVolumes(
00952             AK::SpeakerVolumes::MatrixPtr out_mxPrevVolumes,    
00953             AK::SpeakerVolumes::MatrixPtr out_mxNextVolumes     
00954             ) = 0;
00955 
00957     };
00958 
00962     class IAkSinkPluginContext : public IAkPluginContextBase
00963     {
00964     protected:
00966         virtual ~IAkSinkPluginContext(){}
00967 
00968     public:
00969 
00975         virtual bool IsPrimary() = 0;
00976 
00991         virtual AKRESULT SignalAudioThread() = 0;
00992 
00995         virtual AkUInt16 GetNumRefillsInVoice() = 0;
00996     };
00997 
00999     class IAkSinkPlugin : public IAkPlugin
01000     {
01001     protected:
01003         virtual ~IAkSinkPlugin(){}
01004 
01005     public:
01006 
01020 
01021         virtual AKRESULT Init(
01022             IAkPluginMemAlloc *     in_pAllocator,          
01023             IAkSinkPluginContext *  in_pSinkPluginContext,  
01024             IAkPluginParam *        in_pParams,             
01025             AkAudioFormat &         io_rFormat              
01026             ) = 0;
01027 
01035         virtual AKRESULT IsDataNeeded(
01036             AkUInt32 &              out_uNumFramesNeeded    
01037             ) = 0;
01038 
01047         virtual void Consume(
01048             AkAudioBuffer *         in_pInputBuffer,        
01049             AkRamp                  in_gain                 
01050             ) = 0;
01051 
01055         virtual void OnFrameEnd() = 0;
01056 
01059         virtual bool IsStarved() = 0;
01060 
01062         virtual void ResetStarved() = 0;
01063     };
01064 
01066     class IAkSourcePlugin : public IAkPlugin
01067     {
01068     protected:
01070         virtual ~IAkSourcePlugin(){}
01071 
01072     public:
01077         virtual AKRESULT Init(
01078             IAkPluginMemAlloc *         in_pAllocator,                  
01079             IAkSourcePluginContext *    in_pSourcePluginContext,        
01080             IAkPluginParam *            in_pParams,                     
01081             AkAudioFormat &             io_rFormat                      
01082             ) = 0;
01083 
01088         virtual AkReal32 GetDuration() const = 0;
01089 
01097         virtual AkReal32 GetEnvelope() const
01098         {
01099             return 1.f;
01100         }
01101 
01111         virtual AKRESULT StopLooping(){ return AK_Success; }
01112 
01125         virtual AKRESULT Seek(
01126             AkUInt32 /* in_uPosition */ 
01127             ) { return AK_Success; }
01128 
01135         virtual AKRESULT TimeSkip(
01136             AkUInt32 & /*io_uFrames */ 
01137             ) { return AK_NotImplemented; }
01138 
01144         virtual void Execute(
01145                 AkAudioBuffer *                         io_pBuffer      
01146 #ifdef AK_PS3
01147                 , AK::MultiCoreServices::DspProcess*&   out_pDspProcess 
01148 #endif
01149                 ) = 0;
01150     };
01151 
01152 #if defined AK_WII
01153 
01154     static AkForceInline AkInt16 AK_FLOAT_TO_SAMPLETYPE(AkReal32 in_fIn)
01155     {
01156         AkInt32 i32 = (AkInt32)(in_fIn * 0x7FFF);
01157         i32 -= ((i32<=32767)-1)&(i32-32767);
01158         i32 -= ((i32>=-32768)-1)&(i32+32768);
01159         AkInt16 i16 = (AkInt16)i32;
01160         return i16;
01161     }
01162 
01164     static AkForceInline AkInt16 AK_FLOAT_TO_SAMPLETYPE_NOCLIP(AkReal32 in_fIn)
01165     {
01166         return (AkInt16)(in_fIn * 0x7FFF);
01167     }
01168 
01170     static AkForceInline AkReal32 AK_SAMPLETYPE_TO_FLOAT(AkInt16 in_iIn)
01171     {
01172         return (((AkReal32)in_iIn) * (1.f/0x7FFF));
01173     }
01174 #else
01175 
01176     #define AK_FLOAT_TO_SAMPLETYPE( __in__ ) (__in__)
01177 
01178     #define AK_FLOAT_TO_SAMPLETYPE_NOCLIP( __in__ ) (__in__)
01179 
01180     #define AK_SAMPLETYPE_TO_FLOAT( __in__ ) (__in__)
01181 #endif
01182 
01183     #define AK_DBTOLIN( __db__ ) (powf(10.f,(__db__) * 0.05f))
01184 }
01185 
01187 AK_CALLBACK( AK::IAkPlugin*, AkCreatePluginCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
01189 AK_CALLBACK( AK::IAkPluginParam*, AkCreateParamCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
01190 
01191 namespace AK
01192 {
01194     class IAkGlobalPluginContext
01195     {
01196     protected:
01198         virtual ~IAkGlobalPluginContext(){}
01199 
01200     public:
01201 
01203         virtual IAkStreamMgr * GetStreamMgr() const = 0;
01204 
01208         virtual AkUInt16 GetMaxBufferLength() const = 0;
01209 
01212         virtual bool IsRenderingOffline() const = 0;
01213 
01216         virtual AkUInt32 GetSampleRate() const = 0;
01217 
01224         virtual AKRESULT PostMonitorMessage(
01225             const char* in_pszError,                
01226             AK::Monitor::ErrorLevel in_eErrorLevel  
01227             ) = 0;
01228 
01243         virtual AKRESULT RegisterPlugin(
01244             AkPluginType in_eType,                      
01245             AkUInt32 in_ulCompanyID,                    
01246             AkUInt32 in_ulPluginID,                     
01247             AkCreatePluginCallback in_pCreateFunc,      
01248             AkCreateParamCallback in_pCreateParamFunc   
01249             ) = 0;
01250 
01264         virtual AKRESULT RegisterCodec(
01265             AkUInt32 in_ulCompanyID,                        
01266             AkUInt32 in_ulPluginID,                         
01267             AkCreateFileSourceCallback in_pFileCreateFunc,  
01268             AkCreateBankSourceCallback in_pBankCreateFunc   
01269             ) = 0;
01270 
01283         virtual AKRESULT RegisterGlobalCallback(
01284             AkGlobalCallbackFunc in_pCallback,              
01285             AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender, 
01286             void * in_pCookie = NULL                        
01287             ) = 0;
01288 
01298         virtual AKRESULT UnregisterGlobalCallback(
01299             AkGlobalCallbackFunc in_pCallback,              
01300             AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender 
01301             ) = 0;
01302 
01304         virtual AK::IAkPluginMemAlloc * GetAllocator() = 0;
01305 
01307         virtual AKRESULT SetRTPCValue(
01308             AkRtpcID in_rtpcID,                                     
01309             AkRtpcValue in_value,                                   
01310             AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT,
01311             AkTimeMs in_uValueChangeDuration = 0,                   
01312             AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear,   
01313             bool in_bBypassInternalValueInterpolation = false       
01314             ) = 0;
01315 
01320         virtual AKRESULT SendPluginCustomGameData(
01321             AkUniqueID in_busID,        
01322             AkUInt32 in_uFXIndex,       
01323             const void* in_pData,       
01324             AkUInt32 in_uSizeInBytes    
01325             ) = 0;
01326 
01328         virtual void MixNinNChannels(
01329             AkAudioBuffer * in_pInputBuffer,                
01330             AkAudioBuffer * in_pMixBuffer,                  
01331             AkReal32        in_fPrevGain,                   
01332             AkReal32        in_fNextGain,                   
01333             AK::SpeakerVolumes::ConstMatrixPtr in_mxPrevVolumes,
01334             AK::SpeakerVolumes::ConstMatrixPtr in_mxNextVolumes 
01335             ) = 0;
01336 
01338         virtual void Mix1inNChannels(
01339             AkReal32 * AK_RESTRICT in_pInChannel,           
01340             AkAudioBuffer * in_pMixBuffer,                  
01341             AkReal32        in_fPrevGain,                   
01342             AkReal32        in_fNextGain,                   
01343             AK::SpeakerVolumes::ConstVectorPtr in_vPrevVolumes, 
01344             AK::SpeakerVolumes::ConstVectorPtr in_vNextVolumes  
01345             ) = 0;
01346 
01348         virtual void MixChannel(
01349             AkReal32 * AK_RESTRICT in_pInBuffer,            
01350             AkReal32 * AK_RESTRICT in_pOutBuffer,           
01351             AkReal32        in_fPrevGain,                   
01352             AkReal32        in_fNextGain,                   
01353             AkUInt16        in_uNumFrames                   
01354             ) = 0;
01355 
01358         virtual void ComputeAmbisonicsEncoding(
01359             AkReal32            in_fAzimuth,                
01360             AkReal32            in_fElevation,              
01361             AkChannelConfig     in_cfgAmbisonics,           
01362             AK::SpeakerVolumes::VectorPtr out_vVolumes      
01363             ) = 0;
01364 
01371         virtual AKRESULT ComputeWeightedAmbisonicsDecodingFromSampledSphere(
01372             const AkVector      in_samples[],               
01373             AkUInt32            in_uNumSamples,             
01374             AkChannelConfig     in_cfgAmbisonics,           
01375             AK::SpeakerVolumes::MatrixPtr out_mxVolume      
01376             ) = 0;
01377 
01380         virtual const AkAcousticTexture* GetAcousticTexture(
01381             AkAcousticTextureID in_AcousticTextureID        
01382             ) = 0;
01383 
01386         virtual const AkDiffuseReverberator* GetDiffuseReverberator(
01387             AkDiffuseReverberatorID in_DiffuseReverberatorID        
01388             ) = 0;
01389     };
01390 
01393     class PluginRegistration
01394     {
01395     public:
01396         PluginRegistration(
01397             AkPluginType in_eType,                          
01398             AkUInt32 in_ulCompanyID,                        
01399             AkUInt32 in_ulPluginID,                         
01400             AkCreatePluginCallback in_pCreateFunc,          
01401             AkCreateParamCallback in_pCreateParamFunc,      
01402             AkGlobalCallbackFunc in_pRegisterCallback = NULL,   
01403             void * in_pRegisterCallbackCookie = NULL            
01404             )
01405             : pNext(g_pAKPluginList)
01406             , m_eType(in_eType)
01407             , m_ulCompanyID(in_ulCompanyID)
01408             , m_ulPluginID(in_ulPluginID)
01409             , m_pCreateFunc(in_pCreateFunc)
01410             , m_pCreateParamFunc(in_pCreateParamFunc)
01411             , m_pFileCreateFunc(NULL)
01412             , m_pBankCreateFunc(NULL)
01413             , m_pRegisterCallback(in_pRegisterCallback)
01414             , m_pRegisterCallbackCookie(in_pRegisterCallbackCookie)
01415         {
01416             g_pAKPluginList = this;
01417         }
01418 
01419         PluginRegistration(
01420             AkUInt32 in_ulCompanyID,                        
01421             AkUInt32 in_ulPluginID,                         
01422             AkCreateFileSourceCallback in_pCreateFile,      
01423             AkCreateBankSourceCallback in_pCreateBank)      
01424             : pNext(g_pAKPluginList)
01425             , m_eType(AkPluginTypeCodec)
01426             , m_ulCompanyID(in_ulCompanyID)
01427             , m_ulPluginID(in_ulPluginID)
01428             , m_pCreateFunc(NULL)
01429             , m_pCreateParamFunc(NULL)
01430             , m_pFileCreateFunc(in_pCreateFile)
01431             , m_pBankCreateFunc(in_pCreateBank)
01432             , m_pRegisterCallback(NULL)
01433             , m_pRegisterCallbackCookie(NULL)
01434         {
01435             g_pAKPluginList = this;
01436         }
01437 
01438         PluginRegistration *pNext;
01439         AkPluginType m_eType;
01440         AkUInt32 m_ulCompanyID;
01441         AkUInt32 m_ulPluginID;
01442         AkCreatePluginCallback m_pCreateFunc;
01443         AkCreateParamCallback m_pCreateParamFunc;
01444         AkCreateFileSourceCallback m_pFileCreateFunc;
01445         AkCreateBankSourceCallback m_pBankCreateFunc;
01446         AkGlobalCallbackFunc m_pRegisterCallback;
01447         void * m_pRegisterCallbackCookie;
01448     };
01449 }
01450 
01451 #define AK_IMPLEMENT_PLUGIN_FACTORY(_pluginName_, _plugintype_, _companyid_, _pluginid_) \
01452     AK::IAkPlugin* Create##_pluginName_(AK::IAkPluginMemAlloc * in_pAllocator); \
01453     AK::IAkPluginParam * Create##_pluginName_##Params(AK::IAkPluginMemAlloc * in_pAllocator); \
01454     AK::PluginRegistration _pluginName_##Registration(_plugintype_, _companyid_, _pluginid_, Create##_pluginName_, Create##_pluginName_##Params);
01455 
01456 #define AK_STATIC_LINK_PLUGIN(_pluginName_) \
01457     extern AK::PluginRegistration _pluginName_##Registration; \
01458     void *_pluginName_##_linkonceonly = (void*)&_pluginName_##Registration;
01459 
01460 #define DEFINE_PLUGIN_REGISTER_HOOK AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList = NULL;
01461 
01462 #endif // _IAK_PLUGIN_H_

此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅