Table of Contents

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 
00028 /// \file
00029 /// Software source plug-in and effect plug-in interfaces.
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 #include <math.h>
00048 
00049 #if defined AK_CPU_X86  || defined AK_CPU_X86_64
00050 #include <xmmintrin.h>
00051 #endif
00052 
00053 /// Plug-in information structure.
00054 /// \remarks The bIsInPlace field is only relevant for effect plug-ins.
00055 /// \sa
00056 /// - \ref iakeffect_geteffectinfo
00057 struct AkPluginInfo
00058 {
00059     /// Constructor for default values
00060     AkPluginInfo()
00061         : eType(AkPluginTypeNone)
00062         , uBuildVersion( 0 )
00063         , bIsInPlace(true)
00064         , bCanChangeRate(false)
00065         , bReserved(false)
00066     {}
00067 
00068     AkPluginType eType;            ///< Plug-in type
00069     AkUInt32     uBuildVersion;    ///< Plugin build version, must match the AK_WWISESDK_VERSION_COMBINED macro from AkWwiseSDKVersion.h.  Prevents usage of plugins compiled for other versions, avoiding crashes or data issues.
00070     bool         bIsInPlace;       ///< Buffer usage (in-place or not)
00071     bool         bCanChangeRate;   ///< True for effects whose sample throughput is different between input and output. Effects that can change rate need to be out-of-place (!bIsInPlace), and cannot exist on busses.
00072     bool         bReserved;        ///< Legacy bIsAsynchronous plug-in flag, now unused. Preserved for plug-in backward compatibility. bReserved should be false for all plug-in.
00073 };
00074 
00075 //Forward declarations.
00076 namespace AK
00077 {
00078     class PluginRegistration;
00079 }
00080 extern "C" AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList;
00081 
00082 struct AkAcousticTexture;
00083 
00084 namespace AK
00085 {
00086     class IAkStreamMgr;
00087     class IAkGlobalPluginContext;
00088 
00089     /// Game object information available to plugins.
00090     class IAkGameObjectPluginInfo
00091     {
00092     protected:
00093         /// Virtual destructor on interface to avoid warnings.
00094         virtual ~IAkGameObjectPluginInfo(){}
00095 
00096     public:
00097 
00098         /// Get the ID of the game object.
00099         virtual AkGameObjectID GetGameObjectID() const = 0;
00100 
00101         /// Retrieve the number of emitter-listener pairs (rays) of the game object.
00102         /// A game object may have more than one position, and be listened to more than one listener.
00103         /// The returned value is the product of these two numbers. Use the returned value as a higher
00104         /// bound for the index of GetEmitterListenerPair().
00105         /// Note that rays whose listener is irrelevant to the current context are ignored. For example,
00106         /// if the calling plug-in exists on a bus, only listeners that are routed to the end point's
00107         /// device are considered.
00108         /// \sa
00109         /// - AK::SoundEngine::SetPosition()
00110         /// - AK::SoundEngine::SetMultiplePositions()
00111         /// - AK::SoundEngine::SetListeners()
00112         /// - AK::IAkGameObjectPluginInfo::GetEmitterListenerPair()
00113         /// - AK::SoundEngine::AddSecondaryOutput()
00114         virtual AkUInt32 GetNumEmitterListenerPairs() const = 0;
00115 
00116         /// Retrieve the emitter-listener pair (ray) of the game object at index in_uIndex.
00117         /// Call GetNumEmitterListenerPairs() prior to this function to get the total number of
00118         /// emitter-listener pairs of the game object.
00119         /// The emitter-listener pair is expressed as the game object's position relative to the
00120         /// listener, in spherical coordinates.
00121         /// \note
00122         /// - The distance takes game object and listener scaling factors into account.
00123         /// - Returned distance and angles are those of the game object, and do not necessarily correspond
00124         /// to any sound's positioning data.
00125         /// \return AK_Fail if the index is invalid, AK_Success otherwise.
00126         /// \sa
00127         /// - AK::SoundEngine::SetScalingFactor()
00128         /// - AK::IAkGameObjectPluginInfo::GetNumEmitterListenerPairs()
00129         virtual AKRESULT GetEmitterListenerPair(
00130             AkUInt32 in_uIndex,             ///< Index of the pair, [0, GetNumEmitterListenerPairs()[
00131             AkEmitterListenerPair & out_emitterListenerPair ///< Returned relative source position in spherical coordinates.
00132             ) const = 0;
00133 
00134         /// Get the number of positions of the game object. Use this value to determine the indices to be
00135         /// passed to GetGameObjectPosition().
00136         /// \sa
00137         /// - AK::SoundEngine::SetPosition()
00138         /// - AK::SoundEngine::SetMultiplePositions()
00139         /// - AK::IAkGameObjectPluginInfo::GetGameObjectPosition();
00140         virtual AkUInt32 GetNumGameObjectPositions() const = 0;
00141 
00142         /// Get the raw position of the game object at index in_uIndex.
00143         /// Use GetNumGameObjectPositions() prior to this function to get the total number of positions
00144         /// of that game object.
00145         /// \return AK_Fail if the index is out of bounds, AK_Success otherwise.
00146         /// \sa
00147         /// - AK::SoundEngine::SetPosition()
00148         /// - AK::SoundEngine::SetMultiplePositions()
00149         /// - AK::IAkGameObjectPluginInfo::GetNumGameObjectPositions()
00150         virtual AKRESULT GetGameObjectPosition(
00151             AkUInt32 in_uIndex,             ///< Index of the position, [0, GetNumGameObjectPositions()[
00152             AkSoundPosition & out_position  ///< Returned raw position info.
00153             ) const = 0;
00154 
00155         /// Get the multi-position type assigned to the game object.
00156         /// \return MultiPositionType_MultiSources when the effect is instantiated on a bus.
00157         /// \sa
00158         /// - AK::SoundEngine::SetPosition()
00159         /// - AK::SoundEngine::SetMultiplePositions()
00160         virtual SoundEngine::MultiPositionType GetGameObjectMultiPositionType() const = 0;
00161 
00162         /// Get the distance scaling factor of the associated game object.
00163         /// \sa
00164         /// - AK::SoundEngine::SetScalingFactor()
00165         virtual AkReal32 GetGameObjectScaling() const = 0;
00166 
00167         /// Get the game object IDs of listener game objects that are listening to the emitter game object.
00168         /// Note that only listeners relevant to the current context are considered. For example,
00169         /// if the calling plug-in exists on a bus, only listeners that are routed to the end point's
00170         /// device are added to the returned array.
00171         /// \return True if the call succeeded, false if all the listeners could not fit into the array,
00172         /// \sa
00173         /// - AK::SoundEngine::SetListeners()
00174         virtual bool GetListeners( 
00175             AkGameObjectID* out_aListenerIDs,   ///< Array of listener IDs to fill, or NULL to query the size needed.
00176             AkUInt32& io_uSize                  ///< In: max size of the array, out: number of valid elements returned in out_aListenerIDs.
00177             ) const = 0;
00178 
00179         /// Get information about a listener. Use GetListeners() prior to this function
00180         /// in order to know which listeners are listening to the associated game object. 
00181         /// \return AK_Fail if the listener ID is invalid. AK_Success otherwise.
00182         /// \sa
00183         /// - AK::SoundEngine::SetListeners()
00184         /// - AK::IAkGameObjectPluginInfo::GetListeners()
00185         virtual AKRESULT GetListenerData(
00186             AkGameObjectID in_uListener,        ///< Bit field identifying the listener for which you desire information.
00187             AkListener & out_listener           ///< Returned listener info.
00188             ) const = 0;
00189     };
00190 
00191     /// Voice-specific information available to plug-ins. The associated game object's information is
00192     /// available through the methods of the base class IAkGameObjectPluginInfo.
00193     class IAkVoicePluginInfo : public IAkGameObjectPluginInfo
00194     {
00195     protected:
00196         /// Virtual destructor on interface to avoid warnings.
00197         virtual ~IAkVoicePluginInfo(){}
00198 
00199     public:
00200 
00201         /// Retrieve the Playing ID of the event corresponding to this voice (if applicable).
00202         virtual AkPlayingID GetPlayingID() const = 0;
00203 
00204         /// Get priority value associated to this voice. When priority voice is modified by distance, the minimum distance among emitter-listener pairs is used.
00205         /// \return The priority between AK_MIN_PRIORITY and AK_MAX_PRIORITY inclusively.
00206         virtual AkPriority GetPriority() const = 0;
00207 
00208         /// Get priority value associated to this voice, for a specified distance, which may differ from the minimum distance that is used by default.
00209         /// \return The priority between AK_MIN_PRIORITY and AK_MAX_PRIORITY inclusively.
00210         virtual AkPriority ComputePriorityWithDistance(
00211             AkReal32 in_fDistance               ///< Distance.
00212             ) const = 0;
00213     };
00214 
00215     /// Interface to retrieve contextual information available to all types of plugins.
00216     class IAkPluginContextBase
00217     {
00218     protected:
00219         /// Virtual destructor on interface to avoid warnings.
00220         virtual ~IAkPluginContextBase(){}
00221 
00222     public:
00223 
00224         /// \return The global sound engine context.
00225         /// \sa IAkGlobalPluginContext
00226         virtual IAkGlobalPluginContext* GlobalContext() const = 0;
00227 
00228         /// Obtain the interface to access the game object on which the plugin is instantiated.
00229         /// \return The interface to GameObject info.
00230         virtual IAkGameObjectPluginInfo * GetGameObjectInfo() = 0;
00231 
00232         /// Identify the output device into which the data processed by this plugin will end up.
00233         /// Applicable to plug-ins instantiated as bus effects and to sink plugins.
00234         /// Plug-ins instantiated in the Actor-Mixer hierarchy (i.e. on voices) return AK_NotCompatible.
00235         /// \sa integrating_secondary_outputs
00236         /// \return The device type and unique identifier. AK_Success if successful, AK_NotCompatible otherwise.
00237         virtual AKRESULT GetOutputID(
00238             AkUInt32 &          out_uOutputID,      ///< Device identifier, when multiple devices of the same type are possible.
00239             AkPluginID &        out_uDevicePlugin   ///< Device plugin ID.
00240             ) const = 0;
00241 
00242         /// Return the pointer and size of the plug-in media corresponding to the specified index.
00243         /// The pointer returned will be NULL if the plug-in media is either not loaded or inexistant.
00244         /// When this function is called and returns a valid data pointer, the data can only be used by this
00245         /// instance of the plugin and is guaranteed to be valid only during the plug-in lifespan.
00246         virtual void GetPluginMedia(
00247             AkUInt32 in_dataIndex,      ///< Index of the plug-in media to be returned.
00248             AkUInt8* &out_rpData,       ///< Pointer to the data
00249             AkUInt32 &out_rDataSize     ///< size of the data returned in bytes.
00250             ) = 0;
00251 
00252         /// Return the pointer and size of the game data corresponding to the specified index, sent by the game using AK::SoundEngine::SendPluginCustomGameData().
00253         /// The pointer returned will be NULL if the game data is inexistent.
00254         /// When this function is called and returns a valid data pointer, the data can only be used by this 
00255         /// instance of the plugin and is guaranteed to be valid only during the frame.
00256         virtual void GetPluginCustomGameData( 
00257             void* &out_rpData,          ///< Pointer to the data
00258             AkUInt32 &out_rDataSize     ///< size of the data returned in bytes.
00259             ) = 0;
00260 
00261         /// Post a custom blob of data to the UI counterpart of this effect plug-in.
00262         /// Data is sent asynchronously through the profiling system.
00263         /// Notes:
00264         /// - It is only possible to post data when the instance of the plug-in is on a bus,
00265         ///     because there is a one-to-one relationship with its effect settings view.
00266         ///     You may call CanPostMonitorData() to determine if your plug-in can send data to the UI.
00267         /// - Data is copied into the communication buffer within this method,
00268         ///     so you may discard it afterwards.
00269         /// - You need to handle byte swapping on one side or the other when sending
00270         ///     data from a big-endian platform.
00271         /// - Sending data to the UI is only possible in Debug and Profile. Thus, you should
00272         ///     enclose your calls to package and send that data within !AK_OPTIMIZED preprocessor flag.
00273         /// \return AK_Success if the plug-in exists on a bus, AK_Fail otherwise.
00274         virtual AKRESULT PostMonitorData(
00275             void *      in_pData,       ///< Blob of data.
00276             AkUInt32    in_uDataSize    ///< Size of data.
00277             ) = 0;
00278 
00279         /// Query the context to know if it is possible to send data to the UI counterpart of this effect plug-in.
00280         /// It is only possible to post data when the instance of the plug-in is on a bus, because there is a
00281         /// one-to-one relationship with its effect settings view.
00282         /// \return True if the instance of the plug-in is on a bus, and the authoring tool is connected and
00283         ///     monitoring the game, false otherwise.
00284         /// \sa PostMonitorData()
00285         virtual bool     CanPostMonitorData() = 0;
00286 
00287         /// Post a monitoring message or error string. This will be displayed in the Wwise capture
00288         /// log.
00289         /// \return AK_Success if successful, AK_Fail if there was a problem posting the message.
00290         ///         In optimized mode, this function returns AK_NotCompatible.
00291         /// \remark This function is provided as a tracking tool only. It does nothing if it is
00292         ///         called in the optimized/release configuration and return AK_NotCompatible.
00293         virtual AKRESULT PostMonitorMessage(
00294             const char* in_pszError,                ///< Message or error string to be displayed
00295             AK::Monitor::ErrorLevel in_eErrorLevel  ///< Specifies whether it should be displayed as a message or an error
00296             ) = 0;
00297 
00298         /// Get the cumulative gain of all mixing stages, from the host audio node down to the device end point.
00299         /// Returns 1.f when the node is an actor-mixer (voice), because a voice may be routed to several mix chains.
00300         /// \return The cumulative downstream gain.
00301         virtual AkReal32 GetDownstreamGain() = 0;
00302 
00303         /// Return the channel configuration of the parent node that this effect will mix into.  GetParentChannelConfig() may be used to set the output configuration of an
00304         /// out-of-place effect to avoid additional up/down mixing stages.  Please note however that it is possible for out-of-place effects later in the chain to change
00305         /// this configuration.
00306         /// Returns !out_channelConfig.IsValid() when the node is an actor-mixer (voice), because a voice may be routed to several mix chains.
00307         /// \return AK_Success if the channel config of the primary, direct parent bus could be determined, AK_Fail otherwise.
00308         virtual AKRESULT GetParentChannelConfig(
00309             AkChannelConfig& out_channelConfig  ///< Channel configuration of parent node (downstream bus).
00310             ) const = 0;
00311 
00312 #if (defined AK_CPU_X86 || defined AK_CPU_X86_64) && !(defined AK_IOS)
00313         /// Return an interface to query processor specific features.
00314         virtual IAkProcessorFeatures * GetProcessorFeatures() = 0;
00315 #endif
00316     };
00317 
00318     /// Interface to retrieve contextual information for an effect plug-in.
00319     /// \sa
00320     /// - \ref iakmonadiceffect_init
00321     class IAkEffectPluginContext : public IAkPluginContextBase
00322     {
00323     protected:
00324         /// Virtual destructor on interface to avoid warnings.
00325         virtual ~IAkEffectPluginContext(){}
00326 
00327     public:
00328 
00329         /// Determine whether the effect is to be used in Send Mode or not.
00330         /// Effects used in auxiliary busses are always used in Send Mode.
00331         /// \return True if the effect is in Send Mode, False otherwise
00332         virtual bool IsSendModeEffect() const = 0;
00333 
00334         /// Obtain the interface to access the voice in which the plugin is inserted.
00335         /// \return The interface to voice info. NULL if the plugin is instantiated on a bus.
00336         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00337 
00338         /// Get internal ID of sound structure (sound object or bus) on which the plug-in is instantiated.
00339         /// In the case of a voice, the ID is internal but corresponds to what you would get from the duration 
00340         /// callback (see AkDurationCallbackInfo::audioNodeID). In the case of a bus, it can be matched with the bus name converted 
00341         /// to a unique ID using AK::SoundEngine::GetIDFromString(). Returns AK_INVALID_UNIQUE_ID in the case of a sink/device.
00342         /// \return ID of structure.
00343         /// \sa 
00344         /// - AkDurationCallbackInfo
00345         /// - AK::SoundEngine::PostEvent()
00346         /// - AK::SoundEngine::GetIDFromString()
00347         virtual AkUniqueID GetNodeID() const = 0;
00348     };
00349 
00350     /// Interface to retrieve contextual information for a source plug-in.
00351     /// \sa
00352     /// - \ref iaksourceeffect_init
00353     class IAkSourcePluginContext : public IAkPluginContextBase
00354     {
00355     protected:
00356         /// Virtual destructor on interface to avoid warnings.
00357         virtual ~IAkSourcePluginContext(){}
00358 
00359     public:
00360 
00361         /// Retrieve the number of loops the source should produce.
00362         /// \return The number of loop iterations the source should produce (0 if infinite looping)
00363         virtual AkUInt16 GetNumLoops() const = 0;
00364 
00365         /// Obtain the interface to access the voice in which the plugin is inserted.
00366         /// \return The interface to voice info.
00367         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00368 
00369         /// Obtain the MIDI event info associated to the source.
00370         /// \return The MIDI event info.
00371         /// 
00372         virtual AkMIDIEvent GetMidiEvent() const = 0;
00373 
00374         /// Get internal ID of sound structure (sound object or bus) on which the plug-in is instantiated.
00375         /// In the case of a voice, the ID is internal but corresponds to what you would get from the duration 
00376         /// callback (see AkDurationCallbackInfo::audioNodeID). In the case of a bus, it can be matched with the bus name converted 
00377         /// to a unique ID using AK::SoundEngine::GetIDFromString(). Returns AK_INVALID_UNIQUE_ID in the case of a sink/device.
00378         /// \return ID of structure.
00379         /// \sa 
00380         /// - AkDurationCallbackInfo
00381         /// - AK::SoundEngine::PostEvent()
00382         /// - AK::SoundEngine::GetIDFromString()
00383         virtual AkUniqueID GetNodeID() const = 0;
00384 
00385         /// Retrieve Cookie information for a Source Plugin
00386         /// \return the void pointer of the Cookie passed to the PostEvent 
00387         virtual void* GetCookie() const = 0;    
00388 
00389     };
00390 
00391     /// Interface to retrieve contextual information for a mixer.
00392     class IAkMixerPluginContext : public IAkPluginContextBase
00393     {
00394     protected:
00395         /// Virtual destructor on interface to avoid warnings.
00396         virtual ~IAkMixerPluginContext(){}
00397 
00398     public:
00399 
00400         /// Get ID of bus on which the plugin is inserted. It can be matched with the bus name converted to a unique ID using AK::SoundEngine::GetIDFromString().
00401         /// \return ID of bus.
00402         /// \sa AK::SoundEngine::GetIDFromString()
00403         virtual AkUniqueID GetBusID() = 0;
00404 
00405         /// DEPRECATED.  
00406         /// Get the type of the bus on which the mixer plugin is instantiated.
00407         /// AkBusHierachyFlags is a bit field, indicating whether the bus is the master (top-level) bus or not,
00408         /// and whether it is in the primary or secondary mixing graph.
00409         /// \return The bus type.
00410         virtual AkUInt32 GetBusType() = 0;
00411 
00412         /// Get speaker angles of the specified device.
00413         /// The speaker angles are expressed as an array of loudspeaker pairs, in degrees, relative to azimuth ]0,180].
00414         /// Supported loudspeaker setups are always symmetric; the center speaker is always in the middle and thus not specified by angles.
00415         /// Angles must be set in ascending order.
00416         /// You may call this function with io_pfSpeakerAngles set to NULL to get the expected number of angle values in io_uNumAngles,
00417         /// in order to allocate your array correctly. You may also obtain this number by calling
00418         /// AK::GetNumberOfAnglesForConfig( AK_SPEAKER_SETUP_DEFAULT_PLANE ).
00419         /// If io_pfSpeakerAngles is not NULL, the array is filled with up to io_uNumAngles.
00420         /// Typical usage:
00421         /// - AkUInt32 uNumAngles;
00422         /// - GetSpeakerAngles( NULL, uNumAngles );
00423         /// - AkReal32 * pfSpeakerAngles = AkAlloca( uNumAngles * sizeof(AkReal32) );
00424         /// - GetSpeakerAngles( pfSpeakerAngles, uNumAngles );
00425         /// \warning Call this function only after the sound engine has been properly initialized.
00426         /// \return AK_Success if the end point device is properly initialized, AK_Fail otherwise.
00427         /// \sa AK::SoundEngine::GetSpeakerAngles()
00428         virtual AKRESULT GetSpeakerAngles(
00429             AkReal32 *          io_pfSpeakerAngles,         ///< Returned array of loudspeaker pair angles, in degrees relative to azimuth [0,180]. Pass NULL to get the required size of the array.
00430             AkUInt32 &          io_uNumAngles,              ///< Returned number of angles in io_pfSpeakerAngles, which is the minimum between the value that you pass in, and the number of angles corresponding to the output configuration, or just the latter if io_pfSpeakerAngles is NULL.
00431             AkReal32 &          out_fHeightAngle            ///< Elevation of the height layer, in degrees relative to the plane.
00432             ) = 0;
00433 
00434         /// \name Services.
00435         //@{
00436 
00437         /// Compute a direct speaker assignment volume matrix with proper downmixing rules between two channel configurations.
00438         virtual AKRESULT ComputeSpeakerVolumesDirect(
00439             AkChannelConfig     in_inputConfig,             ///< Channel configuration of the input.
00440             AkChannelConfig     in_outputConfig,            ///< Channel configuration of the mixer output.
00441             AkReal32            in_fCenterPerc,             ///< Center percentage. Only applies to mono inputs with standard output configurations that have a center channel.
00442             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     ///< Returned volumes matrix. Must be preallocated using AK::SpeakerVolumes::Matrix::GetRequiredSize() (see AK::SpeakerVolumes::Matrix services).
00443             ) = 0;
00444 
00445         /// Compute a volume matrix given the position of the panner (Wwise 2D panner).
00446         virtual AKRESULT ComputeSpeakerVolumesPanner(
00447             const AkVector &    in_position,                ///< x,y,z panner position [-1,1]. Note that z has no effect at the moment.
00448             AkReal32            in_fCenterPct,              ///< Center percentage.
00449             AkChannelConfig     in_inputConfig,             ///< Channel configuration of the input.
00450             AkChannelConfig     in_outputConfig,            ///< Channel configuration of the mixer output.
00451             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     ///< Returned volumes matrix. Must be preallocated using AK::SpeakerVolumes::Matrix::GetRequiredSize() (see AK::SpeakerVolumes::Matrix services).
00452             ) = 0;
00453 
00454         /// Compute panning gains on the plane given an incidence angle and channel configuration.
00455         /// \return AK_Success if successful, AK_Fail otherwise.
00456         virtual AKRESULT ComputePlanarVBAPGains(
00457             AkReal32            in_fAngle,                  ///< Incident angle, in radians [-pi,pi], where 0 is the azimuth (positive values are clockwise)
00458             AkChannelConfig     in_outputConfig,            ///< Desired output configuration.
00459             AkReal32            in_fCenterPerc,             ///< Center percentage. Only applies to mono inputs to outputs that have no center.
00460             AK::SpeakerVolumes::VectorPtr out_vVolumes      ///< Returned volumes (see AK::SpeakerVolumes::Vector services). Must be allocated prior to calling this function with the size returned by AK::SpeakerVolumes::Vector::GetRequiredSize() for the desired configuration.
00461             ) = 0;
00462 
00463         /// Initialize spherical VBAP
00464         /// \return AK_Success if successful, AK_Fail otherwise.
00465         virtual AKRESULT InitSphericalVBAP(
00466             AK::IAkPluginMemAlloc* in_pAllocator,           ///< Memory allocator
00467             const AkSphericalCoord* in_SphericalPositions,  ///< Array of points in spherical coordinate, representign the virtual position of each channels.
00468             const AkUInt32 in_NbPoints,                     ///< Number of points in the position array
00469             void *& out_pPannerData                         ///< Contains data relevant to the 3D panner that shoud be re-used accross plugin instances.
00470             ) = 0;
00471 
00472         /// Compute panning gains on the plane given an incidence angle and channel configuration.
00473         /// \return AK_Success if successful, AK_Fail otherwise.
00474         virtual AKRESULT ComputeSphericalVBAPGains(
00475             void*               in_pPannerData,             ///< Contains data relevant to the 3D panner that shoud be re-used accross plugin instances.
00476             AkReal32            in_fAzimuth,                ///< Incident angle, in radians [-pi,pi], where 0 is the azimuth (positive values are clockwise)
00477             AkReal32            in_fElevation,              ///< Incident angle, in radians [0,pi], where 0 is the elevation (positive values are clockwise)
00478             AkUInt32            in_uNumChannels,            ///< Number of output channels.
00479             AK::SpeakerVolumes::VectorPtr out_vVolumes      ///< Returned volumes (see AK::SpeakerVolumes::Vector services). Must be allocated prior to calling this function with the size returned by AK::SpeakerVolumes::Vector::GetRequiredSize() for the desired configuration.
00480             ) = 0;
00481 
00482         /// Clear panner data obtained from InitSphericalVBAP().
00483         /// \return AK_Success if successful, AK_Fail otherwise.
00484         virtual AKRESULT TermSphericalVBAP(
00485             AK::IAkPluginMemAlloc*  in_pAllocator,          ///< Memory allocator
00486             void*                   in_pPannerData          ///< Contains data relevant to the 3D panner that shoud be re-used accross plugin instances.
00487             ) = 0;
00488 
00489         /// Compute standard 3D positioning.
00490         /// \return AK_Success if successful.
00491         /// \aknote The cartesian counterpart of Compute3DPositioning, that uses emitter and listener transforms, should be used instead of this function.
00492         /// It is more complete and more efficient. \endaknote
00493         virtual AKRESULT Compute3DPositioning(
00494             AkReal32            in_fAngle,                  ///< Incident angle, in radians [-pi,pi], where 0 is the azimuth (positive values are clockwise).
00495             AkReal32            in_fElevation,              ///< Incident elevation angle, in radians [-pi/2,pi/2], where 0 is the horizon (positive values are above the horizon).
00496             AkReal32            in_fSpread,                 ///< Spread ([0,100]).
00497             AkReal32            in_fFocus,                  ///< Focus ([0,100]).
00498             AkChannelConfig     in_inputConfig,             ///< Channel configuration of the input.
00499             AkChannelMask       in_uInputChanSel,           ///< Mask of input channels selected for panning (excluded input channels don't contribute to the output).
00500             AkChannelConfig     in_outputConfig,            ///< Desired output configuration.
00501             AkReal32            in_fCenterPerc,             ///< Center percentage. Only applies to mono inputs to outputs that have a center.
00502             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     ///< Returned volumes matrix. Must be preallocated using AK::SpeakerVolumes::Matrix::GetRequiredSize() (see AK::SpeakerVolumes::Matrix services).
00503             ) = 0;
00504 
00505         /// Compute standard 3D positioning.
00506         /// \return AK_Success if successful.
00507         /// \aknote This function is more complete and more efficient than the Compute3DPositioning service that uses spherical coordinates, and should be favored.\endaknote
00508         virtual AKRESULT Compute3DPositioning(
00509             const AkTransform & in_emitter,                 ///< Emitter transform.
00510             const AkTransform & in_listener,                ///< Listener transform.
00511             AkReal32            in_fCenterPerc,             ///< Center percentage. Only applies to mono inputs to outputs that have a center.
00512             AkReal32            in_fSpread,                 ///< Spread.
00513             AkReal32            in_fFocus,                  ///< Focus.
00514             AkChannelConfig     in_inputConfig,             ///< Channel configuration of the input.
00515             AkChannelMask       in_uInputChanSel,           ///< Mask of input channels selected for panning (excluded input channels don't contribute to the output).
00516             AkChannelConfig     in_outputConfig,            ///< Desired output configuration.
00517             AK::SpeakerVolumes::MatrixPtr out_mxVolumes     ///< Returned volumes matrix. Must be preallocated using AK::SpeakerVolumes::Matrix::GetRequiredSize() (see AK::SpeakerVolumes::Matrix services).
00518             ) = 0;
00519 
00520         //@}
00521 
00522         /// \name Metering.
00523         //@{
00524 
00525         /// Set flags for controlling computation of metering values on the mix buffer.
00526         /// Pass AK_NoMetering to disable metering.
00527         /// \sa
00528         /// - AK::IAkMetering
00529         virtual void EnableMetering( AkMeteringFlags in_eFlags ) = 0;
00530 
00531         //@}
00532     };
00533 
00534     /// Parameter node interface, managing access to an enclosed parameter structure.
00535     /// \aknote The implementer of this interface should also expose a static creation function
00536     /// that will return a new parameter node instance when required (see \ref se_plugins_overview). \endaknote
00537     /// \sa
00538     /// - \ref shared_parameter_interface
00539     class IAkPluginParam : public IAkRTPCSubscriber
00540     {
00541     protected:
00542         /// Virtual destructor on interface to avoid warnings.
00543         virtual ~IAkPluginParam(){}
00544 
00545     public:
00546         /// Create a duplicate of the parameter node instance in its current state.
00547         /// \aknote The allocation of the new parameter node should be done through the AK_PLUGIN_NEW() macro. \endaknote
00548         /// \return Pointer to a duplicated plug-in parameter node interface
00549         /// \sa
00550         /// - \ref iakeffectparam_clone
00551         virtual IAkPluginParam * Clone(
00552             IAkPluginMemAlloc * in_pAllocator   ///< Interface to memory allocator to be used
00553             ) = 0;
00554 
00555         /// Initialize the plug-in parameter node interface.
00556         /// Initializes the internal parameter structure to default values or with the provided parameter
00557         /// block if it is valid. \endaknote
00558         /// \aknote If the provided parameter block is valid, use SetParamsBlock() to set all parameters at once. \endaknote
00559         /// \return Possible return values are: AK_Success, AK_Fail, AK_InvalidParameter
00560         /// \sa
00561         /// - \ref iakeffectparam_init
00562         virtual AKRESULT Init(
00563             IAkPluginMemAlloc * in_pAllocator,      ///< Interface to the memory allocator to be used
00564             const void *        in_pParamsBlock,    ///< Pointer to a parameter structure block
00565             AkUInt32            in_uBlockSize       ///< Size of the parameter structure block
00566             ) = 0;
00567 
00568         /// Called by the sound engine when a parameter node is terminated.
00569         /// \aknote The self-destruction of the parameter node must be done using the AK_PLUGIN_DELETE() macro. \endaknote
00570         /// \return AK_Success if successful, AK_Fail otherwise
00571         /// \sa
00572         /// - \ref iakeffectparam_term
00573         virtual AKRESULT Term(
00574             IAkPluginMemAlloc * in_pAllocator       ///< Interface to memory allocator to be used
00575             ) = 0;
00576 
00577         /// Set all plug-in parameters at once using a parameter block.
00578         /// \return AK_Success if successful, AK_InvalidParameter otherwise
00579         /// \sa
00580         /// - \ref iakeffectparam_setparamsblock
00581         virtual AKRESULT SetParamsBlock(
00582             const void *in_pParamsBlock,    ///< Pointer to a parameter structure block
00583             AkUInt32    in_uBlockSize       ///< Size of the parameter structure block
00584             ) = 0;
00585 
00586         /// Update a single parameter at a time and perform the necessary actions on the parameter changes.
00587         /// \aknote The parameter ID corresponds to the AudioEnginePropertyID in the plug-in XML description file. \endaknote
00588         /// \return AK_Success if successful, AK_InvalidParameter otherwise
00589         /// \sa
00590         /// - \ref iakeffectparam_setparam
00591         virtual AKRESULT SetParam(
00592             AkPluginParamID in_paramID,     ///< ID number of the parameter to set
00593             const void *    in_pValue,      ///< Pointer to the value of the parameter to set
00594             AkUInt32        in_uParamSize   ///< Size of the value of the parameter to set
00595             ) = 0;
00596 
00597         /// Use this constant with AK::Wwise::IPluginPropertySet::NotifyInternalDataChanged,
00598         /// AK::Wwise::IAudioPlugin::GetPluginData and IAkPluginParam::SetParam. This tells
00599         /// that the whole plugin data needs to be saved/transferred.
00600         ///\sa
00601         /// - AK::Wwise::IPluginPropertySet::NotifyInternalDataChanged
00602         /// - AK::Wwise::IAudioPlugin::GetPluginData
00603         /// - AK::IAkPluginParam::SetParam
00604         static const AkPluginParamID ALL_PLUGIN_DATA_ID = 0x7FFF;
00605     };
00606 
00607     /// Wwise sound engine plug-in interface. Shared functionality across different plug-in types.
00608     /// \aknote The implementer of this interface should also expose a static creation function
00609     /// that will return a new plug-in instance when required (see \ref soundengine_plugins). \endaknote
00610     class IAkPlugin
00611     {
00612     protected:
00613         /// Virtual destructor on interface to avoid warnings.
00614         virtual ~IAkPlugin(){}
00615 
00616     public:
00617         /// Release the resources upon termination of the plug-in.
00618         /// \return AK_Success if successful, AK_Fail otherwise
00619         /// \aknote The self-destruction of the plug-in must be done using AK_PLUGIN_DELETE() macro. \endaknote
00620         /// \sa
00621         /// - \ref iakeffect_term
00622         virtual AKRESULT Term(
00623             IAkPluginMemAlloc * in_pAllocator   ///< Interface to memory allocator to be used by the plug-in
00624             ) = 0;
00625 
00626         /// The reset action should perform any actions required to reinitialize the state of the plug-in
00627         /// to its original state (e.g. after Init() or on effect bypass).
00628         /// \return AK_Success if successful, AK_Fail otherwise.
00629         /// \sa
00630         /// - \ref iakeffect_reset
00631         virtual AKRESULT Reset() = 0;
00632 
00633         /// Plug-in information query mechanism used when the sound engine requires information
00634         /// about the plug-in to determine its behavior
00635         /// \return AK_Success if successful.
00636         /// \sa
00637         /// - \ref iakeffect_geteffectinfo
00638         virtual AKRESULT GetPluginInfo(
00639             AkPluginInfo & out_rPluginInfo  ///< Reference to the plug-in information structure to be retrieved
00640             ) = 0;
00641 
00642         /// Some plug-ins are accessing Media from the Wwise sound bank system.
00643         /// If the IAkPlugin object is not using media, this function will not be used and should simply return false.
00644         /// If the IAkPlugin object is using media, the RelocateMedia feature can be optionally implemented.
00645         /// To implement correctly the feature, the plugin must be able to "Hot swap" from a memory location to another one in a single blocking call (AK::IAkPlugin::RelocateMedia)
00646         ///
00647         /// \sa
00648         /// - AK::IAkPlugin::RelocateMedia
00649         virtual bool SupportMediaRelocation() const
00650         {
00651             return false;
00652         }
00653 
00654         /// Some plug-ins are accessing Media from the Wwise sound bank system.
00655         /// If the IAkPlugin object is not using media, this function will not be used.
00656         /// If the IAkPlugin object is using media, the RelocateMedia feature can be optionally implemented.
00657         /// When this function is being called, the IAkPlugin object must make the required changes to remove all
00658         /// referenced from the old memory pointer (previously obtained by GetPluginMedia() (and offsets to) to not access anymore the content of the old memory data and start using the newly provided pointer instead.
00659         /// The change must be done within the function RelocateMedia().
00660         /// After this call, the memory space in in_pOldInMemoryData will be invalidated and cannot be used safely anymore.
00661         ///
00662         /// This function will not be called if SupportMediaRelocation returned false.
00663         ///
00664         /// \sa
00665         /// - AK::IAkPlugin::SupportMediaRelocation
00666         virtual AKRESULT RelocateMedia(
00667             AkUInt8* /*in_pNewMedia*/,
00668             AkUInt8* /*in_pOldMedia*/
00669             )
00670         {
00671             return AK_NotImplemented;
00672         }
00673 
00674     };
00675 
00676     /// Software effect plug-in interface (see \ref soundengine_plugins_effects).
00677     class IAkEffectPlugin : public IAkPlugin
00678     {
00679     protected:
00680         /// Virtual destructor on interface to avoid warnings.
00681         virtual ~IAkEffectPlugin(){}
00682 
00683     public:
00684         /// Software effect plug-in initialization. Prepares the effect for data processing, allocates memory and sets up the initial conditions.
00685         /// \aknote Memory allocation should be done through appropriate macros (see \ref fx_memory_alloc). \endaknote
00686         /// \sa
00687         /// - \ref iakmonadiceffect_init
00688         virtual AKRESULT Init(
00689             IAkPluginMemAlloc *         in_pAllocator,              ///< Interface to memory allocator to be used by the effect
00690             IAkEffectPluginContext *    in_pEffectPluginContext,    ///< Interface to effect plug-in's context
00691             IAkPluginParam *            in_pParams,                 ///< Interface to plug-in parameters
00692             AkAudioFormat &             io_rFormat                  ///< Audio data format of the input/output signal. Only an out-of-place plugin is allowed to change the channel configuration.
00693             ) = 0;
00694     };
00695 
00696     /// Software effect plug-in interface for in-place processing (see \ref soundengine_plugins_effects).
00697     class IAkInPlaceEffectPlugin : public IAkEffectPlugin
00698     {
00699     public:
00700         /// Software effect plug-in DSP execution for in-place processing.
00701         /// \aknote The effect should process all the input data (uValidFrames) as long as AK_DataReady is passed in the eState field.
00702         /// When the input is finished (AK_NoMoreData), the effect can output more sample than uValidFrames up to MaxFrames() if desired.
00703         /// All sample frames beyond uValidFrames are not initialized and it is the responsibility of the effect to do so when outputting an effect tail.
00704         /// The effect must notify the pipeline by updating uValidFrames if more frames are produced during the effect tail.
00705         /// \aknote The effect will stop being called by the pipeline when AK_NoMoreData is returned in the the eState field of the AkAudioBuffer structure.
00706         /// See \ref iakmonadiceffect_execute_general.
00707         virtual void Execute(
00708                 AkAudioBuffer *                         io_pBuffer      ///< In/Out audio buffer data structure (in-place processing)
00709                 ) = 0;
00710 
00711         /// Skips execution of some frames, when the voice is virtual playing from elapsed time.
00712         /// This can be used to simulate processing that would have taken place (e.g. update internal state).
00713         /// Return AK_DataReady or AK_NoMoreData, depending if there would be audio output or not at that point.
00714         virtual AKRESULT TimeSkip(
00715             AkUInt32 in_uFrames ///< Number of frames the audio processing should advance.
00716             ) = 0;
00717     };
00718 
00719 
00720     /// Software effect plug-in interface for out-of-place processing (see \ref soundengine_plugins_effects).
00721     class IAkOutOfPlaceEffectPlugin : public IAkEffectPlugin
00722     {
00723     public:
00724         /// Software effect plug-in for out-of-place processing.
00725         /// \aknote An input buffer is provided and will be passed back to Execute() (with an advancing offset based on uValidFrames consumption by the plug-in).
00726         /// The output buffer should be filled entirely by the effect (at which point it can report AK_DataReady) except on last execution where AK_NoMoreData should be used.
00727         /// AK_DataNeeded should be used when more input data is necessary to continue processing.
00728         /// \aknote Only the output buffer eState field is looked at by the pipeline to determine the effect state.
00729         /// See \ref iakmonadiceffect_execute_outofplace.
00730         virtual void Execute(
00731                 AkAudioBuffer *                         in_pBuffer,     ///< Input audio buffer data structure
00732                 AkUInt32                                in_uInOffset,   ///< Offset position into input buffer data
00733                 AkAudioBuffer *                         out_pBuffer     ///< Output audio buffer data structure
00734                 ) = 0;
00735 
00736         /// Skips execution of some frames, when the voice is virtual playing from elapsed time.
00737         /// This can be used to simulate processing that would have taken place (e.g. update internal state).
00738         /// Return AK_DataReady or AK_NoMoreData, depending if there would be audio output or not at that point.
00739         virtual AKRESULT TimeSkip(
00740             AkUInt32 &io_uFrames    ///< Number of frames the audio processing should advance.  The output value should be the number of frames that would be consumed to output the number of frames this parameter has at the input of the function.
00741             ) = 0;
00742     };
00743 
00744     /// Interface to retrieve information about an input of a mixer.
00745     class IAkMixerInputContext
00746     {
00747     protected:
00748         /// Virtual destructor on interface to avoid warnings.
00749         virtual ~IAkMixerInputContext(){}
00750 
00751     public:
00752 
00753         /// Obtain the parameter blob for the mixer plugin that were attached to this input.
00754         /// \return The parameter blob, which can be safely cast into the plugin's implementation.
00755         /// If all parameters are default value, NULL is returned. It is up to the plugin's implementation to know
00756         /// what the default values are.
00757         virtual IAkPluginParam * GetInputParam() = 0;
00758 
00759         /// Obtain the interface to access the voice info of this input.
00760         /// \return The interface to voice info. NULL when the input is not a voice but the output of another bus instead.
00761         virtual IAkVoicePluginInfo * GetVoiceInfo() = 0;
00762 
00763         /// Query the nature of the connection between this input and the mixer.
00764         /// \return The connection type (direct/dry, user-defined auxiliary send, game-defined auxiliary send). Bus inputs are always "direct".
00765         virtual AkConnectionType GetConnectionType() = 0;
00766 
00767         /// Get internal ID of sound associated to this input.
00768         /// In the case of a voice, the ID is internal but corresponds to what you would get from the duration
00769         /// callback (see AkDurationCallbackInfo::audioNodeID). In the case of a bus, it can be matched with the bus name converted
00770         /// to a unique ID using AK::SoundEngine::GetIDFromString().
00771         /// \return ID of input.
00772         /// \sa
00773         /// - AkDurationCallbackInfo
00774         /// - AK::SoundEngine::PostEvent()
00775         /// - AK::SoundEngine::GetIDFromString()
00776         virtual AkUniqueID GetAudioNodeID() = 0;
00777 
00778         /// Use this method to retrieve user data to this context. It is always initialized to NULL until you decide to set it otherwise.
00779         /// \return Attached user data.
00780         /// \sa SetUserData()
00781         virtual void * GetUserData() = 0;
00782 
00783         /// Use this method to attach user data to this context. It is always initialized to NULL until you decide to set it otherwise.
00784         /// \return Attached user data.
00785         /// \sa GetUserData()
00786         virtual void SetUserData( void * in_pUserData ) = 0;
00787 
00788         /// \name Default positioning information.
00789         /// \warning The methods of this group are deprecated.
00790         //@{
00791 
00792         /// Retrieve center percentage of this input.
00793         /// \return Center percentage, between 0 and 1.
00794         virtual AkReal32 GetCenterPerc() = 0;
00795 
00796         /// Retrieve the speaker panning type: type of panning logic when object is not 3D spatialized.
00797         /// Note that the returned value is only relevant when the object is not 3D spatialized,
00798         /// that is Get3DSpatializationMode returns AK_SpatializationMode_None.
00799         /// \sa
00800         /// - Get3DSpatializationMode()
00801         virtual AkSpeakerPanningType GetSpeakerPanningType() = 0;
00802 
00803         /// Speaker panning:
00804         /// Retrieve the panner position (each vector component is between -1 and 1) of this input.
00805         /// Note that the returned value is only relevant when the object is not 3D spatialized,
00806         /// (Get3DSpatializationMode returns AK_SpatializationMode_None), and if speaker panning is not direct assignment
00807         /// (GetSpeakerPanningType does not return AK_DirectSpeakerAssignment).
00808         /// \sa
00809         /// - GetSpeakerPanningType()
00810         /// - Get3DSpatializationMode()
00811         virtual void GetPannerPosition(
00812             AkVector & out_position         ///< Returned sound position.
00813             ) = 0;
00814 
00815         /// Get the value of this input's Listener Relative Routing option, that is, if the emitter-listener relative 
00816         /// association is calculated at this node. Listener Relative Routing needs to be calculated in order for a node
00817         /// to be spatialized or attenuated with respect to in-game emitter and listener positions. Otherwise it can only
00818         /// be panned.
00819         /// \sa
00820         /// - Get3DSpatializationMode()
00821         /// - Get3DPositionType()
00822         /// - GetNum3DPositions()
00823         virtual bool HasListenerRelativeRouting() = 0;
00824 
00825         /// Get whether the emitter position is defined by the game alone (AK_3DPositionType_Emitter), or if it is further automated 
00826         /// (AK_3DPositionType_EmitterWithAutomation, AK_3DPositionType_ListenerWithAutomation).
00827         /// The resulting 3D position(s) may be obtained by Get3DPosition(), and used for 3D spatialization or attenuation.
00828         /// \sa
00829         /// - Get3DPosition()
00830         /// - GetNum3DPositions()
00831         /// - HasListenerRelativeRouting()
00832         virtual Ak3DPositionType Get3DPositionType() = 0;
00833 
00834         /// 3D spatialization:
00835         /// Retrieve the number of emitter-listener pairs (rays) of this input.
00836         /// Note that the returned value is always 0 unless the input has listener relative routing (see HasListenerRelativeRouting()).
00837         /// Use this function with Get3DPosition().
00838         /// \sa
00839         /// - Get3DPosition()
00840         /// - HasListenerRelativeRouting()
00841         virtual AkUInt32 GetNum3DPositions() = 0;
00842 
00843         /// 3D spatialization:
00844         /// Retrieve the spherical coordinates of the desired emitter-listener pair (ray) corresponding to this
00845         /// input, as automated by the engine. Applicable only when the input has listener relative routing (see HasListenerRelativeRouting()).
00846         /// Returned rays are those that result from engine automation, if applicable.
00847         /// \return AK_Success if the pair index is valid, AK_Fail otherwise.
00848         /// \sa
00849         /// - HasListenerRelativeRouting()
00850         /// - GetNum3DPositions()
00851         virtual AKRESULT Get3DPosition(
00852             AkUInt32 in_uIndex,                         ///< Index of the pair, [0, GetNum3DPositions()[
00853             AkEmitterListenerPair & out_soundPosition   ///< Returned sound position, in spherical coordinates.
00854             ) = 0;
00855 
00856         /// 3D spatialization:
00857         /// Evaluate spread value at the distance of the desired emitter-listener pair for this input.
00858         /// Applicable only when the input has listener relative routing (see HasListenerRelativeRouting()).
00859         /// \return The spread value, between 0 and 100. 0 if the pair index is invalid.
00860         /// \sa
00861         /// - HasListenerRelativeRouting()
00862         /// - GetNum3DPositions()
00863         /// - Get3DPosition()
00864         virtual AkReal32 GetSpread(
00865             AkUInt32 in_uIndex              ///< Index of the pair, [0, GetNum3DPositions()[
00866             ) = 0;
00867 
00868         /// 3D spatialization:
00869         /// Evaluate focus value at the distance of the desired emitter-listener pair for this input.
00870         /// Applicable only when the input has listener relative routing (see HasListenerRelativeRouting()).
00871         /// \return The focus value, between 0 and 100. 0 if the pair index is invalid.
00872         /// \sa
00873         /// - HasListenerRelativeRouting()
00874         /// - GetNum3DPositions()
00875         /// - Get3DPosition()
00876         virtual AkReal32 GetFocus(
00877             AkUInt32 in_uIndex              ///< Index of the pair, [0, GetNum3DPositions()[
00878             ) = 0;
00879 
00880         /// Get the max distance as defined in the attenuation editor.
00881         /// Applicable only when the input has listener relative routing (see HasListenerRelativeRouting()).
00882         /// \return True if this input has attenuation, false otherwise.
00883         virtual bool GetMaxAttenuationDistance(
00884             AkReal32 & out_fMaxAttenuationDistance  ///< Returned max distance.
00885             ) = 0;
00886 
00887         /// Get next volumes as computed by the sound engine for this input.
00888         virtual void GetSpatializedVolumes(
00889             AK::SpeakerVolumes::MatrixPtr out_mxPrevVolumes,    ///< Returned in/out channel volume distribution corresponding to the beginning of the buffer. Must be preallocated (see AK::SpeakerVolumes::Matrix services).
00890             AK::SpeakerVolumes::MatrixPtr out_mxNextVolumes     ///< Returned in/out channel volume distribution corresponding to the end of the buffer. Must be preallocated (see AK::SpeakerVolumes::Matrix services).
00891             ) = 0;
00892 
00893         /// Query the 3D spatialization mode used by this input.
00894         /// Applicable only when the input has listener relative routing (see HasListenerRelativeRouting()).
00895         /// \return The 3D spatialization mode (see Ak3DSpatializationMode). AK_SpatializationMode_None if not set, or if the input is not a node where the game object is evaluated against its listener.
00896         /// \sa
00897         /// - HasListenerRelativeRouting()
00898         virtual Ak3DSpatializationMode Get3DSpatializationMode() = 0;
00899 
00900         //@}
00901     };
00902 
00903     /// Interface to retrieve contextual information for a sink plugin.
00904     /// \sa
00905     /// - AK::IAkSinkPlugin
00906     class IAkSinkPluginContext : public IAkPluginContextBase
00907     {
00908     protected:
00909         /// Virtual destructor on interface to avoid warnings.
00910         virtual ~IAkSinkPluginContext(){}
00911 
00912     public:
00913 
00914         /// Query if the sink plugin is instantiated on the main output device (primary tree).
00915         /// \return True if the sink plugin is instantiated on the main output device (primary tree), false otherwise.
00916         /// \sa
00917         /// - AK::IAkSinkPlugin::IsDataNeeded()
00918         /// - AK::IAkSinkPlugin::Consume()
00919         virtual bool IsPrimary() = 0;
00920 
00921         /// Sink plugins may need to call this function to notify the audio thread that it should wake up
00922         /// in order to potentially process an audio frame. Note that the audio thread may wake up for other
00923         /// reasons, for example following calls to AK::SoundEngine::RenderAudio().
00924         /// Once the audio thread is awaken, it will ask the sink plugin how many audio frames need to be
00925         /// processed and presented to the plugin. This is done through AK::IAkSinkPlugin::IsDataNeeded()
00926         /// and AK::IAkSinkPlugin::Consume() respectively.
00927         /// Note that only the sink plugin that is instantiated on the main output device (primary tree) may control
00928         /// the audio thread synchronization.
00929         /// \return AK_Success if the calling plugin is instantiated on the main output device (primary tree),
00930         /// AK_Fail otherwise.
00931         /// \sa
00932         /// - AK::IAkSinkPluginContext::IsPrimary()
00933         /// - AK::IAkSinkPlugin::IsDataNeeded()
00934         /// - AK::IAkSinkPlugin::Consume()
00935         virtual AKRESULT SignalAudioThread() = 0;
00936 
00937         /// Query engine's user-defined sink queue depth (AkPlatformInitSettings::uNumRefillsInVoice).
00938         /// \return The engine's AkPlatformInitSettings::uNumRefillsInVoice value on platforms for which it exists, 0 otherwise.
00939         virtual AkUInt16 GetNumRefillsInVoice() = 0;
00940     };
00941 
00942     /// Software effect plug-in interface for sink (audio end point) plugins.
00943     class IAkSinkPlugin : public IAkPlugin
00944     {
00945     protected:
00946         /// Virtual destructor on interface to avoid warnings.
00947         virtual ~IAkSinkPlugin(){}
00948 
00949     public:
00950 
00951         /// Initialization of the sink plugin.
00952         ///
00953         /// This method prepares the audio device plug-in for data processing, allocates memory, and sets up initial conditions.
00954         /// The plug-in is passed in a pointer to a memory allocator interface (AK::IAkPluginMemAlloc).You should perform all dynamic memory allocation through this interface using the provided memory allocation macros(refer to \ref fx_memory_alloc).For the most common memory allocation needs, namely allocation at initialization and release at termination, the plug-in does not need to retain a pointer to the allocator.It will also be provided to the plug-in on termination.
00955         /// The AK::IAkSinkPluginContext interface allows to retrieve information related to the context in which the audio device plug-in is operated.
00956         /// The plug-in also receives a pointer to its associated parameter node interface (AK::IAkPluginParam).Most plug-ins will want to keep a reference to the associated parameter node to be able to retrieve parameters at runtime. Refer to \ref iakeffectparam_communication for more details.
00957         /// All of these interfaces will remain valid throughout the plug-in's lifespan so it is safe to keep an internal reference to them when necessary.
00958         /// Plug-ins also receive the output audio format(which stays the same during the lifespan of the plug-in) to be able to allocate memory and setup processing for a given channel configuration.
00959         /// Note that the channel configuration is suggestive and may even be specified as !AkChannelConfig::IsValid().The plugin is free to determine the true channel configuration(this is an io parameter).
00960         ///
00961         /// \return AK_Success if successful.
00962         /// \return AK_NotCompatible if the system doesn't support this sink type.  Return this if you want to fall back to the default sinks.  This sink will never be requested again.  Do not return this code if the device is simply unplugged.
00963         /// \return AK_DeviceNotCompatible if the requested output device doesn't support this sink type. Return this if you want to fall back to the dummy audio sink wich will result in no audio for the associated bus hierachy.  This sink will never be requested again.
00964         /// All other return codes will be treated as temporary failures conditions and the sink will be requested again later.
00965 
00966         virtual AKRESULT Init(
00967             IAkPluginMemAlloc *     in_pAllocator,          ///< Interface to memory allocator to be used by the effect.
00968             IAkSinkPluginContext *  in_pSinkPluginContext,  ///< Interface to sink plug-in's context.
00969             IAkPluginParam *        in_pParams,             ///< Interface to plug-in parameters.
00970             AkAudioFormat &         io_rFormat              ///< Audio data format of the input signal. Note that the channel configuration is suggestive and may even be specified as !AkChannelConfig::IsValid(). The plugin is free to determine the true channel configuration.
00971             ) = 0;
00972 
00973         /// Obtain the number of audio frames that should be processed by the sound engine and presented
00974         /// to this plugin via AK::IAkSinkPlugin::Consume(). The size of a frame is determined by the sound engine and
00975         /// obtainable via AK::IAkPluginContextBase::GetMaxBufferLength().
00976         /// \return AK_Success if successful, AK_Fail if there was a critical error.
00977         /// \sa
00978         /// - AK::IAkSinkPlugin::Consume()
00979         /// - AK::IAkSinkPluginContext::SignalAudioThread()
00980         virtual AKRESULT IsDataNeeded(
00981             AkUInt32 &              out_uNumFramesNeeded    ///< Returned number of audio frames needed.
00982             ) = 0;
00983 
00984         /// Present an audio buffer to the sink. The audio buffer is in the native format of the sound engine
00985         /// (typically float, deinterleaved), as specified by io_rFormat passed to Init(). It is up to the
00986         /// plugin to transform it into a format that is compatible with its output.
00987         /// Note that Consume() is not called if the output for this frame consists of silence. Plugins should
00988         /// detect this in OnFrameEnd().
00989         /// \sa
00990         /// - AK::IAkSinkPlugin::IsDataNeeded()
00991         /// - AK::IAkSinkPlugin::OnFrameEnd()
00992         virtual void Consume(
00993             AkAudioBuffer *         in_pInputBuffer,        ///< Input audio buffer data structure. Plugins should avoid processing data in-place.
00994             AkRamp                  in_gain                 ///< Volume gain to apply to this input (prev corresponds to the beginning, next corresponds to the end of the buffer).
00995             ) = 0;
00996 
00997         /// Called at the end of the audio frame. If no Consume calls were made prior to OnFrameEnd, this means no audio was sent to the device.  Assume silence.  
00998         /// \sa
00999         /// - AK::IAkSinkPlugin::Consume()
01000         virtual void OnFrameEnd() = 0;
01001 
01002         /// Ask the plug-in whether starvation occurred.
01003         /// \return True if starvation occurred, false otherwise.
01004         virtual bool IsStarved() = 0;
01005 
01006         /// Reset the "starvation" flag after IsStarved() returned true.
01007         virtual void ResetStarved() = 0;        
01008     };
01009 
01010     /// Wwise sound engine source plug-in interface (see \ref soundengine_plugins_source).
01011     class IAkSourcePlugin : public IAkPlugin
01012     {
01013     protected:
01014         /// Virtual destructor on interface to avoid warnings.
01015         virtual ~IAkSourcePlugin(){}
01016 
01017     public:
01018         /// Source plug-in initialization. Gets the plug-in ready for data processing, allocates memory and sets up the initial conditions.
01019         /// \aknote Memory allocation should be done through the appropriate macros (see \ref fx_memory_alloc). \endaknote
01020         /// \sa
01021         /// - \ref iaksourceeffect_init
01022         virtual AKRESULT Init(
01023             IAkPluginMemAlloc *         in_pAllocator,                  ///< Interface to the memory allocator to be used by the plug-in
01024             IAkSourcePluginContext *    in_pSourcePluginContext,        ///< Interface to the source plug-in's context
01025             IAkPluginParam *            in_pParams,                     ///< Interface to the plug-in parameters
01026             AkAudioFormat &             io_rFormat                      ///< Audio format of the output data to be produced by the plug-in (mono native by default)
01027             ) = 0;
01028 
01029         /// This method is called to determine the approximate duration of the source.
01030         /// \return The duration of the source, in milliseconds.
01031         /// \sa
01032         /// - \ref iaksourceeffect_getduration
01033         virtual AkReal32 GetDuration() const = 0;
01034 
01035         /// This method is called to determine the estimated envelope of the source.
01036         /// \return The estimated envelope of the data that will be generated in the next call to
01037         /// Execute(). The envelope value should be normalized to the highest peak of the entire
01038         /// duration of the source. Expected range is [0,1]. If envelope and peak value cannot be
01039         /// predicted, the source should return 1 (no envelope).
01040         /// \sa
01041         /// - \ref iaksourceeffect_getenvelope
01042         virtual AkReal32 GetEnvelope() const
01043         {
01044             return 1.f;
01045         }
01046 
01047         /// This method is called to tell the source to stop looping.
01048         /// This will typically be called when an action of type "break" will be triggered on the playing source.
01049         /// Break (or StopLooping) means: terminate gracefully... if possible. In most situations it finishes the current loop and plays the sound release if there is one.
01050         ///
01051         /// \return
01052         /// - AK_Success if the source ignores the break command and plays normally till the end or if the source support to stop looping and terminates gracefully.
01053         /// - AK_Fail if the source cannot simply stop looping, in this situation, the break command will end up stopping this source.
01054         /// \sa
01055         /// - \ref iaksourceeffect_stoplooping
01056         virtual AKRESULT StopLooping(){ return AK_Success; }
01057 
01058         /// This method is called to tell the source to seek to an arbitrary sample.
01059         /// This will typically be called when the game calls AK::SoundEngine::SeekOnEvent() where the event plays
01060         /// a sound that wraps this source plug-in.
01061         /// If the plug-in does not handle seeks, it should return AK_Success. If it returns AK_Fail, it will
01062         /// be terminated by the sound engine.
01063         ///
01064         /// \return
01065         /// - AK_Success if the source handles or ignores seek command.
01066         /// - AK_Fail if the source considers that seeking requests should provoke termination, for example, if
01067         ///     the desired position is greater than the prescribed source duration.
01068         /// \sa
01069         /// - AK::SoundEngine::SeekOnEvent()
01070         virtual AKRESULT Seek(
01071             AkUInt32 /* in_uPosition */ ///< Position to seek to, in samples, at the rate specified in AkAudioFormat (see AK::IAkSourcePlugin::Init()).
01072             ) { return AK_Success; }
01073 
01074         /// Skips execution when the voice is virtual playing from elapsed time to simulate processing that would have taken place (e.g. update internal state) while
01075         /// avoiding most of the CPU hit of plug-in execution.
01076         /// Given the number of frames requested adjust the number of frames that would have been produced by a call to Execute() in the io_uFrames parameter and return and
01077         /// return AK_DataReady or AK_NoMoreData, depending if there would be audio output or not at that point.
01078         /// Returning AK_NotImplemented will trigger a normal execution of the voice (as if it was not virtual) thus not enabling the CPU savings of a proper from elapsed time behavior.
01079         /// Note that returning AK_NotImplemeted for a source plug-ins that support asynchronous processing will produce a 'resume' virtual voice behavior instead.
01080         virtual AKRESULT TimeSkip(
01081             AkUInt32 & /*io_uFrames */ ///< (Input) Number of frames that the audio buffer processing can advance (equivalent to MaxFrames()). The output value should be the number of frames that would be produced this execution.
01082             ) { return AK_NotImplemented; }
01083 
01084         /// Software effect plug-in DSP execution.
01085         /// \aknote The effect can output as much as wanted up to MaxFrames(). All sample frames passed uValidFrames at input time are
01086         /// not initialized and it is the responsibility of the effect to do so. When modifying the number of valid frames within execution
01087         /// (e.g. to flush delay lines) the effect should notify the pipeline by updating uValidFrames accordingly.
01088         /// \aknote The effect will stop being called by the pipeline when AK_NoMoreData is returned in the the eState field of the AkAudioBuffer structure.
01089         virtual void Execute(
01090                 AkAudioBuffer *                         io_pBuffer      ///< In/Out audio buffer data structure (in-place processing)
01091                 ) = 0;
01092     };
01093 
01094 
01095     /// This function can be useful to convert from normalized floating point audio samples to HW-pipeline format samples.
01096     #define AK_FLOAT_TO_SAMPLETYPE( __in__ ) (__in__)
01097     /// This function can be useful to convert from normalized floating point audio samples to HW-pipeline format samples when the input is not not to exceed (-1,1) range.
01098     #define AK_FLOAT_TO_SAMPLETYPE_NOCLIP( __in__ ) (__in__)
01099     /// This function can be useful to convert from HW-pipeline format samples to normalized floating point audio samples.
01100     #define AK_SAMPLETYPE_TO_FLOAT( __in__ ) (__in__)
01101 
01102     #define AK_DBTOLIN( __db__ ) (powf(10.f,(__db__) * 0.05f))
01103 }
01104 
01105 /// Registered plugin creation function prototype.
01106 AK_CALLBACK( AK::IAkPlugin*, AkCreatePluginCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
01107 /// Registered plugin parameter node creation function prototype.
01108 AK_CALLBACK( AK::IAkPluginParam*, AkCreateParamCallback )( AK::IAkPluginMemAlloc * in_pAllocator );
01109 
01110 struct AkPlatformInitSettings;
01111 struct AkInitSettings;
01112 
01113 namespace AK
01114 {
01115     /// Global plugin context used for plugin registration/initialization. Games query this interface from the sound engine.
01116     class IAkGlobalPluginContext
01117     {
01118     protected:
01119         /// Virtual destructor on interface to avoid warnings.
01120         virtual ~IAkGlobalPluginContext(){}
01121 
01122     public:
01123 
01124         /// Retrieve the streaming manager access interface.
01125         virtual IAkStreamMgr * GetStreamMgr() const = 0;
01126 
01127         /// Retrieve the maximum number of frames that Execute() will be called with for this effect.
01128         /// Can be used by the effect to make memory allocation at initialization based on this worst case scenario.
01129         /// \return Maximum number of frames.
01130         virtual AkUInt16 GetMaxBufferLength() const = 0;
01131 
01132         /// Query whether sound engine is in real-time or offline (faster than real-time) mode.
01133         /// \return true when sound engine is in offline mode, false otherwise.
01134         virtual bool IsRenderingOffline() const = 0;
01135 
01136         /// Retrieve the core sample rate of the engine. This sample rate applies to all effects except source plugins, which declare their own sample rate.
01137         /// \return Core sample rate.
01138         virtual AkUInt32 GetSampleRate() const = 0;
01139 
01140         /// Post a monitoring message or error string. This will be displayed in the Wwise capture
01141         /// log.
01142         /// \return AK_Success if successful, AK_Fail if there was a problem posting the message.
01143         ///         In optimized mode, this function returns AK_NotCompatible.
01144         /// \remark This function is provided as a tracking tool only. It does nothing if it is
01145         ///         called in the optimized/release configuration and return AK_NotCompatible.
01146         virtual AKRESULT PostMonitorMessage(
01147             const char* in_pszError,                ///< Message or error string to be displayed
01148             AK::Monitor::ErrorLevel in_eErrorLevel  ///< Specifies whether it should be displayed as a message or an error
01149             ) = 0;
01150 
01151         /// Register a plug-in with the sound engine and set the callback functions to create the
01152         /// plug-in and its parameter node.
01153         /// \sa
01154         /// - \ref register_effects
01155         /// - \ref plugin_xml
01156         /// \return AK_Success if successful, AK_InvalidParameter if invalid parameters were provided or Ak_Fail otherwise. Possible reasons for an AK_Fail result are:
01157         /// - Insufficient memory to register the plug-in
01158         /// - Plug-in ID already registered
01159         /// \remarks
01160         /// Codecs and plug-ins must be registered before loading banks that use them.\n
01161         /// Loading a bank referencing an unregistered plug-in or codec will result in a load bank success,
01162         /// but the plug-ins will not be used. More specifically, playing a sound that uses an unregistered effect plug-in
01163         /// will result in audio playback without applying the said effect. If an unregistered source plug-in is used by an event's audio objects,
01164         /// posting the event will fail.
01165         virtual AKRESULT RegisterPlugin(
01166             AkPluginType in_eType,                      ///< Plug-in type (for example, source or effect)
01167             AkUInt32 in_ulCompanyID,                    ///< Company identifier (as declared in the plug-in description XML file)
01168             AkUInt32 in_ulPluginID,                     ///< Plug-in identifier (as declared in the plug-in description XML file)
01169             AkCreatePluginCallback in_pCreateFunc,      ///< Pointer to the plug-in's creation function
01170             AkCreateParamCallback in_pCreateParamFunc   ///< Pointer to the plug-in's parameter node creation function
01171             ) = 0;
01172 
01173         /// Register a codec type with the sound engine and set the callback functions to create the
01174         /// codec's file source and bank source nodes.
01175         /// \sa
01176         /// - \ref register_effects
01177         /// \return AK_Success if successful, AK_InvalidParameter if invalid parameters were provided, or Ak_Fail otherwise. Possible reasons for an AK_Fail result are:
01178         /// - Insufficient memory to register the codec
01179         /// - Codec ID already registered
01180         /// \remarks
01181         /// Codecs and plug-ins must be registered before loading banks that use them.\n
01182         /// Loading a bank referencing an unregistered plug-in or codec will result in a load bank success,
01183         /// but the plug-ins will not be used. More specifically, playing a sound that uses an unregistered effect plug-in
01184         /// will result in audio playback without applying the said effect. If an unregistered source plug-in is used by an event's audio objects,
01185         /// posting the event will fail.
01186         virtual AKRESULT RegisterCodec(
01187             AkUInt32 in_ulCompanyID,                        ///< Company identifier (as declared in XML)
01188             AkUInt32 in_ulPluginID,                         ///< Plugin identifier (as declared in XML)
01189             AkCreateFileSourceCallback in_pFileCreateFunc,  ///< Factory for streaming sources.
01190             AkCreateBankSourceCallback in_pBankCreateFunc   ///< Factory for in-memory sources.
01191             ) = 0;
01192 
01193         /// Register a global callback function. This function will be called from the audio rendering thread, at the
01194         /// location specified by in_eLocation. This function will also be called from the thread calling
01195         /// AK::SoundEngine::Term with in_eLocation set to AkGlobalCallbackLocation_Term.
01196         /// For example, in order to be called at every audio rendering pass, and once during teardown for releasing resources, you would call
01197         /// RegisterGlobalCallback(AkPluginTypeEffect, MY_COMPANY_ID , MY_PLUGIN_ID, myCallback, AkGlobalCallbackLocation_BeginRender | AkGlobalCallbackLocation_Term, myCookie);
01198         /// \remarks
01199         /// A valid (not AkPluginTypeNone) Plugin Type, Company ID and valid (non-zero) Plug-in ID of the plug-in registering the callback must be provided to this function.
01200         /// The timing of the callback function will contribute to the timing of the plug-in registered (Total Plug-in CPU and Advanced Profiler Plug-in tab).
01201         /// Timers will be registered to callbacks at all locations except for AkGlobalCallbackLocation_Register and AkGlobalCallbackLocation_Term.
01202         /// It is illegal to call this function while already inside of a global callback.
01203         /// This function might stall for several milliseconds before returning.
01204         /// \sa
01205         /// - AK::IAkGlobalPluginContext::UnregisterGlobalCallback()
01206         /// - AkGlobalCallbackFunc
01207         /// - AkGlobalCallbackLocation
01208         virtual AKRESULT RegisterGlobalCallback(
01209             AkPluginType in_eType,                          ///< A valid Plug-in type (for example, source or effect).
01210             AkUInt32 in_ulCompanyID,                        ///< Company identifier (as declared in the plug-in description XML file). 
01211             AkUInt32 in_ulPluginID,                         ///< Plug-in identifier (as declared in the plug-in description XML file).
01212             AkGlobalCallbackFunc in_pCallback,              ///< Function to register as a global callback.
01213             AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender, ///< Callback location defined in AkGlobalCallbackLocation. Bitwise OR multiple locations if needed.
01214             void * in_pCookie = NULL                        ///< User cookie.
01215             ) = 0;
01216 
01217         /// Unregister a global callback function, previously registered using RegisterGlobalCallback.
01218         /// \remarks
01219         /// It is legal to call this function while already inside of a global callback, If it is unregistering itself and not
01220         /// another callback.
01221         /// This function might stall for several milliseconds before returning.
01222         /// \sa
01223         /// - AK::IAkGlobalPluginContext::RegisterGlobalCallback()
01224         /// - AkGlobalCallbackFunc
01225         /// - AkGlobalCallbackLocation
01226         virtual AKRESULT UnregisterGlobalCallback(
01227             AkGlobalCallbackFunc in_pCallback,              ///< Function to unregister as a global callback.
01228             AkUInt32 in_eLocation = AkGlobalCallbackLocation_BeginRender ///< Must match in_eLocation as passed to RegisterGlobalCallback for this callback.
01229             ) = 0;
01230 
01231         /// Get the default allocator for plugins. This is useful for performing global initialization tasks shared across multiple plugin instances.
01232         virtual AK::IAkPluginMemAlloc * GetAllocator() = 0;
01233 
01234         /// \sa SetRTPCValue
01235         virtual AKRESULT SetRTPCValue(
01236             AkRtpcID in_rtpcID,                                     ///< ID of the game parameter
01237             AkRtpcValue in_value,                                   ///< Value to set
01238             AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT,///< Associated game object ID
01239             AkTimeMs in_uValueChangeDuration = 0,                   ///< Duration during which the game parameter is interpolated towards in_value
01240             AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear,   ///< Curve type to be used for the game parameter interpolation
01241             bool in_bBypassInternalValueInterpolation = false       ///< True if you want to bypass the internal "slew rate" or "over time filtering" specified by the sound designer. This is meant to be used when for example loading a level and you dont want the values to interpolate.
01242             ) = 0;
01243 
01244         /// Send custom game data to a plugin that resides on a bus (insert effect or mixer plugin).
01245         /// Data will be copied and stored into a separate list.
01246         /// Previous entry is deleted when a new one is sent.
01247         /// Set the data pointer to NULL to clear item from the list.
01248         /// This means that you cannot send different data to various instances of the plugin on a same bus.\endaknote
01249         /// \return AK_Success if data was sent successfully.
01250         virtual AKRESULT SendPluginCustomGameData(
01251             AkUniqueID in_busID,            ///< Bus ID
01252             AkGameObjectID in_busObjectID,  ///< Bus Object ID
01253             AkPluginType in_eType,          ///< Plug-in type (for example, source or effect)
01254             AkUInt32 in_uCompanyID,     ///< Company identifier (as declared in the plug-in description XML file)
01255             AkUInt32 in_uPluginID,          ///< Plug-in identifier (as declared in the plug-in description XML file)
01256             const void* in_pData,           ///< The data blob
01257             AkUInt32 in_uSizeInBytes        ///< Size of data
01258             ) = 0;
01259 
01260         /// N to N channels mix
01261         virtual void MixNinNChannels(
01262             AkAudioBuffer * in_pInputBuffer,                ///< Input multichannel buffer.
01263             AkAudioBuffer * in_pMixBuffer,                  ///< Multichannel buffer with which the input buffer is mixed.
01264             AkReal32        in_fPrevGain,                   ///< Gain, corresponding to the beginning of the buffer, to apply uniformly to each mixed channel.
01265             AkReal32        in_fNextGain,                   ///< Gain, corresponding to the end of the buffer, to apply uniformly to each mixed channel.
01266             AK::SpeakerVolumes::ConstMatrixPtr in_mxPrevVolumes,///< In/out channel volume distribution corresponding to the beginning of the buffer (see AK::SpeakerVolumes::Matrix services).
01267             AK::SpeakerVolumes::ConstMatrixPtr in_mxNextVolumes ///< In/out channel volume distribution corresponding to the end of the buffer (see AK::SpeakerVolumes::Matrix services).
01268             ) = 0;
01269 
01270         /// 1 to N channels mix
01271         virtual void Mix1inNChannels(
01272             AkReal32 * AK_RESTRICT in_pInChannel,           ///< Input channel buffer.
01273             AkAudioBuffer * in_pMixBuffer,                  ///< Multichannel buffer with which the input buffer is mixed.
01274             AkReal32        in_fPrevGain,                   ///< Gain, corresponding to the beginning of the input channel.
01275             AkReal32        in_fNextGain,                   ///< Gain, corresponding to the end of the input channel.
01276             AK::SpeakerVolumes::ConstVectorPtr in_vPrevVolumes, ///< Output channel volume distribution corresponding to the beginning of the buffer (see AK::SpeakerVolumes::Vector services).
01277             AK::SpeakerVolumes::ConstVectorPtr in_vNextVolumes  ///< Output channel volume distribution corresponding to the end of the buffer (see AK::SpeakerVolumes::Vector services).
01278             ) = 0;
01279 
01280         /// Single channel mix
01281         virtual void MixChannel(
01282             AkReal32 * AK_RESTRICT in_pInBuffer,            ///< Input channel buffer.
01283             AkReal32 * AK_RESTRICT in_pOutBuffer,           ///< Output channel buffer.
01284             AkReal32        in_fPrevGain,                   ///< Gain, corresponding to the beginning of the input channel.
01285             AkReal32        in_fNextGain,                   ///< Gain, corresponding to the end of the input channel.
01286             AkUInt16        in_uNumFrames                   ///< Number of frames to mix.
01287             ) = 0;
01288 
01289         /// Computes gain vector for encoding a source with angles in_fAzimuth and in_fElevation to full-sphere ambisonics with order in_uOrder.
01290         /// Ambisonic channels are ordered by ACN and use the SN3D convention.
01291         virtual void ComputeAmbisonicsEncoding(
01292             AkReal32            in_fAzimuth,                ///< Incident angle, in radians [-pi,pi], where 0 is the front (positive values are clockwise).
01293             AkReal32            in_fElevation,              ///< Incident angle, in radians [-pi/2,pi/2], where 0 is the azimuthal plane.
01294             AkChannelConfig     in_cfgAmbisonics,           ///< Determines number of gains in vector out_vVolumes.
01295             AK::SpeakerVolumes::VectorPtr out_vVolumes      ///< Returned volumes (see AK::SpeakerVolumes::Vector services). Must be allocated prior to calling this function with the size returned by AK::SpeakerVolumes::Vector::GetRequiredSize() for the desired number of channels. You may obtain the number of channels from the order using the helper AK::AmbisonicOrderToNumChannels().
01296             ) = 0;
01297 
01298         /// Computes gain matrix for decoding an SN3D-normalized ACN-ordered ambisonic signal of order sqrt(in_cfgAmbisonics.uNumChannels)-1, with max-RE weighting function, on a (regularly) sampled sphere whose samples in_samples are 
01299         /// expressed in left-handed cartesian coordinates, with unitary norm.
01300         /// This decoding technique is optimal for regular sampling.
01301         /// The returned matrix has in_cfgAmbisonics.uNumChannels inputs (rows) and in_uNumSamples outputs (columns), and is normalized by the number of samples. 
01302         /// Supported ambisonic configurations are full-sphere 1st, 2nd and 3rd order.
01303         /// \return AK_Fail when ambisonic configuration. AK_Success otherwise.
01304         virtual AKRESULT ComputeWeightedAmbisonicsDecodingFromSampledSphere(
01305             const AkVector      in_samples[],               ///< Array of vector samples expressed in left-handed cartesian coordinates, where (1,0,0) points towards the right and (0,1,0) points towards the top. Vectors must be normalized.
01306             AkUInt32            in_uNumSamples,             ///< Number of points in in_samples.
01307             AkChannelConfig     in_cfgAmbisonics,           ///< Ambisonic configuration. Supported configurations are 1-1, 2-2 and 3-3. Determines number of rows (input channels) in matrix out_mxVolume.
01308             AK::SpeakerVolumes::MatrixPtr out_mxVolume      ///< Returned volume matrix (see AK::SpeakerVolumes::Matrix services). Must be allocated prior to calling this function with the size returned by AK::SpeakerVolumes::Matrix::GetRequiredSize() for the desired number of channels. You may obtain the number of channels from the order using the helper AK::AmbisonicOrderToNumChannels().
01309             ) = 0;
01310 
01311         /// Return an acoustic texture.
01312         /// \return The pointer to an acoustic texture if successful, NULL otherwise.
01313         virtual const AkAcousticTexture* GetAcousticTexture(
01314             AkAcousticTextureID in_AcousticTextureID        ///< Acoustic Texture's ID
01315             ) = 0;
01316 
01317         /// Given an emitter-listener pair, compute the azimuth and elevation angles of the emitter relative to the listener.
01318         /// \return AK_Success if the listener referenced in the emitter-listener pair was found; azimuth and elevation.
01319         virtual AKRESULT ComputeSphericalCoordinates(
01320             const AkEmitterListenerPair & in_pair,          ///< Emitter-listener pair for which to compute azimuth and elevation angles.
01321             AkReal32 & out_fAzimuth,                        ///< Returned azimuthal angle, in radians.
01322             AkReal32 & out_fElevation                       ///< Returned elevation angle, in radians.
01323             ) const = 0;
01324 
01325         /// Get the platform init settings that the wwise sound engine has been initialized with.
01326         /// This function returns a null pointer if called with an instance of RenderFXGlobalContext.
01327         virtual const AkPlatformInitSettings* GetPlatformInitSettings() const = 0;
01328         
01329         /// Get the init settings that the wwise sound engine has been initialized with
01330         /// This function returns a null pointer if called with an instance of RenderFXGlobalContext.
01331         virtual const AkInitSettings* GetInitSettings() const = 0;
01332 
01333         /// Gets the configured audio settings.
01334         /// Call this function to get the configured audio settings.
01335         /// 
01336         /// \warning This function is not thread-safe.
01337         /// \warning Call this function only after the sound engine has been properly initialized.
01338         virtual AKRESULT GetAudioSettings(
01339             AkAudioSettings &   out_audioSettings   ///< Returned audio settings
01340             ) const = 0;
01341 
01342         /// Universal converter from string to ID for the sound engine.
01343         /// Calls AK::SoundEngine::GetIDFromString.
01344         /// \sa
01345         /// - <tt>AK::SoundEngine::GetIDFromString</tt>
01346         virtual AkUInt32 GetIDFromString(const char* in_pszString) const = 0;
01347 
01348         /// Synchronously posts an Event to the sound engine (by event ID).
01349         /// The callback function can be used to be noticed when markers are reached or when the event is finished.
01350         /// An array of wave file sources can be provided to resolve External Sources triggered by the event. 
01351         /// \return The playing ID of the event launched, or AK_INVALID_PLAYING_ID if posting the event failed
01352         /// \remarks
01353         /// This function executes the actions contained in the event without going through the message queue.
01354         /// In order to do so it acquires the global Wwise sound engine lock. It should therefore only be called from one of the 
01355         /// global engine hooks (see AK::IAkGlobalPluginContext::RegisterGlobalCallback).
01356         /// Use AK::IAkGlobalPluginContext::GetIDFromString() if you use event names (strings).
01357         /// \sa 
01358         /// - <tt>AK::SoundEngine::PostEvent</tt>
01359         /// - <tt>AK::IAkGlobalPluginContext::RegisterGlobalCallback</tt>
01360         /// - <tt>AK::IAkGlobalPluginContext::GetIDFromString</tt>
01361         virtual AkPlayingID PostEventSync(
01362             AkUniqueID in_eventID,                          ///< Unique ID of the event
01363             AkGameObjectID in_gameObjectID,                 ///< Associated game object ID
01364             AkUInt32 in_uFlags = 0,                         ///< Bitmask: see \ref AkCallbackType
01365             AkCallbackFunc in_pfnCallback = NULL,           ///< Callback function
01366             void * in_pCookie = NULL,                       ///< Callback cookie that will be sent to the callback function along with additional information
01367             AkUInt32 in_cExternals = 0,                     ///< Optional count of external source structures
01368             AkExternalSourceInfo *in_pExternalSources = NULL,///< Optional array of external source resolution information
01369             AkPlayingID in_PlayingID = AK_INVALID_PLAYING_ID///< Optional (advanced users only) Specify the playing ID to target with the event. Will Cause active actions in this event to target an existing Playing ID. Let it be AK_INVALID_PLAYING_ID or do not specify any for normal playback.
01370             ) = 0;
01371         
01372         /// Executes a number of MIDI Events on all nodes that are referenced in the specified Event in an Action of type Play.
01373         /// Each MIDI event will be posted in AkMIDIPost::uOffset samples from the start of the current frame. The duration of
01374         /// a sample can be determined from the sound engine's audio settings, via a call to AK::IAkGlobalPluginContext::GetAudioSettings.
01375         /// \remarks
01376         /// This function executes the MIDI Events without going through the message queue.
01377         /// In order to do so it acquires the global Wwise sound engine lock. It should therefore only be called from one of the 
01378         /// global engine hooks (see AK::IAkGlobalPluginContext::RegisterGlobalCallback).
01379         /// Use AK::IAkGlobalPluginContext::GetIDFromString() if you use event names (strings).
01380         /// \sa 
01381         /// - <tt>AK::SoundEngine::PostMIDIOnEvent</tt>
01382         /// - <tt>AK::IAkGlobalPluginContext::GetAudioSettings</tt>
01383         /// - <tt>AK::IAkGlobalPluginContext::StopMIDIOnEventSync</tt>
01384         /// - <tt>AK::IAkGlobalPluginContext::RegisterGlobalCallback</tt>
01385         /// - <tt>AK::IAkGlobalPluginContext::GetIDFromString</tt>
01386         virtual AKRESULT PostMIDIOnEventSync(
01387             AkUniqueID in_eventID,                                          ///< Unique ID of the Event
01388             AkGameObjectID in_gameObjectID,                                 ///< Associated game object ID
01389             AkMIDIPost* in_pPosts,                                          ///< MIDI Events to post
01390             AkUInt16 in_uNumPosts                                           ///< Number of MIDI Events to post
01391             ) = 0;
01392 
01393         /// Stops MIDI notes on all nodes that are referenced in the specified event in an action of type play,
01394         /// with the specified Game Object. Invalid parameters are interpreted as wildcards. For example, calling
01395         /// this function with in_eventID set to AK_INVALID_UNIQUE_ID will stop all MIDI notes for Game Object
01396         /// in_gameObjectID.
01397         /// \remarks
01398         /// This function stops the MIDI notes without going through the message queue.
01399         /// In order to do so it acquires the global Wwise sound engine lock. It should therefore only be called from one of the 
01400         /// global engine hooks (see AK::IAkGlobalPluginContext::RegisterGlobalCallback).
01401         /// Use AK::IAkGlobalPluginContext::GetIDFromString() if you use event names (strings).
01402         /// \sa
01403         /// - <tt>AK::IAkGlobalPluginContext::PostMIDIOnEvent</tt>
01404         /// - <tt>AK::IAkGlobalPluginContext::GetIDFromString</tt>
01405         virtual AKRESULT StopMIDIOnEventSync(
01406             AkUniqueID in_eventID = AK_INVALID_UNIQUE_ID,                   ///< Unique ID of the Event
01407             AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT         ///< Associated game object ID
01408             ) = 0;
01409     };
01410 
01411     /// This class takes care of the registration of plug-ins in the Wwise engine.  Plug-in developers must provide one instance of this class for each plug-in.
01412     /// \sa \ref soundengine_plugins
01413     class PluginRegistration
01414     {
01415     public:
01416         PluginRegistration(
01417             AkPluginType in_eType,                          ///< Plugin type.
01418             AkUInt32 in_ulCompanyID,                        ///< Plugin company ID.
01419             AkUInt32 in_ulPluginID,                         ///< Plugin ID.
01420             AkCreatePluginCallback in_pCreateFunc,          ///< Plugin object factory.
01421             AkCreateParamCallback in_pCreateParamFunc,      ///< Plugin parameter object factory.
01422             AkGlobalCallbackFunc in_pRegisterCallback = NULL,   ///< Optional callback function called after successful plugin registration, with argument AkGlobalCallbackLocation_Register.
01423             void * in_pRegisterCallbackCookie = NULL            ///< Optional cookie passed to register callback function above.
01424             )
01425             : pNext(g_pAKPluginList)
01426             , m_eType(in_eType)
01427             , m_ulCompanyID(in_ulCompanyID)
01428             , m_ulPluginID(in_ulPluginID)
01429             , m_pCreateFunc(in_pCreateFunc)
01430             , m_pCreateParamFunc(in_pCreateParamFunc)
01431             , m_pFileCreateFunc(NULL)
01432             , m_pBankCreateFunc(NULL)
01433             , m_pRegisterCallback(in_pRegisterCallback)
01434             , m_pRegisterCallbackCookie(in_pRegisterCallbackCookie)
01435         {
01436             g_pAKPluginList = this;
01437         }
01438 
01439         PluginRegistration(
01440             AkUInt32 in_ulCompanyID,                        ///< Plugin company ID.
01441             AkUInt32 in_ulPluginID,                         ///< Plugin ID.
01442             AkCreateFileSourceCallback in_pCreateFile,      ///< Streamed source factory.
01443             AkCreateBankSourceCallback in_pCreateBank)      ///< In-memory source factory.
01444             : pNext(g_pAKPluginList)
01445             , m_eType(AkPluginTypeCodec)
01446             , m_ulCompanyID(in_ulCompanyID)
01447             , m_ulPluginID(in_ulPluginID)
01448             , m_pCreateFunc(NULL)
01449             , m_pCreateParamFunc(NULL)
01450             , m_pFileCreateFunc(in_pCreateFile)
01451             , m_pBankCreateFunc(in_pCreateBank)
01452             , m_pRegisterCallback(NULL)
01453             , m_pRegisterCallbackCookie(NULL)
01454         {
01455             g_pAKPluginList = this;
01456         }
01457 
01458         PluginRegistration *pNext;
01459         AkPluginType m_eType;
01460         AkUInt32 m_ulCompanyID;
01461         AkUInt32 m_ulPluginID;
01462         AkCreatePluginCallback m_pCreateFunc;
01463         AkCreateParamCallback m_pCreateParamFunc;
01464         AkCreateFileSourceCallback m_pFileCreateFunc;
01465         AkCreateBankSourceCallback m_pBankCreateFunc;
01466         AkGlobalCallbackFunc m_pRegisterCallback;
01467         void * m_pRegisterCallbackCookie;
01468     };
01469 }
01470 
01471 #define AK_IMPLEMENT_PLUGIN_FACTORY(_pluginName_, _plugintype_, _companyid_, _pluginid_) \
01472     AK::IAkPlugin* Create##_pluginName_(AK::IAkPluginMemAlloc * in_pAllocator); \
01473     AK::IAkPluginParam * Create##_pluginName_##Params(AK::IAkPluginMemAlloc * in_pAllocator); \
01474     AK::PluginRegistration _pluginName_##Registration(_plugintype_, _companyid_, _pluginid_, Create##_pluginName_, Create##_pluginName_##Params);
01475 
01476 #define AK_STATIC_LINK_PLUGIN(_pluginName_) \
01477     extern AK::PluginRegistration _pluginName_##Registration; \
01478     void *_pluginName_##_linkonceonly = (void*)&_pluginName_##Registration;
01479 
01480 #define DEFINE_PLUGIN_REGISTER_HOOK AK_DLLEXPORT AK::PluginRegistration * g_pAKPluginList = NULL;
01481 
01482 #define AK_GET_SINK_TYPE_FROM_DEVICE_KEY(_key) ((AkUInt32)(_key & 0xffffffff))
01483 #define AK_GET_DEVICE_ID_FROM_DEVICE_KEY(_key) ((AkUInt32)(_key >> 32))
01484 
01485 #endif // _IAK_PLUGIN_H_