Hello,

I'm using this class:

Qt Code:
  1. #ifndef WAVE_H
  2. #define WAVE_H
  3.  
  4. #include <QAudioFormat>
  5. #include <QVector>
  6.  
  7. namespace ffft
  8. {
  9. template <typename T>
  10. class FFTReal;
  11. }
  12.  
  13. class Wave {
  14.  
  15. private:
  16. QVector<unsigned char> buffer;
  17. QAudioFormat format;
  18. int dirtyBegin, dirtyEnd; // dirty = modified with respect to parent
  19. Wave* parent;
  20. QString name;
  21. int disposed;
  22.  
  23. ffft::FFTReal<float>* fftreal;
  24. QList<QVector<float> > fftChunks;
  25.  
  26. // Helper functions for get/set left/right
  27. short getLeftRight (int index, bool left) const;
  28.  
  29.  
  30. void initfft();
  31. QVector<float> do_fft(QVector<float> input);
  32. QVector<float> do_ifft(QVector<float> input);
  33.  
  34. QVector<float> fftChunkLeftRight(int i);
  35. void ifftChunkLeftRight(int i, QVector<float> input);
  36. void setLeftRight (int index, short value, bool left);
  37.  
  38. public:
  39. // Ctor
  40. Wave(QString name, const QVector<unsigned char>& buffer, const QAudioFormat& format);
  41.  
  42. // Copy ctor
  43. explicit Wave(const Wave& wave);
  44.  
  45. // Name
  46. QString getName() const { return name; }
  47. void setName(QString name) { this->name=name; }
  48.  
  49. // High level API
  50. int sampleCount() const;
  51. void stretch(int samples);
  52. int frequency() const;
  53. int channels() const;
  54.  
  55. short getLeft(int index) const { return getLeftRight(index,true); }
  56. short getRight(int index) const { return getLeftRight(index,false); }
  57. void setLeft(int index, short value) { setLeftRight(index,value,true); }
  58. void setRight(int index, short value);
  59.  
  60. // Low level API
  61. const QAudioFormat& getFormat() const { return format; }
  62. const QVector<unsigned char>& getRealBuffer() const { return buffer; }
  63. const QVector<unsigned char>& getBuffer();
  64. void setFormat(const QAudioFormat& format);
  65. void setBuffer(const QVector<unsigned char>& buffer);
  66.  
  67. // FFT operations
  68. static const int fftChunkSize;
  69. int countFftChunks() const { return sampleCount() / fftChunkSize + 1; }
  70.  
  71. QVector<float> fftChunkLeft(int i) { return fftChunkLeftRight(i*2); }
  72. QVector<float> fftChunkRight(int i) { return fftChunkLeftRight(i*2+1); }
  73.  
  74. void ifftChunkLeft(int i, QVector<float> input) { ifftChunkLeftRight(i*2, input); }
  75. void ifftChunkRight(int i, QVector<float> input) { ifftChunkLeftRight(i*2+1, input); }
  76.  
  77. friend class WaveManager;
  78. };
  79.  
  80.  
  81. #endif // WAVE_H
To copy to clipboard, switch view to plain text mode 


I want to use this function "QVector<float> do_fft(QVector<float> input);" but have no idea, where/how to get this input vector of floats. And if someone can explain what represents this input vector. Thanks in advance