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
AudioCodec.h
1 #pragma once
2 #include <stdint.h>
3 #include <string>
4 #include "Mcasp.h"
5 
7  typedef enum {
8  kTdmModeI2s,
9  kTdmModeDsp,
10  kTdmModeTdm,
11  } TdmMode;
12  typedef enum {
13  kClockSourceMcasp,
14  kClockSourceCodec,
15  kClockSourceExternal,
16  } ClockSource;
17  unsigned int slotSize; // size of a slot in bits
18  unsigned int startingSlot; // what slot in the TDM frame to place the first channel in
19  unsigned int bitDelay; // additional offset in the TDM frame (in bits)
20  double mclk; // frequency of the master clock passed to the codec
21  double samplingRate; // audio sampling rate
22  bool dualRate; // whether to run at single or double sampling rate
23  TdmMode tdmMode; // what TDM mode to use
24  ClockSource bclk; // who generates the bit clock
25  ClockSource wclk; // who generates the frame sync
26  void print();
27 };
28 
30 {
31 public:
32  virtual ~AudioCodec() {};
33  virtual int initCodec() = 0;
34  virtual int startAudio(int shouldBeReady) = 0;
35  virtual int stopAudio() = 0;
36  virtual unsigned int getNumIns() = 0;
37  virtual unsigned int getNumOuts() = 0;
38  virtual float getSampleRate() = 0;
39  virtual int setInputGain(int channel, float newGain) = 0;
40  virtual int setLineOutVolume(int channel, float gain) = 0;
41  virtual int setHpVolume(int channel, float gain) = 0;
42  virtual int disable() = 0;
43  virtual int reset() = 0;
44  virtual int setMode(std::string parameter) {return 0;};
45  virtual McaspConfig& getMcaspConfig() = 0;
46 };
Definition: AudioCodec.h:29
Definition: Mcasp.h:32
Definition: AudioCodec.h:6