Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
BelaContextFifo.h
1 #pragma once
2 
3 #include <array>
4 #include <BelaContextSplitter.h>
5 #include <DataFifo.h>
6 
8 public:
9  typedef enum {
10  kToLong,
11  kToShort,
12  kNumFifos,
13  } fifo_id_t;
14  BelaContextFifo() {};
15  BelaContextFifo(const BelaContext* context, unsigned int factor){
16  setup(context, factor);
17  }
26  BelaContext* setup(const BelaContext* context, unsigned int factor);
33  void push(fifo_id_t fifo, const BelaContext* context);
40  BelaContext* pop(fifo_id_t fifo, double timeoutMs = 100);
41  static constexpr unsigned int kNumBuffers = 2;
42  static bool test();
43 private:
44  unsigned int getCurrentBuffer(fifo_id_t fifo);
45  std::array<std::array<BelaContextSplitter, kNumBuffers>, kNumFifos> bcss;
46  std::array<DataFifo, kNumFifos> dfs;
47  std::array<unsigned int, kNumFifos> counts;
48  unsigned int factor;
49 };
Definition: BelaContextFifo.h:7
Structure holding audio and sensor settings and pointers to I/O data buffers.
Definition: Bela.h:186
BelaContext * setup(const BelaContext *context, unsigned int factor)
void push(fifo_id_t fifo, const BelaContext *context)
BelaContext * pop(fifo_id_t fifo, double timeoutMs=100)