MMDVM/FMDownSampler.h

53 lines
1.4 KiB
C
Raw Permalink Normal View History

2020-04-28 21:37:06 +02:00
/*
* Copyright (C) 2020 by Jonathan Naylor G4KLX
* Copyright (C) 2020 by Geoffrey Merck F4FXL - KC3FRA
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "Config.h"
#if defined(MODE_FM)
2020-04-28 21:37:06 +02:00
#if !defined(FMDOWNSAMPLER_H)
#define FMDOWNSAMPLER_H
2020-05-09 10:57:16 +02:00
#include "RingBuffer.h"
#include "FMSamplePairPack.h"
2020-06-30 13:44:02 +02:00
class CFMDownSampler {
2020-04-28 21:37:06 +02:00
public:
2020-06-30 13:44:02 +02:00
CFMDownSampler(uint16_t length);
2020-04-28 21:37:06 +02:00
void addSample(q15_t sample);
2020-06-30 13:44:02 +02:00
bool getPackedData(TSamplePairPack& data);
2020-06-30 13:44:02 +02:00
2020-05-11 19:01:05 +02:00
uint16_t getData();
2020-06-30 13:44:02 +02:00
2020-05-09 10:57:16 +02:00
void reset();
2020-04-28 21:37:06 +02:00
private:
CRingBuffer<TSamplePairPack> m_ringBuffer;
2020-05-24 07:45:50 +02:00
uint32_t m_samplePack;
uint8_t* m_samplePackPointer;
uint8_t m_sampleIndex;
2020-04-28 21:37:06 +02:00
};
#endif
2020-06-30 13:44:02 +02:00
#endif