AAX SDK 2.8.0
Avid Audio Extensions Development Kit
Loading...
Searching...
No Matches
AAX_Assert.h
Go to the documentation of this file.
1/*================================================================================================*/
2/*
3 *
4 * Copyright 2013-2015, 2018, 2023-2024 Avid Technology, Inc.
5 * All rights reserved.
6 *
7 * This file is part of the Avid AAX SDK.
8 *
9 * The AAX SDK is subject to commercial or open-source licensing.
10 *
11 * By using the AAX SDK, you agree to the terms of both the Avid AAX SDK License
12 * Agreement and Avid Privacy Policy.
13 *
14 * AAX SDK License: https://developer.avid.com/aax
15 * Privacy Policy: https://www.avid.com/legal/privacy-policy-statement
16 *
17 * Or: You may also use this code under the terms of the GPL v3 (see
18 * www.gnu.org/licenses).
19 *
20 * THE AAX SDK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 * EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 * DISCLAIMED.
23 *
24 */
25
68#ifndef AAX_ASSERT_H
69#define AAX_ASSERT_H
70
71#include "AAX_Enums.h"
72
73
183#ifdef _TMS320C6X // TI-only
184
185 #ifndef TI_SHELL_TRACING_H
186 #include "TI_Shell_Tracing.h"
187 #endif
188
189 typedef AAX_ETracePriorityDSP EAAX_Trace_Priority;
190
191 #define kAAX_Trace_Priority_None AAX_eTracePriorityDSP_None
192 #define kAAX_Trace_Priority_Critical AAX_eTracePriorityDSP_High
193 #define kAAX_Trace_Priority_High AAX_eTracePriorityDSP_High
194 #define kAAX_Trace_Priority_Normal AAX_eTracePriorityDSP_Normal
195 #define kAAX_Trace_Priority_Low AAX_eTracePriorityDSP_Low
196 #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityDSP_Low
197
198 //Note that the Message provided to AAX_TRACE must be a cons string available for indefinite time
199 // because sending it to the host is done asynchronously.
200 #define AAX_TRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
201
202 //Stack traces not supported on TI - just log
203 #define AAX_STACKTRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
204 #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) TISHELLTRACE( iTracePriority, __VA_ARGS__ )
205
206 #define _STRINGIFY(x) #x
207 #define _TOSTRING(x) _STRINGIFY(x)
208
209 #define AAX_ASSERT( condition ) \
210 { \
211 if( ! (condition) ) _DoTrace( AAX_eTracePriorityDSP_Assert, \
212 CAT(CAT( CAT(__FILE__, ":"), _TOSTRING(__LINE__) ) , CAT(" failed: ", #condition) ) );\
213 }
214
215 #if defined(_DEBUG)
216 #define AAX_DEBUGASSERT( condition ) AAX_ASSERT( condition )
217 #define AAX_TRACE( ... ) AAX_TRACE_RELEASE( __VA_ARGS__ )
218 #define AAX_STACKTRACE( ... ) AAX_STACKTRACE_RELEASE( __VA_ARGS__ )
219 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
220
221 #else
222 #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
223 #define AAX_TRACE( ... ) do { ; } while (0)
224 #define AAX_STACKTRACE( ... ) do { ; } while (0)
225 #define AAX_TRACEORSTACKTRACE( ... ) do { ; } while (0)
226 #endif
227
228#else // Host:
229
230 #ifndef AAX_CHOSTSERVICES_H
231 #include "AAX_CHostServices.h"
232 #endif
233
235
236 #define kAAX_Trace_Priority_None AAX_eTracePriorityHost_None
237 #define kAAX_Trace_Priority_Critical AAX_eTracePriorityHost_Critical
238 #define kAAX_Trace_Priority_High AAX_eTracePriorityHost_High
239 #define kAAX_Trace_Priority_Normal AAX_eTracePriorityHost_Normal
240 #define kAAX_Trace_Priority_Low AAX_eTracePriorityHost_Low
241 #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityHost_Lowest
242
243 //Note that the Message provided to AAX_TRACE must be a const string available for indefinite time
244 // because sending it to the host is done asynchronously on TI
245 #define AAX_TRACE_RELEASE( iPriority, ... ) \
246 { \
247 AAX_CHostServices::Trace ( iPriority, __VA_ARGS__ ); \
248 };
249
250 #define AAX_STACKTRACE_RELEASE( iPriority, ... ) \
251 { \
252 AAX_CHostServices::StackTrace ( iPriority, iPriority, __VA_ARGS__ ); \
253 };
254
255 #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) \
256 { \
257 AAX_CHostServices::StackTrace ( iTracePriority, iStackTracePriority, __VA_ARGS__ ); \
258 };
259
260 #if defined(_DEBUG)
261
262 #define AAX_ASSERT( condition ) \
263 { \
264 if( ! ( condition ) ) { \
265 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
266 } \
267 };
268
269 #define AAX_DEBUGASSERT( condition ) \
270 { \
271 if( ! ( condition ) ) { \
272 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
273 } \
274 };
275
276 #define AAX_TRACE( iPriority, ... ) AAX_TRACE_RELEASE( iPriority, __VA_ARGS__ )
277 #define AAX_STACKTRACE( iPriority, ... ) AAX_STACKTRACE_RELEASE( iPriority, __VA_ARGS__ )
278 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
279
280 #else
281 #define AAX_ASSERT( condition ) \
282 { \
283 if( ! ( condition ) ) { \
284 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log ); \
285 } \
286 };
287
288 #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
289 #define AAX_TRACE( iPriority, ... ) do { ; } while (0)
290 #define AAX_STACKTRACE( iPriority, ... ) do { ; } while (0)
291 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) do { ; } while (0)
292 #endif
293
294#endif
295
296
297#endif // include guard
298// end of AAX_Assert.h
Utility functions for byte-swapping. Used by AAX_CChunkDataParser.
AAX_ETracePriorityHost
Platform-specific tracing priorities.
Definition: AAX_Enums.h:86
AAX_ETracePriorityDSP
Platform-specific tracing priorities.
Definition: AAX_Enums.h:102
Concrete implementation of the AAX_IHostServices interface.
AAX_ETracePriorityHost AAX_ETracePriority
Definition: AAX_Assert.h:234