Table of Contents

Wwise SDK 2019.1.5
IAkMixerPlugin.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 /// \file
29 /// Software source plug-in and effect plug-in interfaces.
30 
31 #ifndef _IAK_MIXER_PLUGIN_H_
32 #define _IAK_MIXER_PLUGIN_H_
33 
35 
36 namespace AK
37 {
38  /// Software effect plug-in interface for panner/mixer effects (see \ref soundengine_plugins_effects).
40  {
41  public:
42 
43  /// Software effect plug-in initialization. Prepares the effect for data processing, allocates memory and sets up the initial conditions.
44  /// \aknote Memory allocation should be done through appropriate macros (see \ref fx_memory_alloc). \endaknote
45  virtual AKRESULT Init(
46  IAkPluginMemAlloc * in_pAllocator, ///< Interface to memory allocator to be used by the effect.
47  IAkMixerPluginContext * in_pMixerPluginContext, ///< Interface to mixer plug-in's context.
48  IAkPluginParam * in_pParams, ///< Interface to plug-in parameters.
49  AkAudioFormat & in_rFormat ///< Audio data format of the requested output signal.
50  ) = 0;
51 
52  /// This function is called whenever a new input is connected to the underlying mixing bus.
53  virtual void OnInputConnected(
54  IAkMixerInputContext * in_pInput ///< Input that is being connected.
55  ) = 0;
56 
57  /// This function is called whenever a new input is disconnected to the underlying mixing bus.
58  /// \aknote OnInputDisconnected() may be called between calls to ConsumeInput() and OnMixDone().\endaknote
59  virtual void OnInputDisconnected(
60  IAkMixerInputContext * in_pInput ///< Input that is being disconnected.
61  ) = 0;
62 
63  /// This function is called whenever an input (voice or bus) needs to be mixed.
64  /// During an audio frame, ConsumeInput() will be called for each input that need to be mixed.
65  /// \aknote io_pInputBuffer->eState will be set as AK_NoMoreData the last time the given input is processed by ConsumeInput(). Otherwise it is set to AK_DataReady.
66  /// Mixers cannot make an input remain alive by changing their state.\endaknote
67  /// \aknote ConsumeInput() will not be called for frames during which a voice is not audible.\endaknote
68  /// \sa
69  /// - OnMixDone
70  /// - OnEffectsProcessed
71  virtual void ConsumeInput(
72  IAkMixerInputContext * in_pInputContext, ///< Context for this input. Carries non-audio data.
73  AkRamp in_baseVolume, ///< Base volume to apply to this input (prev corresponds to the beginning, next corresponds to the end of the buffer). This gain is agnostic of emitter-listener pair-specific contributions (such as distance level attenuation).
74  AkRamp in_emitListVolume, ///< Emitter-listener pair-specific gain. When there are multiple emitter-listener pairs, this volume equals 1, and pair gains are applied directly on the channel volume matrix (accessible via IAkMixerInputContext::GetSpatializedVolumes()). For custom processing of emitter-listener pairs, one should query each pair volume using IAkMixerInputContext::Get3DPosition(), then AkEmitterListenerPair::GetGainForConnectionType().
75  AkAudioBuffer * io_pInputBuffer, ///< Input audio buffer data structure. Plugins should avoid processing data in-place.
76  AkAudioBuffer * io_pMixBuffer ///< Output audio buffer data structure. Stored until call to OnEffectsProcessed().
77  ) = 0;
78 
79  /// This function is called once every audio frame, when all inputs have been mixed in
80  /// with ConsumeInput(). It is the time when the plugin may perform final DSP/bookkeeping.
81  /// After the bus buffer io_pMixBuffer has been pushed to the bus downstream (or the output device),
82  /// it is cleared out for the next frame.
83  /// \aknote io_pMixBuffer->eState is passed as AK_DataReady for the whole existence of the bus, until the last frame where it will be set to AK_NoMoreData.
84  /// However, mixer plugins are capable of forcing the bus to remain alive for a longer time by changing io_pMixBuffer->eState back to AK_DataReady.
85  /// You may do this in OnMixDone() or in OnEffectsProcessed(). The difference is that effects inserted on the bus will enter their "tail mode" if you
86  /// wait until OnEffectsProcessed() to flip the state to AK_DataReady. This is usually undesirable, so handling this inside OnMixDone() is usually preferred.\endaknote
87  /// \sa
88  /// - ConsumeInput
89  /// - OnEffectsProcessed
90  virtual void OnMixDone(
91  AkAudioBuffer * io_pMixBuffer ///< Output audio buffer data structure. Stored across calls to ConsumeInput().
92  ) = 0;
93 
94  /// This function is called once every audio frame, after all insert effects on the bus have been processed,
95  /// which occur after the post mix pass of OnMixDone().
96  /// After the bus buffer io_pMixBuffer has been pushed to the bus downstream (or the output device),
97  /// it is cleared out for the next frame.
98  /// \aknote io_pMixBuffer->eState is passed as AK_DataReady for the whole existence of the bus, until the last frame where it will be set to AK_NoMoreData.
99  /// However, mixer plugins are capable of forcing the bus to remain alive for a longer time by changing io_pMixBuffer->eState back to AK_DataReady.
100  /// You may do this in OnMixDone(), in OnEffectsProcessed() or in OnFrameEnd(). The difference is that effects inserted on the bus will enter their "tail mode" if you
101  /// wait until OnEffectsProcessed() or OnFrameEnd() to flip the state to AK_DataReady. This is usually undesirable, so handling this inside OnMixDone() is usually preferred.\endaknote
102  /// \sa
103  /// - OnMixDone
104  /// - AK::IAkMetering
105  /// - AK::IAkMixerPluginContext::EnableMetering()
106  virtual void OnEffectsProcessed(
107  AkAudioBuffer * io_pMixBuffer ///< Output audio buffer data structure.
108  ) = 0;
109 
110  /// This function is called once every audio frame, after all insert effects on the bus have been processed, and after metering has been processed (if applicable),
111  /// which occur after OnEffectsProcessed().
112  /// After the bus buffer io_pMixBuffer has been pushed to the bus downstream (or the output device), it is cleared out for the next frame.
113  /// Mixer plugins may use this hook for processing the signal after it has been metered.
114  /// \aknote io_pMixBuffer->eState is passed as AK_DataReady for the whole existence of the bus, until the last frame where it will be set to AK_NoMoreData.
115  /// However, mixer plugins are capable of forcing the bus to remain alive for a longer time by changing io_pMixBuffer->eState back to AK_DataReady.
116  /// You may do this in OnMixDone(), in OnEffectsProcessed() or in OnFrameEnd(). The difference is that effects inserted on the bus will enter their "tail mode" if you
117  /// wait until OnEffectsProcessed() or OnFrameEnd() to flip the state to AK_DataReady. This is usually undesirable, so handling this inside OnMixDone() is usually preferred.\endaknote
118  /// \aknote This function is called after metering gets computed on io_pMixBuffer. You may access the result in in_pMetering. Metering has to be enabled with AK::IAkMixerPluginContext::EnableMetering().
119  /// It may also be enabled by the Wwise authoring tool when connected.\endaknote
120  /// \sa
121  /// - OnMixDone
122  /// - AK::IAkMetering
123  /// - AK::IAkMixerPluginContext::EnableMetering()
124  virtual void OnFrameEnd(
125  AkAudioBuffer * io_pMixBuffer, ///< Output audio buffer data structure.
126  IAkMetering * in_pMetering ///< Interface for retrieving metering data computed on io_pMixBuffer. May be NULL if metering is not enabled.
127  ) = 0;
128  };
129 }
130 #endif // _IAK_MIXER_PLUGIN_H_
Software effect plug-in interface for panner/mixer effects (see How to Create Wwise Sound Engine Effe...
Definition: IAkMixerPlugin.h:39
virtual AKRESULT Init(IAkPluginMemAlloc *in_pAllocator, IAkMixerPluginContext *in_pMixerPluginContext, IAkPluginParam *in_pParams, AkAudioFormat &in_rFormat)=0
virtual void ConsumeInput(IAkMixerInputContext *in_pInputContext, AkRamp in_baseVolume, AkRamp in_emitListVolume, AkAudioBuffer *io_pInputBuffer, AkAudioBuffer *io_pMixBuffer)=0
virtual void OnEffectsProcessed(AkAudioBuffer *io_pMixBuffer)=0
Defines the parameters of an audio buffer format.
Definition: AkCommonDefs.h:59
AKRESULT
Standard function call result.
Definition: AkTypes.h:126
virtual void OnFrameEnd(AkAudioBuffer *io_pMixBuffer, IAkMetering *in_pMetering)=0
virtual void OnMixDone(AkAudioBuffer *io_pMixBuffer)=0
Audiokinetic namespace.
Volume ramp specified by end points "previous" and "next".
Definition: AkTypes.h:572
virtual void OnInputConnected(IAkMixerInputContext *in_pInput)=0
This function is called whenever a new input is connected to the underlying mixing bus.
Interface to retrieve information about an input of a mixer.
Definition: IAkPlugin.h:745
Interface to retrieve contextual information for a mixer.
Definition: IAkPlugin.h:392
Interface to retrieve metering information about a buffer.
Definition: AkCommonDefs.h:205
virtual void OnInputDisconnected(IAkMixerInputContext *in_pInput)=0