Beatmup
Beatmup::Audio::Processing Namespace Reference

Contains templates calling elementary audio signal processing routines depending on sample formats of their arguments. More...

Functions

template<template< typename, typename > class Func, typename... Args>
void pipeline (const AudioSampleFormat inFormat, const AudioSampleFormat outFormat, const sample8 *input, sample8 *output, Args &&... args)
 

Detailed Description

Contains templates calling elementary audio signal processing routines depending on sample formats of their arguments.

An elementary routine is a class template having a public function process() performing a specific processing action. The template arguments of this class are readers of / writers to signal specialized for given sample formats.

Function Documentation

◆ pipeline()

template<template< typename, typename > class Func, typename... Args>
void Beatmup::Audio::Processing::pipeline ( const AudioSampleFormat  inFormat,
const AudioSampleFormat  outFormat,
const sample8 input,
sample8 output,
Args &&...  args 
)
inline

Definition at line 32 of file processing.h.

32  {
33 
34 #define WRITING(IN_T) \
35  switch (outFormat) { \
36  case Int8: \
37  Func<IN_T, sample8>::process((const IN_T*)input, (sample8*)output, args...); \
38  break; \
39  case Int16: \
40  Func<IN_T, sample16>::process((const IN_T*)input, (sample16*)output, args...); \
41  break; \
42  case Int32: \
43  Func<IN_T, sample32>::process((const IN_T*)input, (sample32*)output, args...); \
44  break; \
45  case Float32: \
46  Func<IN_T, sample32f>::process((const IN_T*)input, (sample32f*)output, args...); \
47  break; \
48  }
49 
50  switch (inFormat) {
51  case Int8:
52  WRITING(sample8);
53  break;
54  case Int16:
55  WRITING(sample16);
56  break;
57  case Int32:
58  WRITING(sample32);
59  break;
60  case Float32:
61  WRITING(sample32f);
62  break;
63  }
64 #undef WRITING
65  }
#define WRITING(IN_T)
@ Int8
signed integer, 8 bit per sample
@ Int32
signed integer, 32 bit per sample
@ Float32
floating point, 32 bit per sample
@ Int16
signed integer, 16 bit per sample