Wwise SDK 2023.1.5
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.
5 Commercial License Usage
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.
12  Copyright (c) 2024 Audiokinetic Inc.
13 *******************************************************************************/
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.
23 #ifndef AK_OPTIMIZED
25 #pragma once
26 #include <AK/SoundEngine/Common/AkSoundEngine.h> // Sound engine
30 class AkDefaultErrorMessageTranslator;
33 {
34 public:
35  /// ErrorHandler class destructor.
36  virtual ~AkWwiseErrorHandler() {};
38  /**
39  Set the m_currentMessageTranslator to the given translator.
40  The added translator can either override previously added translator, or attach them to itself.
41  In the case overridePreviousTranslator is true, the responsibility of deleting all the translator previously attached to
42  the m_currentMessageTranslator will fall back to the class that created them.
43  Also, the given translator can override all previous translator(s) except the DefaultErrorMessageTranslator, which will
44  always be attached to the given translator.
45  @param[in] in_errorMessageTranslator The new translator that should be used by the error handler
46  @param[in] in_overridePreviousTranslator Whether or not the given translator should override previously set translator(s)
47  */
48  static void AddTranslator(AkErrorMessageTranslator* in_errorMessageTranslator, bool in_overridePreviousTranslator);
50  /**
51  Delete the DefaultMessageTranslator and sets the m_currentMessageTranslator pointer to nullptr
52  */
53  static void Release();
55  /**
56  Reset the translator chain to the default, which only prints numbers for IDs in error messages
57  */
58  static void ResetTranslator();
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  AkOSChar* out_pBuffer = nullptr, ///< Optional: buffer to receive the output string. If not provided, the output goes to the local output function
71  AkUInt32 in_BufferSize = 0 ///< Optional: out_pBuffer size.
72  );
74  ///Sets the localoutputfunc
75  static void SetLocalOutputFunc(AkUInt32 in_uErrorLevel, AK::Monitor::LocalOutputFunc in_pMonitorFunc) { m_uLocalOutputErrorLevel = in_uErrorLevel; m_funcLocalOutput = in_pMonitorFunc;};
76  static AK::Monitor::LocalOutputFunc GetLocalOutputFunc() { return m_funcLocalOutput; }
77  static AkUInt32 GetLocalOutputErrorLevel() { return m_uLocalOutputErrorLevel; }
79 private:
80  /// ErrorHandler class constructor.
83  static AK::Monitor::LocalOutputFunc m_funcLocalOutput;
84  static AkUInt32 m_uLocalOutputErrorLevel;
85  static AkDefaultErrorMessageTranslator m_defaultErrorMessageTranslator;
86  static AkErrorMessageTranslator* m_currentMessageTranslator;
87 };
89 #endif // !AK_OPTIMIZED
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 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:52
static void ResetTranslator()
virtual ~AkWwiseErrorHandler()
ErrorHandler class destructor.
uint64_t AkUInt64
Unsigned 64-bit integer.
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, AkOSChar *out_pBuffer=nullptr, AkUInt32 in_BufferSize=0)
Translate and then send back the translated message to the sound engine via it's m_funcLocalOutput.
uint32_t AkUInt32
Unsigned 32-bit integer.
static void Release()
static AkUInt32 GetLocalOutputErrorLevel()
AkUInt32 AkPlayingID
Playing ID.
Definition: AkTypes.h:55
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