📄 dsp.h
字号:
//License: GNU
//
//
//
// J-QAM sound card modem
//
// Copyright (C) 2007 Jonti Olds
//
//
//
// 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 3 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, see <http://www.gnu.org/licenses/>
//---------------------------------------------------------------------------
#ifndef DSPH
#define DSPH
//---------------------------------------------------------------------------
#include "Constants.h"
#include "Settings.h"
#include <math.h>
//---------------------------------------------------------------------------
__int64 GetMachineCycleCount();
class WaveTable
{
public:
WaveTable(int freq);
~WaveTable();
void __fastcall WTnextFrame();
double __fastcall WTSinValue();
double __fastcall WTSinValue(double PlusFractOfSample);
double __fastcall WTCosValue();
double __fastcall WTCosValue(double PlusFractOfSample);
void __fastcall WTsetFreq(int freq);
void __fastcall SetFreq(double freq);
double GetFreqTest();
void __fastcall Advance(double FractionOfSample){WTptr+=FractionOfSample*WTstep;if(((int)WTptr)>=WTSIZE) WTptr-=WTSIZE;if(((int)WTptr)<0) WTptr+=WTSIZE;}
void __fastcall AdvanceFractionOfWave(double FractionOfWave){WTptr+=FractionOfWave*WTSIZE;if(((int)WTptr)>=WTSIZE) WTptr-=WTSIZE;if(((int)WTptr)<0) WTptr+=WTSIZE;}
void __fastcall Retard(double FractionOfSample){WTptr-=FractionOfSample*WTstep;if(((int)WTptr)>=WTSIZE) WTptr-=WTSIZE;if(((int)WTptr)<0) WTptr+=WTSIZE;}
bool __fastcall IfPassesPointNextTime_frames(double NumberOfFrames);
bool __fastcall IfPassesPointNextTime(double FractionOfWave);
bool __fastcall IfPassesPointNextTime();
double FractionOfSampleItPassesBy;
void __fastcall SetWTptr(double FractionOfWave,double PlusNumberOfFrames);
double WTptr;
double __fastcall DistancebetweenWT(double WTptr1, double WTptr2);
__fastcall WaveTable();
private:
double WTstep;
};
class FIR
{
public:
FIR(int _NumberOfPoints);
~FIR();
double __fastcall FIRUpdateAndProcess(double sig);
void __fastcall FIRUpdate(double sig);
double __fastcall FIRProcess(double FractionOfSampleOffset);
double __fastcall FIRUpdateAndProcess(double sig, double FractionOfSampleOffset);
void __fastcall FIRSetPoint(int point, double value);
double *points;
double *buff;
int NumberOfPoints;
int buffsize;
int ptr;
double outsum;
};
//must be even size
class RootRaisedCosine
{
public:
__fastcall RootRaisedCosine(int NumberOfPoints, double freq, double beta, FIR *Filter);
__fastcall RootRaisedCosine(int NumberOfPoints, double freq, double beta, double *Points);
~RootRaisedCosine();
double delme;
};
class SymbolTimer
{
public:
__fastcall SymbolTimer();
bool FirstFrame;
double FramesPerRightFrame;
double Pos;
int CallsPerSymbol;
int OverSampleCnt;
double Freq;
void __fastcall CaculateNextRightPos();
void __fastcall AdjustByFractionOfCall(double Value);
void __fastcall SetCallsPerSymbol(int Value);
void __fastcall SetFrequency(double Value);
};
class AngleRetriver
{
public:
double vectorlength(PtComplex v);
double Angle(PtComplex a);
double Approxvectorlength(PtComplex v);
double ApproxAngle(PtComplex a);
double ApproxSqrt(double x);
};
class LPFIIR
{
public:
__fastcall LPFIIR(double Fc);
double __fastcall Update(double x);
private:
double a[1];
double b[5];
double y[5];
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -