1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-28 10:48:57 -05:00
sdrangel/wdsp/osctrl.hpp

87 lines
2.6 KiB
C++
Raw Normal View History

2024-06-16 05:31:13 -04:00
/* osctrl.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2014 Warren Pratt, NR0V
Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
The author can be reached by email at
warren@wpratt.com
*/
// This file is part of the implementation of the Overshoot Controller from
// "Controlled Envelope Single Sideband" by David L. Hershberger, W9GR, in
// the November/December 2014 issue of QEX.
#ifndef wdsp_osctrl_h
#define wdsp_osctrl_h
2024-08-07 15:14:09 -04:00
#include <vector>
2024-06-16 05:31:13 -04:00
#include "export.h"
namespace WDSP {
class TXA;
class WDSP_API OSCTRL
{
public:
int run; // 1 to run; 0 otherwise
int size; // buffer size
2024-06-24 21:50:48 -04:00
float *inbuff; // input buffer
float *outbuff; // output buffer
2024-06-16 05:31:13 -04:00
int rate; // sample rate
2024-08-07 15:14:09 -04:00
double osgain; // gain applied to overshoot "clippings"
double bw; // bandwidth
2024-06-16 05:31:13 -04:00
int pn; // "peak stretcher" window, samples
int dl_len; // delay line length, samples
2024-08-07 15:14:09 -04:00
std::vector<double> dl; // delay line for complex samples
std::vector<double> dlenv; // delay line for envelope values
2024-06-16 05:31:13 -04:00
int in_idx; // input index for dl
int out_idx; // output index for dl
2024-08-07 15:14:09 -04:00
double max_env; // maximum env value in env delay line
double env_out;
2024-06-16 05:31:13 -04:00
2024-08-07 15:14:09 -04:00
OSCTRL(
2024-06-16 05:31:13 -04:00
int run,
int size,
2024-06-24 21:50:48 -04:00
float* inbuff,
float* outbuff,
2024-06-16 05:31:13 -04:00
int rate,
2024-08-07 15:14:09 -04:00
double osgain
2024-06-16 05:31:13 -04:00
);
2024-08-07 15:14:09 -04:00
OSCTRL(const OSCTRL&) = delete;
OSCTRL& operator=(const OSCTRL& other) = delete;
~OSCTRL() = default;
void flush();
void execute();
void setBuffers(float* in, float* out);
void setSamplerate(int rate);
void setSize(int size);
2024-06-16 05:31:13 -04:00
private:
2024-08-07 15:14:09 -04:00
void calc();
2024-06-16 05:31:13 -04:00
};
} // namespace WDSP
#endif