Add ambed source files

This commit is contained in:
2026-11-27 01:11:26 +01:00
parent a04d6c7e6f
commit 26e639e0ad
131 changed files with 25531 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
//
// cxombeinterface.h
// ambed
//
// Software vocoder interface powered by xombe (AMBE+ / AMBE2+)
//
#ifndef cxombeinterface_h
#define cxombeinterface_h
#include "cvocodecinterface.h"
#include "xombe.h"
////////////////////////////////////////////////////////////////////////////////////////
// class
class CXombeInterface : public CVocodecInterface
{
public:
// constructor: iIndex = thread/instance ID, iNbPairs = bidirectional channel pairs
CXombeInterface(int iIndex, int iNbPairs);
// destructor
virtual ~CXombeInterface();
// initialization
bool Init(void) override;
// get
const char *GetName(void) const override { return m_szName; }
const char *GetSerial(void) const override { return m_szSerial; }
// manage channels
int GetNbChannels(void) const override { return m_iNbPairs * 2; }
uint8 GetChannelCodec(int iCh) const override;
CVocodecChannel *GetChannelWithChannelIn(int iCh) override;
CVocodecChannel *GetChannelWithChannelOut(int iCh) override;
// task
void Task(void) override;
// operators
bool operator ==(const CVocodecInterface &other) const override { return (this == &other); }
protected:
// per-channel xombe state (allocated once, reset on channel open)
struct XombeSlot
{
bool wasOpen;
xombe_xc_shared_mem xcMem;
xombe_xc *xc;
xombe_dec_mem decMem;
xombe_dec *dec;
xombe_enc_mem encMem;
xombe_enc *enc;
XombeSlot() : wasOpen(false), xc(NULL), dec(NULL), enc(NULL) {}
};
void ResetSlot(XombeSlot &slot, uint8 uiCodecIn, uint8 uiCodecOut);
void ProcessChannel(size_t idx);
protected:
int m_iIndex;
int m_iNbPairs;
char m_szName[32];
char m_szSerial[32];
// shared quantizer workspace for all xombe_xc instances on this thread
xombe_qws_mem m_QwsMem;
std::vector<XombeSlot> m_Slots;
};
////////////////////////////////////////////////////////////////////////////////////////
#endif /* cxombeinterface_h */