VAE - Virtual Audio Engine 1
Small Data Driven Audio Engine
tklb Namespace Reference

Using template interfaces isn't an option so this simply defines a default Convolver type. More...

Namespaces

namespace  memory
 
namespace  ogg
 
namespace  uuid
 
namespace  wave
 

Classes

class  AudioBufferTpl
 Class for handling the most basic audio needs. More...
 
class  AudioRingBufferTpl
 
class  BaseDelegate
 Stripped down version of this delegate implementation https://github.com/marcmo/delegates/tree/f0938dac2ad779226ef637da350e964ac8008ba5 Stripped return value, const and free function version TODO tklb add return type back in. More...
 
class  ConvolverBruteTpl
 Brute force convolver using element wise multiplication. More...
 
class  ConvolverMonoTpl
 Single stage mono convolver based on HiFi-Lofis convolver The FFT and buffers use the tklb types and the simd was replaced with xsimd TODO tklb all ! FIX THIS MESS ! FIX THIS MESS ! FIX THIS MESS ! FIX THIS MESS. More...
 
class  ConvolverRefTpl
 Wraps up the FttConvolver to support type conversion. More...
 
class  ConvolverTpl
 Multichannel version of the convolver. More...
 
struct  Delegate
 
struct  Delegate< void(Parameters...)>
 
struct  DelegateFactory
 A factory is needed to ba able to convert the void pointer back to the object and call the member function. More...
 
class  EventBus
 
class  FFTOoura
 
class  FFTpffft
 
struct  FileInfo
 
class  HandleBuffer
 TODO broken don't use. More...
 
class  HeapBuffer
 Basically a bad std::vector without exceptions which can also work with foreign memory. More...
 
class  LockGuard
 
class  LockGuardTry
 
class  Logger
 
struct  MallocInfo
 
class  Mutex
 std::mutex wrapper More...
 
class  MutexDummy
 Dummy Mutex which doesn't synchronise a all. More...
 
class  Oversampler
 Super simple wrapper for the hiir up and down samplers It only goes up to 4x oversampling Its type is also bound to the Audiouffers default sample type in order to avoid including all versions of the hiir library. More...
 
class  ResamplerCosineTpl
 
class  ResamplerHoldTpl
 
class  ResamplerLinearTpl
 
class  ResamplerSpeexTpl
 
class  SectionClock
 
class  SectionTimer
 
class  SpinLock
 Spinlock ! probably not thread safe. More...
 
class  StackString
 Super simple class to hold and compare strings on the stack. More...
 
struct  StdAllocator
 
class  String
 

Typedefs

using ConvolverBruteFloat = ConvolverBruteTpl< float >
 
using ConvolverBruteDouble = ConvolverBruteTpl< double >
 
using ConvolverBrute = ConvolverBruteTpl< double >
 
typedef ConvolverMonoTpl< float > ConvolverMonoFloat
 
typedef ConvolverMonoTpl< double > ConvolverMonoDouble
 
typedef ConvolverMonoDouble ConvolverMono
 
typedef ConvolverTpl< float > ConvolverFloat
 
typedef ConvolverTpl< double > ConvolverDouble
 
typedef ConvolverDouble Convolver
 
using ConvolverRefFloat = ConvolverRefTpl< float >
 
using ConvolverRefDouble = ConvolverRefTpl< double >
 
using ConvolverRef = ConvolverRefTpl< double >
 
using FFT = FFTpffft
 
template<typename T , class Buffer = AudioBufferTpl<T>>
using ResamplerTpl = ResamplerSpeexTpl< T, Buffer >
 
using Resampler = ResamplerSpeex
 
using ResamplerCosine = ResamplerCosineTpl< double >
 
using ResamplerHold = ResamplerHoldTpl< double >
 
using ResamplerLinear = ResamplerLinearTpl< double >
 
using ResamplerSpeex = ResamplerSpeexTpl< double >
 
using AudioBufferFloat = AudioBufferTpl< float >
 
using AudioBufferDouble = AudioBufferTpl< double >
 
using AudioBuffer = AudioBufferTpl< double >
 
using AudioRingBufferFloat = AudioRingBufferTpl< float >
 
using AudioRingBufferDouble = AudioRingBufferTpl< double >
 
using AudioRingBuffer = AudioRingBufferTpl< double >
 

Functions

template<typename T , typename... Parameters>
DelegateFactory< T, Parameters... > MakeDelegate (void(T::*)(Parameters...))
 
void * tklbMalloc (const size_t size, const char *file, int line)
 
void * tklbCalloc (const size_t size, const size_t typeSize, const char *file, int line)
 
void tklbFree (void *ptr, const char *file, int line)
 
void * tklbRealloc (void *ptr, size_t size, const char *file, int line)
 
template<typename T >
powerOf2 (const T &&v)
 
template<typename T >
min (const T &v1, const T &v2)
 
template<typename T >
max (const T &v1, const T &v2)
 
template<typename T >
clamp (const T &v, const T &_min, const T &_max)
 
template<typename T , typename T2 >
lerp (const T &v1, const T &v2, const T2 &t)
 

Variables

constexpr size_t DEFAULT_ALIGNMENT = xsimd::default_arch::alignment()
 
const std::string PATH_DELIMITER
 
static size_t allocationCount = 0
 
static size_t curruptions = 0
 
static size_t allocationsTotal = 0
 
constexpr double PI = 3.14159265358979323846
 

Detailed Description

Using template interfaces isn't an option so this simply defines a default Convolver type.

! Unuseable mess

Using template interfaces isn't an option so this simply defines a default Resampler type.

An unified interface is only enforced by the unit tests.

Typedef Documentation

◆ AudioBuffer

using tklb::AudioBuffer = typedef AudioBufferTpl<double>

Definition at line 678 of file TAudioBuffer.hpp.

◆ AudioBufferDouble

using tklb::AudioBufferDouble = typedef AudioBufferTpl<double>

Definition at line 672 of file TAudioBuffer.hpp.

◆ AudioBufferFloat

using tklb::AudioBufferFloat = typedef AudioBufferTpl<float>

Definition at line 671 of file TAudioBuffer.hpp.

◆ AudioRingBuffer

using tklb::AudioRingBuffer = typedef AudioRingBufferTpl<double>

Definition at line 130 of file TAudioRingBuffer.hpp.

◆ AudioRingBufferDouble

Definition at line 124 of file TAudioRingBuffer.hpp.

◆ AudioRingBufferFloat

Definition at line 123 of file TAudioRingBuffer.hpp.

◆ Convolver

Definition at line 256 of file TConvolverFFT.hpp.

◆ ConvolverBrute

using tklb::ConvolverBrute = typedef ConvolverBruteTpl<double>

Definition at line 94 of file TConvolverBrute.hpp.

◆ ConvolverBruteDouble

Definition at line 88 of file TConvolverBrute.hpp.

◆ ConvolverBruteFloat

Definition at line 87 of file TConvolverBrute.hpp.

◆ ConvolverDouble

Definition at line 250 of file TConvolverFFT.hpp.

◆ ConvolverFloat

Definition at line 249 of file TConvolverFFT.hpp.

◆ ConvolverMono

Definition at line 210 of file TConvolverFFT.hpp.

◆ ConvolverMonoDouble

Definition at line 204 of file TConvolverFFT.hpp.

◆ ConvolverMonoFloat

Definition at line 203 of file TConvolverFFT.hpp.

◆ ConvolverRef

using tklb::ConvolverRef = typedef ConvolverRefTpl<double>

Definition at line 125 of file TConvolverRef.hpp.

◆ ConvolverRefDouble

using tklb::ConvolverRefDouble = typedef ConvolverRefTpl<double>

Definition at line 119 of file TConvolverRef.hpp.

◆ ConvolverRefFloat

using tklb::ConvolverRefFloat = typedef ConvolverRefTpl<float>

Definition at line 118 of file TConvolverRef.hpp.

◆ FFT

using tklb::FFT = typedef FFTpffft

Definition at line 13 of file TFFT.hpp.

◆ Resampler

Definition at line 22 of file TResampler.hpp.

◆ ResamplerCosine

using tklb::ResamplerCosine = typedef ResamplerCosineTpl<double>

Definition at line 148 of file TResamplerCosine.hpp.

◆ ResamplerHold

using tklb::ResamplerHold = typedef ResamplerHoldTpl<double>

Definition at line 121 of file TResamplerHold.hpp.

◆ ResamplerLinear

using tklb::ResamplerLinear = typedef ResamplerLinearTpl<double>

Definition at line 150 of file TResamplerLinear.hpp.

◆ ResamplerSpeex

using tklb::ResamplerSpeex = typedef ResamplerSpeexTpl<double>

Definition at line 211 of file TResamplerSpeex.hpp.

◆ ResamplerTpl

template<typename T , class Buffer = AudioBufferTpl<T>>
using tklb::ResamplerTpl = typedef ResamplerSpeexTpl<T, Buffer>

Definition at line 21 of file TResampler.hpp.

Function Documentation

◆ clamp()

template<typename T >
T tklb::clamp ( const T &  v,
const T &  _min,
const T &  _max 
)
inline

Definition at line 26 of file TMath.hpp.

26 {
27 return min(_max, max(v, _min));
28 }
T min(const T &v1, const T &v2)
Definition: TMath.hpp:16
T max(const T &v1, const T &v2)
Definition: TMath.hpp:21
Here is the call graph for this function:

◆ lerp()

template<typename T , typename T2 >
T tklb::lerp ( const T &  v1,
const T &  v2,
const T2 &  t 
)
inline

Definition at line 31 of file TMath.hpp.

31 {
32 return v1 + t * (v2 - v1);
33 }

◆ MakeDelegate()

template<typename T , typename... Parameters>
DelegateFactory< T, Parameters... > tklb::MakeDelegate ( void(T::*)(Parameters...)  )

Definition at line 55 of file TDelegate.hpp.

55 {
56 return DelegateFactory<T, Parameters...>();
57 }
A factory is needed to ba able to convert the void pointer back to the object and call the member fun...
Definition: TDelegate.hpp:42

◆ max()

template<typename T >
T tklb::max ( const T &  v1,
const T &  v2 
)
inline

Definition at line 21 of file TMath.hpp.

21 {
22 return v1 < v2 ? v2 : v1;
23 }
Here is the caller graph for this function:

◆ min()

template<typename T >
T tklb::min ( const T &  v1,
const T &  v2 
)
inline

Definition at line 16 of file TMath.hpp.

16 {
17 return v1 < v2 ? v1 : v2;
18 }
Here is the caller graph for this function:

◆ powerOf2()

template<typename T >
T tklb::powerOf2 ( const T &&  v)
inline

Definition at line 9 of file TMath.hpp.

9 {
10 T p = 1;
11 while (p < v) { p *= 2; }
12 return p;
13 }
Here is the caller graph for this function:

◆ tklbCalloc()

void * tklb::tklbCalloc ( const size_t  size,
const size_t  typeSize,
const char *  file,
int  line 
)

Definition at line 66 of file TLeakChecker.h.

66 {
67 void* ret = tklbMalloc(size, file, line);
68 if (ret) {
69 memset(ret, 0, size);
70 }
71 return ret;
72}
void * tklbMalloc(const size_t size, const char *file, int line)
Definition: TLeakChecker.h:35
Here is the call graph for this function:

◆ tklbFree()

void tklb::tklbFree ( void *  ptr,
const char *  file,
int  line 
)

Definition at line 74 of file TLeakChecker.h.

74 {
75 if (ptr == nullptr) { return; }
76#ifndef TKLB_LEAKCHECKER_NO_INFO
77 MallocInfo* info = reinterpret_cast<MallocInfo*>(ptr) - 1;
78
79 int* magicNumber = reinterpret_cast<int*>(
80 reinterpret_cast<unsigned char*>(info) + info->size + sizeof(MallocInfo)
81 );
82 if ((*magicNumber) != TKLB_MAGIC_NUMBER) {
83 // Magic number was overwritten
85 assert(false);
86 }
87 free(info);
88#else
89 free(ptr);
90#endif
91 if (allocationCount == 0) {
92 assert(false);
93 }
95}
#define free(ptr)
Definition: TLeakChecker.h:142
#define TKLB_MAGIC_NUMBER
Definition: TLeakChecker.h:16
static size_t curruptions
Definition: TLeakChecker.h:24
static size_t allocationCount
Definition: TLeakChecker.h:22
Here is the caller graph for this function:

◆ tklbMalloc()

void * tklb::tklbMalloc ( const size_t  size,
const char *  file,
int  line 
)

Definition at line 35 of file TLeakChecker.h.

35 {
36#ifndef TKLB_LEAKCHECKER_NO_INFO
37 if (size == 0) { return nullptr; } // We add bytes, so this is needed
38 // Make space for the info struct and a magic number at the end
39 MallocInfo* ptr = reinterpret_cast<MallocInfo*>(
40 malloc(size + sizeof(MallocInfo) + sizeof(int))
41 );
42 if (!ptr) { return nullptr; }
45 ptr->file = file;
46 ptr->line = line;
47 ptr->size = size;
48 ptr->allocation = allocationCount;
49
50 int* magicNumber = reinterpret_cast<int*>(
51 reinterpret_cast<unsigned char*>(ptr) + size + sizeof(MallocInfo)
52 );
53 (*magicNumber) = TKLB_MAGIC_NUMBER;
54
55 return ptr + 1;
56#else
57 void* ret = malloc(size);
58 if (ret) {
61 }
62 return ret;
63#endif
64}
#define malloc(size)
Definition: TLeakChecker.h:141
static size_t allocationsTotal
Definition: TLeakChecker.h:26
Here is the caller graph for this function:

◆ tklbRealloc()

void * tklb::tklbRealloc ( void *  ptr,
size_t  size,
const char *  file,
int  line 
)

Definition at line 97 of file TLeakChecker.h.

97 {
98 MallocInfo* info = reinterpret_cast<MallocInfo*>(ptr);
99 void* ptr2 = tklbMalloc(size, file, line);
100 if (ptr2 == nullptr) { return ptr; }
101 if (ptr == nullptr) {
102 return ptr2;
103 }
104#ifndef TKLB_LEAKCHECKER_NO_INFO
105 memcpy(ptr2, ptr, info->size < size ? info->size : size);
106#else
107 memcpy(ptr2, ptr, size);
108#endif
109 tklbFree(ptr, file, line);
110 return ptr2;
111}
void tklbFree(void *ptr, const char *file, int line)
Definition: TLeakChecker.h:74
Here is the call graph for this function:

Variable Documentation

◆ allocationCount

size_t tklb::allocationCount = 0
static

Definition at line 22 of file TLeakChecker.h.

◆ allocationsTotal

size_t tklb::allocationsTotal = 0
static

Definition at line 26 of file TLeakChecker.h.

◆ curruptions

size_t tklb::curruptions = 0
static

Definition at line 24 of file TLeakChecker.h.

◆ DEFAULT_ALIGNMENT

constexpr size_t tklb::DEFAULT_ALIGNMENT = xsimd::default_arch::alignment()
constexpr

Definition at line 23 of file TAudioBuffer.hpp.

◆ PATH_DELIMITER

const std::string tklb::PATH_DELIMITER
Initial value:
=
"/"

Definition at line 22 of file TFile.hpp.

◆ PI

constexpr double tklb::PI = 3.14159265358979323846
constexpr

Definition at line 6 of file TMath.hpp.