Flan
Classes | Namespaces | Macros | Functions
r8bbase.h File Reference

The "base" inclusion file with basic classes and functions. More...

#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "r8bconf.h"
#include <pthread.h>
Include dependency graph for r8bbase.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  r8b::CStdClassAllocator
 The default base class for objects created on heap. More...
 
class  r8b::CStdMemAllocator
 The default base class for objects that allocate blocks of memory. More...
 
class  r8b::CFixedBuffer< T >
 Templated memory buffer class for element buffers of fixed capacity. More...
 
class  r8b::CPtrKeeper< T >
 Pointer-to-object "keeper" class with automatic deletion. More...
 
class  r8b::CSyncObject
 Multi-threaded synchronization object class. More...
 
class  r8b::CSyncKeeper
 A "keeper" class for CSyncObject-based synchronization. More...
 
class  r8b::CSineGen
 Sine signal generator class. More...
 

Namespaces

 r8b
 The "r8brain-free-src" library namespace.
 

Macros

#define R8B_VERSION   "4.6"
 Macro defines r8brain-free-src version string.
 
#define M_PI   3.14159265358979324
 The macro equals to "pi" constant, fits 53-bit floating point mantissa.
 
#define M_2PI   6.28318530717958648
 The M_2PI macro equals to "2 * pi" constant, fits 53-bit floating point mantissa.
 
#define M_3PI   9.42477796076937972
 The M_3PI macro equals to "3 * pi" constant, fits 53-bit floating point mantissa.
 
#define M_4PI   12.56637061435917295
 The M_4PI macro equals to "4 * pi" constant, fits 53-bit floating point mantissa.
 
#define M_PId2   1.57079632679489662
 The macro equals to "pi divided by 2" constant, fits 53-bit floating point mantissa.
 
#define R8BNOCTOR(ClassName)
 A special macro that defines empty copy-constructor and copy operator with the "private:" prefix. More...
 
#define R8BSYNC(SyncObject)   R8BSYNC_( SyncObject, __LINE__ )
 The synchronization macro. More...
 
#define R8BSYNC_(SyncObject, id)   R8BSYNC__( SyncObject, id )
 
#define R8BSYNC__(SyncObject, id)   CSyncKeeper SyncKeeper##id( SyncObject )
 

Functions

int r8b::getBitOccupancy (const int v)
 
void r8b::calcFIRFilterResponse (const double *flt, int fltlen, const double th, double &re0, double &im0, const int fltlat=0)
 Function calculates frequency response of the specified FIR filter at the specified circular frequency. More...
 
void r8b::calcFIRFilterResponseAndGroupDelay (const double *const flt, const int fltlen, const double th, double &re, double &im, double &gd)
 Function calculates frequency response and group delay of the specified FIR filter at the specified circular frequency. More...
 
void r8b::normalizeFIRFilter (double *const p, const int l, const double DCGain, const int pstep=1)
 Function normalizes FIR filter so that its frequency response at DC is equal to DCGain. More...
 
void r8b::calcSpline3p8Coeffs (double *c, const double xm3, const double xm2, const double xm1, const double x0, const double x1, const double x2, const double x3, const double x4)
 Function calculates coefficients used to calculate 3rd order spline (polynomial) on the equidistant lattice, using 8 points. More...
 
void r8b::calcSpline2p8Coeffs (double *c, const double xm3, const double xm2, const double xm1, const double x0, const double x1, const double x2, const double x3, const double x4)
 Function calculates coefficients used to calculate 2rd order spline (polynomial) on the equidistant lattice, using 8 points. More...
 
void r8b::calcInterpCoeffs3p4 (double *const c, const double *const y)
 Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 4 points. More...
 
void r8b::calcInterpCoeffs3p6 (double *const c, const double *const y)
 Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 6 points. More...
 
void r8b::calcInterpCoeffs3p8 (double *const c, const double *const y)
 Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points. More...
 
void r8b::calcInterpCoeffs2p8 (double *const c, const double *const y)
 Function calculates coefficients used to calculate 3rd order segment interpolation polynomial on the equidistant lattice, using 8 points. More...
 
template<class T >
r8b::min (const T &v1, const T &v2)
 
template<class T >
r8b::max (const T &v1, const T &v2)
 
double r8b::clampr (const double Value, const double minv, const double maxv)
 Function "clamps" (clips) the specified value so that it is not lesser than "minv", and not greater than "maxv". More...
 
double r8b::sqr (const double x)
 
double r8b::pows (const double v, const double p)
 
double r8b::gauss (const double v)
 
double r8b::asinh (const double v)
 
double r8b::besselI0 (const double x)
 

Detailed Description

The "base" inclusion file with basic classes and functions.

This is the "base" inclusion file for the "r8brain-free-src" sample rate converter. This inclusion file contains implementations of several small utility classes and functions used by the library.

r8brain-free-src Copyright (c) 2013-2019 Aleksey Vaneev See the "License.txt" file for license.

Macro Definition Documentation

◆ R8BNOCTOR

#define R8BNOCTOR (   ClassName)
Value:
private: \
ClassName( const ClassName& ) { } \
ClassName& operator = ( const ClassName& ) { return( *this ); }

A special macro that defines empty copy-constructor and copy operator with the "private:" prefix.

This macro should be used in classes that cannot be copied in a standard C++ way.

This macro does not need to be defined in classes derived from a class where such macro was already used.

Parameters
ClassNameThe name of the class which uses this macro.

◆ R8BSYNC

#define R8BSYNC (   SyncObject)    R8BSYNC_( SyncObject, __LINE__ )

The synchronization macro.

The R8BSYNC( obj ) macro, which creates and object of the r8b::CSyncKeeper class on stack, should be put before sections of the code that may potentially change data asynchronously with other threads at the same time. The R8BSYNC( obj ) macro "acquires" the synchronization object thus blocking execution of other threads that also use the same R8BSYNC( obj ) macro. The blocked section begins with the R8BSYNC( obj ) macro and finishes at the end of the current C++ code block. Multiple R8BSYNC() macros may be defined from within the same code block.

Parameters
SyncObjectAn object of the CSyncObject type that is used for synchronization.