quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <Window.h> Window(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, ALIGNMENT alignment = DEF_ALIGNMENT, NORMALIZATION normalization = DEF_NORMALIZATION, float duration = DEF_DURATION); boolean setAlgorithm(ALGORITHM type); boolean setNormalization(NORMALIZATION normalization);
description:Window win(BLACKMAN); VectorFloat input; VectorFloat output; win.setSize(10); input.assign(L"2.0, 3.0, 8.0, 4.0, 2.0, 1.0, 1.0, 3.0, 4.0, 5.0"); win.compute(output, input);
static const String CLASS_NAME = L"Window";
enum ALGORITHM { RECTANGULAR = 0, BLACKMAN, BARTLETT, DOLPH_CHEBYSHEV, GAUSSIAN, HAMMING, HANNING, KAISER, LIFTER, CUSTOM };
enum IMPLEMENTATION { MULTIPLICATION = 0, DEF_IMPLEMENTATION = MULTIPLICATION };
enum ALIGNMENT { CENTER = 0, LEFT, RIGHT, DEF_ALIGNMENT = CENTER };
enum NORMALIZATION { NONE = 0, UNIT_ENERGY, DEF_NORMALIZATION = NONE };
static const NameMap ALGO_MAP(L"RECTANGULAR, BLACKMAN, BARTLETT, DOLPH_CHEBYSHEV, GAUSSIAN, HAMMING, HANNING, KAISER, LIFTER, CUSTOM");
static const NameMap IMPL_MAP(L"MULTIPLICATION");
static const NameMap ALGN_MAP(L"CENTER, LEFT, RIGHT");
static const NameMap NORM_MAP(L"NONE, UNIT_ENERGY");
static const String DEF_PARAM = L"";
static const String PARAM_ALGORITHM = L"algorithm";
static const String PARAM_IMPLEMENTATION = L"implementation";
static const String PARAM_ALIGNMENT = L"alignment";
static const String PARAM_NORMALIZATION = L"normalization";
static const String PARAM_DURATION = L"duration";
static const String PARAM_CONSTANTS = L"constants";
static const String PARAM_DATA = L"data";
static const float DEF_DURATION = 0.025;
static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::SIGNAL;
static const VectorFloat DEF_RECT_CONSTANTS(L"1.0");
static const VectorFloat DEF_BART_CONSTANTS(L"1.0");
static const VectorFloat DEF_BLCK_CONSTANTS(L"1.0, 0.42, 0.50");
static const VectorFloat DEF_DCHB_CONSTANTS(L"1.0, 0.50");
static const VectorFloat DEF_GAUS_CONSTANTS(L"1.0, 0.2618");
static const VectorFloat DEF_HAMM_CONSTANTS(L"0.54");
static const VectorFloat DEF_HANN_CONSTANTS(L"0.50");
static const VectorFloat DEF_KAIS_CONSTANTS(L"1.0, 0.50");
static const VectorFloat DEF_LIFT_CONSTANTS(L"1.0, 22.0, 11.0");
static const long ERR = 72000;
static const long ERR_PRM = 72001;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
ALIGNMENT alignment_d;
NORM normalization_d;
Float window_duration_d;
static MemoryManager mgr_d;
VectorFloat constants_d;
VectorFloat data_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Window();
Window(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, ALIGNMENT alignment = DEF_ALIGNMENT, NORMALIZATION normalization = DEF_NORMALIZATION, float duration = DEF_DURATION);
Window(const Window& arg);
boolean assign(const Window& arg);
Window& operator= (const Window& arg);
long sofSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const Window& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
boolean setAlignment(ALIGNMENT alignment);
boolean setNormalization(NORMALIZATION normalization);
boolean setDuration(float duration);
boolean setSize(long num_points);
boolean setData(const VectorFloat& data);
boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, ALIGNMENT alignment = DEF_ALIGNMENT, NORMALIZATION normalization = DEF_NORMALIZATION, float duration = DEF_DURATION);
boolean setConstants(const VectorFloat& constants);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
ALIGNMENT getAlignment() const;
NORMALIZATION getNormalization() const;
float getDuration() const;
long getSize() const;
const VectorFloat& getData() const;
boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation, ALIGNMENT& alignment, NORMALIZATION& normalization, float& duration);
const VectorFloat& getConstants() const;
boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean compute(VectorComplexFloat& output, const VectorComplexFloat& input, AlgorithmData::COEF_TYPE coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
boolean const String& className() const;
boolean init();
boolean apply(Vector<AlgorithmData>& output, const Vector<AlgorithmData>& input);
long getLeadingPad() const;
long getTrailingPad() const;
boolean setParser(SofParser* parser);
boolean readDataCommon(Sof& sof, const String& pname, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeDataCommon(Sof& sof, const String& pname);
boolean computeCommon(VectorFloat& output, const VectorFloat& input);
boolean computeCommon(VectorComplexFloat& output, const VectorComplexFloat& input);
boolean generateRectangular(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateBartlett(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateBlackman(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateDolphChebyshev(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateGaussian(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateGenralizedHanning(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateKaiser(VectorFloat& output, const VectorFloat& params, long num_points);
boolean generateLifter(VectorFloat& output, const VectorFloat& params, long num_points);
boolean compute(VectorFloat& output_a, const CircularBuffer& input_a, AlgorithmData::COEF_TYPE coef_type_a, long channel_index_a);
// declare a window // Window win; // set window type to be Hamming // win.setAlgorithm(Window::HAMMING); // create an input vector // VectorFloat input; input.assign(L"2.0, 3.0, 2.0, 1.0, 1.0, 8.0, 5.0, 2.0"); // compute the windowed output // VectorFloat output; win.compute(output, input);
// declare a custom window // Window win; win.setAlgorithm(CUSTOM); // set the window to a customized shape // VectorFloat data; data.assign(L"0.0, 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.0"); win.setData(data); // create an input vector // VectorFloat input; input.assign(L"1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0"); // compute the windowed output // VectorFloat output; win.compute(output, input);