1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2024-09-27 23:36:36 -04:00
xlxd/ambed/cvocodecchannel.h
Geoffrey Merck de961853c7 Add Filtering and defines
Add FIR passband Filtering
Add defines to swithc features on and off
2020-02-03 20:52:14 +01:00

121 lines
3.7 KiB
C++

//
// cvocodecchannel.h
// ambed
//
// Created by Jean-Luc Deltombe (LX3JL) on 23/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
//
// ----------------------------------------------------------------------------
// This file is part of ambed.
//
// xlxd is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// xlxd is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef cvocodecchannel_h
#define cvocodecchannel_h
#include "cpacketqueue.h"
#if USE_AGC == 1
#include "cagc.h"
#endif
#if USE_BANDPASSFILTER == 1
#include "cfirfilter.h"
#endif
#include "cvoicepacket.h"
////////////////////////////////////////////////////////////////////////////////////////
// class
class CVocodecInterface;
class CVocodecChannel
{
public:
// constructors
CVocodecChannel(CVocodecInterface *, int, CVocodecInterface *, int, int);
// destructor
virtual ~CVocodecChannel();
// open & close
bool Open(void);
bool IsOpen(void) const { return m_bOpen; }
void Close(void);
// get
uint8 GetCodecIn(void) const;
uint8 GetCodecOut(void) const;
int GetChannelIn(void) const { return m_iChannelIn; }
int GetChannelOut(void) const { return m_iChannelOut; }
int GetSpeechGain(void) const { return m_iSpeechGain; }
//Processing
#if USE_AGC == 1
void ApplyAGC(CVoicePacket& voicePacket);
#endif
#if USE_BANDPASSFILTER
void ApplyFilter(CVoicePacket& voicePacket);
#endif
// interfaces
bool IsInterfaceIn(const CVocodecInterface *interface) { return (interface == m_InterfaceIn); }
bool IsInterfaceOut(const CVocodecInterface *interface) { return (interface == m_InterfaceOut); }
// queues
CPacketQueue *GetPacketQueueIn(void) { m_QueuePacketIn.Lock(); return &m_QueuePacketIn; }
void ReleasePacketQueueIn(void) { m_QueuePacketIn.Unlock(); }
CPacketQueue *GetPacketQueueOut(void) { m_QueuePacketOut.Lock(); return &m_QueuePacketOut; }
void ReleasePacketQueueOut(void) { m_QueuePacketOut.Unlock(); }
CPacketQueue *GetVoiceQueue(void) { m_QueueVoice.Lock(); return &m_QueueVoice; }
void ReleaseVoiceQueue(void) { m_QueueVoice.Unlock(); }
// operators
//virtual bool operator ==(const CVocodecChannel &) const { return false; }
protected:
// queues helpers
void PurgeAllQueues(void);
protected:
// status
bool m_bOpen;
// connected interfaces
CVocodecInterface *m_InterfaceIn;
int m_iChannelIn;
CVocodecInterface *m_InterfaceOut;
int m_iChannelOut;
// ambe queues
CPacketQueue m_QueuePacketIn;
CPacketQueue m_QueuePacketOut;
// voice queue
CPacketQueue m_QueueVoice;
// settings
int m_iSpeechGain;
private:
#if USE_AGC == 1
CAGC* m_AGC;
#endif
#if USE_BANDPASSFILTER == 1
CFIRFilter* m_filter;
#endif
};
////////////////////////////////////////////////////////////////////////////////////////
#endif /* cvocodecchannel_h */