Here are all the related files.
C++ header
#ifndef DSSS_FIRDES_H
#define DSSS_FIRDES_H
#include
#include
class dsss_firdes {
public:
dsss_firdes();
static std::vector raised_cosine (double gain, double
sampling_freq,
double symbol_rate, double alpha, int ntaps);
};
#endif
C++ Source file -
#include “dsss_firdes.h”
#include
using std::vector;
// Raised Cosine Filter
vector
dsss_firdes::raised_cosine (double gain, double sampling_freq, double
symbol_rate, double alpha, int ntaps)
{
ntaps |= 1; // ensure that ntaps is odd
double spb = sampling_freq/symbol_rate; // samples per bit/symbol
vector taps(ntaps);
double scale = 0;
for(int i=0;i<ntaps;i++)
{
double x1,x2,rc1;
double xindx = i - ntaps/2;
x1 = M_PI * xindx/spb;
x2 = 1-(4alphaalpha*(xindx/spb)*(xindx/spb));
if(i == ntaps/2){
taps[i] = 1;
continue;
}
if(fabs(x2) < 0.000001){ // manage rounding errors. treat 0.000001
as
zero
x2 = 8alpha(xindx/spb)(xindx/spb);
rc1 = sin(x1)sin(alphax1)/x2;
}
else{
rc1 = (sin(x1)cos(alphax1))/(x1x2);
}
taps[i] = rc1;
scale += taps[i];
}
for(int i=0;i<ntaps;i++){
taps[i] = taps[i] * gain / scale;
}
return taps;
}
SWIG interface
** dsss.i **
%include “gnuradio.i”
%{
#include “dsss_firdes.h”
%}
//GR_SWIG_BLOCK_MAGIC(dsss,firdes);
class dsss_firdes
{
public:
static std::vector raised_cosine(double gain, double
sampling_freq,
double symbol_rate, double alpha, int ntaps);
};
include $(top_srcdir)/Makefile.common
C/C++ headers get installed in ${prefix}/include/gnuradio
grinclude_HEADERS = dsss_firdes.h
###################################
SWIG Python interface and library
TOP_SWIG_IFILES = dsss.i
Install so that they end up available as:
import gnuradio.dsss
This ends up at:
${prefix}/lib/python${python_version}/site-packages/gnuradio
dsss_pythondir_category = gnuradio
additional sources for the SWIG-generated library
dsss_la_swig_sources = dsss_firdes.cc
include $(top_srcdir)/Makefile.swig
add some of the variables generated inside the Makefile.swig.gen
BUILT_SOURCES = $(swig_built_sources)
Do not distribute the output of SWIG
no_dist_files = $(swig_built_sources)