Beatmup
Kernels::RenderAudio< in_t, out_t > Class Template Reference

Static Public Member Functions

static void process (const in_t *whatever, out_t *output, Signal::Reader &ptr, dtime length, const int inCh, const int outCh)
 Renders a continuous audio signal from Signal::Reader. More...
 

Detailed Description

template<typename in_t, typename out_t>
class Kernels::RenderAudio< in_t, out_t >

Definition at line 317 of file signal.cpp.

Member Function Documentation

◆ process()

template<typename in_t , typename out_t >
static void Kernels::RenderAudio< in_t, out_t >::process ( const in_t *  whatever,
out_t *  output,
Signal::Reader ptr,
dtime  length,
const int  inCh,
const int  outCh 
)
inlinestatic

Renders a continuous audio signal from Signal::Reader.

Definition at line 322 of file signal.cpp.

322  {
323  static const out_t _0{ 0 };
324  const int numc = (int)std::min(inCh, outCh);
325  while (length > 0 && ptr.hasData()) {
326  const void* data;
327  int chunk = ptr.acquireBuffer(data);
328  if (chunk > length)
329  chunk = length;
330 
331  const in_t* input = (const in_t*)data;
332  for (int t = 0; t < chunk; ++t, input += inCh, output += outCh) {
333  int c = 0;
334  for (; c < numc; ++c)
335  output[c] = input[c];
336  for (; c < outCh; ++c)
337  output[c] = _0;
338  }
339 
340  ptr.releaseBuffer();
341  ptr.jump(chunk);
342  length -= chunk;
343  }
344 
345  memset(output, 0, length * outCh);
346  }
virtual void releaseBuffer()
Definition: signal.cpp:147
dtime acquireBuffer(const void *&data)
Definition: signal.cpp:159
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Definition: geometry.h:724

The documentation for this class was generated from the following file: