Beatmup
signal_fragment.cpp File Reference
#include "signal_fragment.h"
#include <math.h>

Go to the source code of this file.

Functions

template<typename sample >
void measureMultiplexedChannelDynamics (const sample *startSample, const sample *stopSample, const unsigned char stride, sample &min, sample &max)
 Measures dynamics from samples for a single channel in a multiplexed stream. More...
 

Function Documentation

◆ measureMultiplexedChannelDynamics()

template<typename sample >
void measureMultiplexedChannelDynamics ( const sample *  startSample,
const sample *  stopSample,
const unsigned char  stride,
sample &  min,
sample &  max 
)
inline

Measures dynamics from samples for a single channel in a multiplexed stream.

Parameters
startSamplePointer to the first sample the measurement starts from
stopSamplePointer to the last sample where the measurement stops
strideStep size in samples
minDiscovered minima value; the passed value is not reset
maxDiscovered maxima value; the passed value is not reset

Definition at line 33 of file signal_fragment.cpp.

39  {
40  const sample *in = startSample;
41  sample vMin = *in, vMax = *in;
42  in += stride;
43  while (in < stopSample) {
44  vMin.x = std::min(vMin.x, in->x);
45  vMax.x = std::max(vMax.x, in->x);
46  in += stride;
47  }
48  min.x = std::min(min.x, vMin.x);
49  max.x = std::max(max.x, vMax.x);
50 }
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Definition: geometry.h:724
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Definition: geometry.h:728