Version
menu_open
Wwise SDK 2023.1.5
AkInstrument.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  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 #pragma once
28 
31 
32 namespace AK
33 {
34  namespace Instrument
35  {
36 #ifndef AK_OPTIMIZED
38  AkPluginID in_uPluginID,
39  const char * in_pszZoneName
40  );
41 
42  AK_CALLBACK(void, PopTimerFunc)(void* in_pToken);
43 
45  AkPluginID in_uPluginID,
46  const char* in_pszMarkerName
47  );
48 
50  AkPluginID in_uPluginID,
51  AkUInt32 in_uMetadata
52  );
53 
58 
59  class Scope
60  {
61  public:
62  inline Scope(AkPluginID in_uPluginID, const char* in_pszZoneName)
63  {
64  m_pToken = g_fnPushTimer(in_uPluginID, in_pszZoneName);
65  }
66 
67  inline ~Scope()
68  {
69  g_fnPopTimer(m_pToken);
70  }
71  private:
72  void* m_pToken;
73  };
74 
75 #endif
76  }
77 }
78 
79 #if !defined(AK_OPTIMIZED)
80 
81 #define AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_) (AK::Instrument::g_fnPushTimer(_plugin_id_, _zone_name_))
82 #define AK_INSTRUMENT_END(__token__) (AK::Instrument::g_fnPopTimer(__token__))
83 #define AK_INSTRUMENT_MARKER(_plugin_id_, _marker_name_) (AK::Instrument::g_fnPostMarker(_plugin_id_, _marker_name_))
84 #define AK_INSTRUMENT_MARKER_PROFILINGID(_profilingid_) (AK::Instrument::g_fnPostMarker(AKMAKECLASSID( AkPluginTypeNone, AKCOMPANYID_AUDIOKINETIC, _profilingid_ ), nullptr))
85 #define AK_INSTRUMENT_METAMARKER(_plugin_id_, _metadata_) (AK::Instrument::g_fnPostMetaMarker(_plugin_id_, _metadata_))
86 
87 #define AK_INSTRUMENT_CONCAT_INNER(_base_, _counter_) _base_ ## _counter_
88 #define AK_INSTRUMENT_CONCAT(_base_, _counter_) AK_INSTRUMENT_CONCAT_INNER(_base_, _counter_)
89 
90 #define AK_INSTRUMENT_SCOPE(_zone_name_) \
91  AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(0, _zone_name_)
92 
93 #define AK_INSTRUMENT_SCOPE_ID(_plugin_id_, _zone_name_) \
94  AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(_plugin_id_, _zone_name_)
95 
96 #define AK_INSTRUMENT_SCOPE_PROFILINGID(_profilingid_) \
97  AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(AKMAKECLASSID( AkPluginTypeNone, AKCOMPANYID_AUDIOKINETIC, _profilingid_ ), nullptr)
98 
99 #define AK_INSTRUMENT_THREAD_START( _thread_name_ )
100 
101 #else // AK_OPTIMIZED
102 
103 #define AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_) (void*)( 0 )
104 #define AK_INSTRUMENT_END(__token__)
105 #define AK_INSTRUMENT_MARKER(_plugin_id_, _zone_name_)
106 #define AK_INSTRUMENT_MARKER_PROFILINGID(_profilingid_)
107 #define AK_INSTRUMENT_METAMARKER(_plugin_id_, _metadata_)
108 #define AK_INSTRUMENT_SCOPE( _zone_name_ )
109 #define AK_INSTRUMENT_SCOPE_ID(_plugin_id_, _zone_name_)
110 #define AK_INSTRUMENT_SCOPE_PROFILINGID(_plugin_id_)
111 
112 #define AK_INSTRUMENT_THREAD_START( _thread_name_ )
113 
114 #endif // AK_OPTIMIZED
115 
116 #ifndef AK_INSTRUMENT_BEGIN_C
117  #define AK_INSTRUMENT_BEGIN_C(_plugin_id_, _color_, _zone_name_) AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_)
118 #endif
Audiokinetic namespace.
PostMarkerFunc g_fnPostMarker
#define AKSOUNDENGINE_API
AkUInt32 AkPluginID
Source or effect plug-in ID.
Definition: AkTypes.h:63
void(* PostMarkerFunc)(AkPluginID in_uPluginID, const char *in_pszMarkerName)
Definition: AkInstrument.h:44
#define AK_CALLBACK(_type, _name)
PopTimerFunc g_fnPopTimer
PushTimerFunc g_fnPushTimer
void *(* PushTimerFunc)(AkPluginID in_uPluginID, const char *in_pszZoneName)
Definition: AkInstrument.h:37
void(* PostMetaMarkerFunc)(AkPluginID in_uPluginID, AkUInt32 in_uMetadata)
Definition: AkInstrument.h:49
uint32_t AkUInt32
Unsigned 32-bit integer.
void(* PopTimerFunc)(void *in_pToken)
Definition: AkInstrument.h:42
Scope(AkPluginID in_uPluginID, const char *in_pszZoneName)
Definition: AkInstrument.h:62
PostMetaMarkerFunc g_fnPostMetaMarker

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise