バージョン

menu_open

include/AK/SoundEngine/Common/IAkPlugin.h

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

このページはお役に立ちましたか?

サポートは必要ですか?

ご質問や問題、ご不明点はございますか?お気軽にお問い合わせください。

サポートページをご確認ください

あなたのプロジェクトについて教えてください。ご不明な点はありませんか。

プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。

Wwiseからはじめよう