mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-23 19:37:25 +00:00
added SSB and WFM demodulator classes
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1553 7ae35d74-ebe9-4afe-98af-79ac388436b8
This commit is contained in:
parent
4d6426101e
commit
9b59a3b711
@ -9,7 +9,7 @@ hamlib_gnuradio_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
# requires libgnuradio, libfftw and c++
|
||||
hamlib_gnuradio_la_LIBADD = $(top_builddir)/src/libhamlib.la @GNURADIO_LIBS@ -lstdc++ -lpthread
|
||||
|
||||
noinst_HEADERS = gnuradio.h gr_priv.h demod.h nfm.h am.h
|
||||
noinst_HEADERS = gnuradio.h gr_priv.h demod.h nfm.h am.h ssb.h wfm.h
|
||||
|
||||
|
||||
check_PROGRAMS = testgr
|
||||
|
83
gnuradio/ssb.h
Normal file
83
gnuradio/ssb.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Hamlib GNUradio backend - SSB class
|
||||
* Copyright (c) 2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: ssb.h,v 1.1 2003-10-01 19:38:34 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SSB_H
|
||||
#define _SSB_H 1
|
||||
|
||||
#include "demod.h"
|
||||
|
||||
#include <GrSSBMod.h> /* SSB */
|
||||
|
||||
|
||||
class USBDemodChainCF : public DemodChainCF {
|
||||
private:
|
||||
GrSSBMod<d_oType> *s_demod;
|
||||
float low_cutoff;
|
||||
|
||||
public:
|
||||
// float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f;
|
||||
USBDemodChainCF (VrSource<d_iType> *src, VrSink<d_oType> *snk, rmode_t mode, pbwidth_t width, int input_rate, freq_t centerfreq = 0, float rf_gain = 1.0) :
|
||||
DemodChainCF(src, snk, mode, width, input_rate, centerfreq, rf_gain) {
|
||||
|
||||
low_cutoff = 300;
|
||||
// centerfreq, relative to IF_center_freq
|
||||
centerfreq += (freq_t)(low_cutoff + width/2);
|
||||
|
||||
s_demod = new GrSSBMod<d_oType>(2*M_PI*(low_cutoff+width/2)/(double)input_rate,rf_gain);
|
||||
|
||||
demod_in = demod_out = s_demod;
|
||||
}
|
||||
~USBDemodChainCF() { delete s_demod; }
|
||||
|
||||
//void setWidth(pbwidth_t width) { } /* TODO */
|
||||
void setFreq(freq_t centerfreq) { s_demod->set_freq(centerfreq); }
|
||||
void setRFgain(float gain) { s_demod->set_gain(gain); }
|
||||
};
|
||||
|
||||
class LSBDemodChainCF : public DemodChainCF {
|
||||
private:
|
||||
GrSSBMod<d_oType> *s_demod;
|
||||
float low_cutoff;
|
||||
|
||||
public:
|
||||
// float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f;
|
||||
LSBDemodChainCF (VrSource<d_iType> *src, VrSink<d_oType> *snk, rmode_t mode, pbwidth_t width, int input_rate, freq_t centerfreq = 0, float rf_gain = 1.0) :
|
||||
DemodChainCF(src, snk, mode, width, input_rate, centerfreq, rf_gain) {
|
||||
|
||||
float low_cutoff = 300;
|
||||
// centerfreq, relative to IF_center_freq
|
||||
centerfreq += (freq_t)(-low_cutoff - width/2);
|
||||
|
||||
s_demod = new GrSSBMod<d_oType>(-2*M_PI*(low_cutoff+width/2)/(double)input_rate,rf_gain);
|
||||
|
||||
demod_in = demod_out = s_demod;
|
||||
}
|
||||
~LSBDemodChainCF() { delete s_demod; }
|
||||
|
||||
//void setWidth(pbwidth_t width) { } /* TODO */
|
||||
void setFreq(freq_t centerfreq) { s_demod->set_freq(centerfreq); }
|
||||
void setRFgain(float gain) { s_demod->set_gain(gain); }
|
||||
};
|
||||
|
||||
|
||||
#endif /* _SSB_H */
|
||||
|
93
gnuradio/wfm.h
Normal file
93
gnuradio/wfm.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Hamlib GNUradio backend - Wide FM class
|
||||
* Copyright (c) 2003 by Stephane Fillod
|
||||
*
|
||||
* $Id: wfm.h,v 1.1 2003-10-01 19:38:34 fillods Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WFM_H
|
||||
#define _WFM_H 1
|
||||
|
||||
#include "demod.h"
|
||||
|
||||
#include <VrQuadratureDemod.h> /* WFM */
|
||||
#include <GrFIRfilterFFF.h>
|
||||
|
||||
|
||||
class WFMDemodChainCF : public DemodChainCF {
|
||||
private:
|
||||
VrQuadratureDemod<d_oType> *q_demod;
|
||||
int RFIRdecimate;
|
||||
GrFIRfilterFFF *audio_filter;
|
||||
|
||||
public:
|
||||
WFMDemodChainCF (VrSource<d_iType> *src, VrSink<d_oType> *snk, rmode_t mode, pbwidth_t width, int input_rate, freq_t centerfreq = 0, float rf_gain = 1.0) :
|
||||
DemodChainCF(src, snk, mode, width, input_rate, centerfreq, rf_gain) {
|
||||
|
||||
CFIRdecimate = 125;
|
||||
RFIRdecimate = 5;
|
||||
|
||||
const int quadRate = input_rate / CFIRdecimate;
|
||||
const int audioRate = quadRate / RFIRdecimate;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Input Sampling Rate: %d\n", input_rate);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Complex FIR decimation factor: %d\n", CFIRdecimate);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "QuadDemod Sampling Rate: %d\n", quadRate);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Real FIR decimation factor: %d\n", RFIRdecimate);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Audio Sampling Rate: %d\n", audioRate);
|
||||
|
||||
|
||||
// build channel filter
|
||||
//
|
||||
// note that the totally bogus transition width is because
|
||||
// we don't have enough mips right now to really do the right thing.
|
||||
// This results in a filter with 83 taps, which is just a few
|
||||
// more than the original 75 in microtune_fm_demo.
|
||||
|
||||
if_width_of_transition_band = 8*100e3;
|
||||
|
||||
// float --> float
|
||||
double width_of_transition_band = audioRate / 32;
|
||||
vector<float> audio_coeffs =
|
||||
gr_firdes::low_pass (rf_gain, // gain
|
||||
quadRate, // sampling rate
|
||||
audioRate/2 - width_of_transition_band, // low-pass cutoff freq
|
||||
width_of_transition_band,
|
||||
gr_firdes::WIN_HAMMING);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Number of audio_coeffs: %d\n", audio_coeffs.size ());
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Low-pass cutoff freq: %d\n", audioRate/2 - (int)width_of_transition_band);
|
||||
|
||||
audio_filter = new GrFIRfilterFFF(RFIRdecimate, audio_coeffs);
|
||||
|
||||
q_demod = new VrQuadratureDemod<d_oType>(rf_gain);
|
||||
|
||||
demod_in = q_demod;
|
||||
demod_out = audio_filter;
|
||||
NWO_CONNECT(demod_in, audio_filter);
|
||||
}
|
||||
|
||||
~WFMDemodChainCF() { delete q_demod; delete audio_filter; }
|
||||
|
||||
|
||||
//void setWidth(pbwidth_t width) { }
|
||||
//void setFreq(freq_t centerfreq) { }
|
||||
void setRFgain(float gain) { q_demod->setGain(gain); }
|
||||
};
|
||||
|
||||
#endif /* _WFM_H */
|
Loading…
Reference in New Issue
Block a user