Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
I2c_MultiTLVCodec.h
1/*
2 * I2c_MultiTLVCodec.h
3 *
4 * Wrapper for multiple copies of the TLV320AIC310x
5 * codec on the same McASP TDM bus (but with different
6 * I2C addresses). Codec 0 provides the clock signals
7 * via its PLL and the other codecs are clocked to it.
8 *
9 * Created on: August 9, 2019
10 * Author: Andrew McPherson
11 */
12
13#pragma once
14
15#include <vector>
16#include <memory>
17#include "I2c_Codec.h"
18
19class I2c_MultiTLVCodec : public AudioCodec
20{
21public:
22 class TdmConfig {
23 public:
24 TdmConfig(){};
25 unsigned int slotSize = 16;
26 unsigned int bitDelay = 0;
27 unsigned int firstSlot = 0;
28 };
29 int initCodec();
30 int startAudio(int shouldBeReady);
31 int stopAudio();
32 unsigned int getNumIns();
33 unsigned int getNumOuts();
34 float getSampleRate();
35
36 int setInputGain(int channel, float newGain);
37 int setLineOutVolume(int channel, float gain);
38 int setHpVolume(int channel, float gain);
39 int disable();
40 int reset();
41 int setMode(std::string parameter);
42
43 int numDetectedCodecs();
44
45 void debugWriteRegister(int codecNum, int regNum, int value);
46 int debugReadRegister(int codecNum, int regNum);
47 McaspConfig& getMcaspConfig();
48
49 I2c_MultiTLVCodec(I2c_MultiTLVCodec&&) = delete;
50 I2c_MultiTLVCodec(const std::string& cfgString, TdmConfig tdmConfig = TdmConfig(), bool isVerbose = false);
51 ~I2c_MultiTLVCodec();
52
53protected:
54 McaspConfig mcaspConfig;
55 std::shared_ptr<I2c_Codec> primaryCodec; // this will be the same as one of the elements of codecs
56private:
57 std::vector<std::shared_ptr<I2c_Codec>> codecs;
58 std::vector<std::shared_ptr<I2c_Codec>> disabledCodecs;
59
60 bool running;
61 bool verbose;
62};
Definition AudioCodec.h:30
Definition I2c_MultiTLVCodec.h:22
Definition Mcasp.h:33