All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
ScopedGlitchDetector Class Reference

Public Member Functions

 ScopedGlitchDetector (Processor *const processor, int location_)
 

Detailed Description

A small helper class that detects a timeout.

Use this to catch down drop outs by adding it to time critical functions in the audio thread and set a global time out value using either setMaxMilliSeconds() or, more convenient, setMaxTimeOutFromBufferSize().

Then in your function create a object of this class on the stack and when it is destroyed after the function terminates it measures the lifespan of the object and logs to the current system Logger if it exceeds the timespan.

The Identifier you pass in should be unique. It will be used to deactivate logging until you create a GlitchDetector with the same ID again. This makes sure you only get one log per glitch (if you have multiple GlitchDetectors in your stack trace, they all would fire if a glitch occurred.

You might want to use the macro ADD_GLITCH_DETECTOR(name) (where name is a simple C string literal which will be parsed to a static Identifier, because it can be excluded for deployment builds using

#define USE_GLITCH_DETECTION 0

This macro can be only used once per function scope, but this should be OK...

Constructor & Destructor Documentation

ScopedGlitchDetector ( Processor *const  processor,
int  location_ 
)

Creates a new GlitchDetector with a given identifier.

It uses the id to only log the last call in a stack trace, so you only get the GlitchDetector where the glitch actually occured.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.