1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/***************************************************************************
PitchShiftFilter.h - filter for modifying the "pitch_shift"
-------------------
begin : Wed Nov 28 2007
copyright : (C) 2007 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
based on synth_pitch_shift_impl.cc from the aRts project
copyright (C) 2000 Jeff Tranter <tranter@pobox.com>
(C) 1999 Stefan Westerfeld <stefan@space.twc.de>
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef PITCH_SHIFT_FILTER_H
#define PITCH_SHIFT_FILTER_H
#include "config.h"
#include <QObject>
#include <QVariant>
#include <QVector>
#include "libkwave/SampleArray.h"
#include "libkwave/SampleSource.h"
namespace Kwave
{
class PitchShiftFilter: public Kwave::SampleSource
{
Q_OBJECT
public:
/** Constructor */
PitchShiftFilter();
/** Destructor */
~PitchShiftFilter() override;
/** does the calculation */
void goOn() override;
signals:
/** emits a block with the filtered data */
void output(Kwave::SampleArray data);
public slots:
/** receives input data */
void input(Kwave::SampleArray data);
/**
* Sets the speed factor
* @param speed factor as a double
*/
void setSpeed(const QVariant speed);
/**
* Sets the frequency parameter
* @param freq the normed frequency
*/
void setFrequency(const QVariant freq);
private:
/** reset/initialize the filter and buffer */
void initFilter();
private:
/** buffer for input */
Kwave::SampleArray m_buffer;
/** speed factor */
float m_speed;
/** base frequency */
float m_frequency;
enum { MAXDELAY = 1000000 };
QVector<float> m_dbuffer;
float m_lfopos;
float m_b1pos;
float m_b2pos;
float m_b1inc;
float m_b2inc;
bool m_b1reset;
bool m_b2reset;
int m_dbpos;
};
}
#endif /* PITCH_SHIFT_FILTER_H */
//***************************************************************************
//***************************************************************************
|