AAX SDK 2.6.1
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 Avid Technology, Inc.
5 * All rights reserved.
6 *
7 * CONFIDENTIAL: this document contains confidential information of Avid. Do
8 * not disclose to any third party. Use of the information contained in this
9 * document is subject to an Avid SDK license.
10 *
11 */
12
55#ifndef AAX_ASSERT_H
56#define AAX_ASSERT_H
57
58#include "AAX_Enums.h"
59
60
170#ifdef _TMS320C6X // TI-only
171
172 #ifndef TI_SHELL_TRACING_H
173 #include "TI_Shell_Tracing.h"
174 #endif
175
176 typedef AAX_ETracePriorityDSP EAAX_Trace_Priority;
177
178 #define kAAX_Trace_Priority_None AAX_eTracePriorityDSP_None
179 #define kAAX_Trace_Priority_Critical AAX_eTracePriorityDSP_High
180 #define kAAX_Trace_Priority_High AAX_eTracePriorityDSP_High
181 #define kAAX_Trace_Priority_Normal AAX_eTracePriorityDSP_Normal
182 #define kAAX_Trace_Priority_Low AAX_eTracePriorityDSP_Low
183 #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityDSP_Low
184
185 //Note that the Message provided to AAX_TRACE must be a cons string available for indefinite time
186 // because sending it to the host is done asynchronously.
187 #define AAX_TRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
188
189 //Stack traces not supported on TI - just log
190 #define AAX_STACKTRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
191 #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) TISHELLTRACE( iTracePriority, __VA_ARGS__ )
192
193 #define _STRINGIFY(x) #x
194 #define _TOSTRING(x) _STRINGIFY(x)
195
196 #define AAX_ASSERT( condition ) \
197 { \
198 if( ! (condition) ) _DoTrace( AAX_eTracePriorityDSP_Assert, \
199 CAT(CAT( CAT(__FILE__, ":"), _TOSTRING(__LINE__) ) , CAT(" failed: ", #condition) ) );\
200 }
201
202 #if defined(_DEBUG)
203 #define AAX_DEBUGASSERT( condition ) AAX_ASSERT( condition )
204 #define AAX_TRACE( ... ) AAX_TRACE_RELEASE( __VA_ARGS__ )
205 #define AAX_STACKTRACE( ... ) AAX_STACKTRACE_RELEASE( __VA_ARGS__ )
206 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
207
208 #else
209 #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
210 #define AAX_TRACE( ... ) do { ; } while (0)
211 #define AAX_STACKTRACE( ... ) do { ; } while (0)
212 #define AAX_TRACEORSTACKTRACE( ... ) do { ; } while (0)
213 #endif
214
215#else // Host:
216
217 #ifndef AAX_CHOSTSERVICES_H
218 #include "AAX_CHostServices.h"
219 #endif
220
222
223 #define kAAX_Trace_Priority_None AAX_eTracePriorityHost_None
224 #define kAAX_Trace_Priority_Critical AAX_eTracePriorityHost_Critical
225 #define kAAX_Trace_Priority_High AAX_eTracePriorityHost_High
226 #define kAAX_Trace_Priority_Normal AAX_eTracePriorityHost_Normal
227 #define kAAX_Trace_Priority_Low AAX_eTracePriorityHost_Low
228 #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityHost_Lowest
229
230 //Note that the Message provided to AAX_TRACE must be a const string available for indefinite time
231 // because sending it to the host is done asynchronously on TI
232 #define AAX_TRACE_RELEASE( iPriority, ... ) \
233 { \
234 AAX_CHostServices::Trace ( iPriority, __VA_ARGS__ ); \
235 };
236
237 #define AAX_STACKTRACE_RELEASE( iPriority, ... ) \
238 { \
239 AAX_CHostServices::StackTrace ( iPriority, iPriority, __VA_ARGS__ ); \
240 };
241
242 #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) \
243 { \
244 AAX_CHostServices::StackTrace ( iTracePriority, iStackTracePriority, __VA_ARGS__ ); \
245 };
246
247 #if defined(_DEBUG)
248
249 #define AAX_ASSERT( condition ) \
250 { \
251 if( ! ( condition ) ) { \
252 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
253 } \
254 };
255
256 #define AAX_DEBUGASSERT( condition ) \
257 { \
258 if( ! ( condition ) ) { \
259 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
260 } \
261 };
262
263 #define AAX_TRACE( iPriority, ... ) AAX_TRACE_RELEASE( iPriority, __VA_ARGS__ )
264 #define AAX_STACKTRACE( iPriority, ... ) AAX_STACKTRACE_RELEASE( iPriority, __VA_ARGS__ )
265 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
266
267 #else
268 #define AAX_ASSERT( condition ) \
269 { \
270 if( ! ( condition ) ) { \
271 AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log ); \
272 } \
273 };
274
275 #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
276 #define AAX_TRACE( iPriority, ... ) do { ; } while (0)
277 #define AAX_STACKTRACE( iPriority, ... ) do { ; } while (0)
278 #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) do { ; } while (0)
279 #endif
280
281#endif
282
283
284#endif // include guard
285// end of AAX_Assert.h
Utility functions for byte-swapping. Used by AAX_CChunkDataParser.
AAX_ETracePriorityHost
Platform-specific tracing priorities.
Definition: AAX_Enums.h:73
AAX_ETracePriorityDSP
Platform-specific tracing priorities.
Definition: AAX_Enums.h:89
Concrete implementation of the AAX_IHostServices interface.
AAX_ETracePriorityHost AAX_ETracePriority
Definition: AAX_Assert.h:221