Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
include
AudioCodec.h
1
#pragma once
2
#include <stdint.h>
3
#include <string>
4
#include "Mcasp.h"
5
6
struct
AudioCodecParams
{
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
29
class
AudioCodec
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
};
AudioCodec
Definition
AudioCodec.h:30
McaspConfig
Definition
Mcasp.h:33
AudioCodecParams
Definition
AudioCodec.h:6
Generated on
for Bela by
1.16.0