Version
menu_open
link
Wwise SDK 2022.1.12
AkWwiseErrorHandler.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  Copyright (c) 2024 Audiokinetic Inc.
13 *******************************************************************************/
14 
15 // MessageTranslator.h
16 /// \file
17 /// Contains the wwiseErrorHandler
18 /// Has a static callback function that can recieved an error message from the sound engine.
19 /// Has a translator used to translate the message coming from the sound engine.
20 /// The translator can be a combination of multiple different type of translators. (See AddTranslator)
21 /// The translated message is then send back to the sound engine through another callback function.
22 
23 #ifndef AK_OPTIMIZED
24 
25 #pragma once
26 #include <AK/SoundEngine/Common/AkSoundEngine.h> // Sound engine
28 
30 class AkDefaultErrorMessageTranslator;
31 
33 {
34 public:
35  /// ErrorHandler class destructor.
36  virtual ~AkWwiseErrorHandler() {};
37 
38  /**
39  On initialization, a DefaultErrorMessageTranslator is created and affected to the m_currentMessageTranslator
40  */
41  static void Init();
42 
43  /**
44  Set the m_currentMessageTranslator to the given translator.
45  The added translator can either override previously added translator, or attach them to itself.
46  In the case overridePreviousTranslator is true, the responsibility of deleting all the translator previously attached to
47  the m_currentMessageTranslator will fall back to the class that created them.
48  Also, the given translator can override all previous translator(s) except the DefaultErrorMessageTranslator, which will
49  always be attached to the given translator.
50  @param[in] in_errorMessageTranslator The new translator that should be used by the error handler
51  @param[in] in_overridePreviousTranslator Whether or not the given translator should override previously set translator(s)
52  */
53  static void AddTranslator(AkErrorMessageTranslator* in_errorMessageTranslator, bool in_overridePreviousTranslator);
54 
55  /**
56  Delete the DefaultMessageTranslator and sets the m_currentMessageTranslator pointer to nullptr
57  */
58  static void Release();
59 
60  ///Translate and then send back the translated message to the sound engine via it's m_funcLocalOutput
61  static void Execute(
62  AK::Monitor::ErrorCode in_eErrorCode, ///< Error code number value
63  const AkOSChar* in_pszError, ///< Message or error string to be displayed
64  AK::Monitor::ErrorLevel in_errorLevel, ///< The error level of the message
65  AkPlayingID in_pID, ///< Related Playing ID if applicable, AK_INVALID_PLAYING_ID otherwise
66  AkUInt64 in_gId, ///< Related Game Object ID if applicable, AK_INVALID_GAME_OBJECT otherwise
67  AkUniqueID in_sId, ///< Related Sound ID if applicable, AK_INVALID__ID otherwise
68  char* in_args, ///< Variable arguments to replace the wwise tags contained in the message or error string
69  AkUInt32 in_uArgSize ///< Size of argument blob.
70  );
71 
72  ///Sets the localoutputfunc
73  static void SetLocalOutputFunc(AkUInt32 in_uErrorLevel, AK::Monitor::LocalOutputFunc in_pMonitorFunc) { m_uLocalOutputErrorLevel = in_uErrorLevel; m_funcLocalOutput = in_pMonitorFunc;};
74  static AK::Monitor::LocalOutputFunc GetLocalOutputFunc() { return m_funcLocalOutput; }
75  static AkUInt32 GetLocalOutputErrorLevel() { return m_uLocalOutputErrorLevel; }
76 
77 private:
78  /// ErrorHandler class constructor.
80 
81  static AK::Monitor::LocalOutputFunc m_funcLocalOutput;
82  static AkUInt32 m_uLocalOutputErrorLevel;
83  static AkDefaultErrorMessageTranslator m_defaultErrorMessageTranslator;
84  static AkErrorMessageTranslator* m_currentMessageTranslator;
85 };
86 
87 #endif // !AK_OPTIMIZED
ErrorCode
ErrorCode.
void(* LocalOutputFunc)(ErrorCode in_eErrorCode, const AkOSChar *in_pszError, ErrorLevel in_eErrorLevel, AkPlayingID in_playingID, AkGameObjectID in_gameObjID)
Function prototype of local output function pointer.
static void Execute(AK::Monitor::ErrorCode in_eErrorCode, const AkOSChar *in_pszError, AK::Monitor::ErrorLevel in_errorLevel, AkPlayingID in_pID, AkUInt64 in_gId, AkUniqueID in_sId, char *in_args, AkUInt32 in_uArgSize)
Translate and then send back the translated message to the sound engine via it's m_funcLocalOutput.
static void SetLocalOutputFunc(AkUInt32 in_uErrorLevel, AK::Monitor::LocalOutputFunc in_pMonitorFunc)
Sets the localoutputfunc.
char AkOSChar
Generic character string.
Definition: AkTypes.h:60
static void AddTranslator(AkErrorMessageTranslator *in_errorMessageTranslator, bool in_overridePreviousTranslator)
AkUInt32 AkUniqueID
Unique 32-bit ID.
Definition: AkTypes.h:120
static void Init()
virtual ~AkWwiseErrorHandler()
ErrorHandler class destructor.
uint64_t AkUInt64
Unsigned 64-bit integer.
uint32_t AkUInt32
Unsigned 32-bit integer.
static void Release()
ErrorLevel
ErrorLevel.
static AkUInt32 GetLocalOutputErrorLevel()
AkUInt32 AkPlayingID
Playing ID.
Definition: AkTypes.h:123
static AK::Monitor::LocalOutputFunc GetLocalOutputFunc()

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