annotate dsp/phasevocoder/PhaseVocoder.h @ 209:ccd2019190bf msvc

Some MSVC fixes, including (temporarily, probably) renaming the FFT source file to avoid getting it mixed up with the Vamp SDK one in our object dir
author Chris Cannam
date Thu, 01 Feb 2018 16:34:08 +0000
parents a586888bc06c
children 701233f8ed41
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2
cannam@0 3 /*
cannam@0 4 QM DSP Library
cannam@0 5
cannam@0 6 Centre for Digital Music, Queen Mary, University of London.
Chris@115 7 This file 2005-2006 Christian Landone, copyright 2013 QMUL.
Chris@84 8
Chris@84 9 This program is free software; you can redistribute it and/or
Chris@84 10 modify it under the terms of the GNU General Public License as
Chris@84 11 published by the Free Software Foundation; either version 2 of the
Chris@84 12 License, or (at your option) any later version. See the file
Chris@84 13 COPYING included with this distribution for more information.
cannam@0 14 */
cannam@0 15
cannam@0 16 #ifndef PHASEVOCODER_H
cannam@0 17 #define PHASEVOCODER_H
cannam@0 18
cannam@64 19 class FFTReal;
cannam@0 20
cannam@0 21 class PhaseVocoder
cannam@0 22 {
cannam@0 23 public:
Chris@115 24 PhaseVocoder(int size, int hop);
cannam@0 25 virtual ~PhaseVocoder();
cannam@0 26
Chris@115 27 /**
Chris@115 28 * Given one frame of time-domain samples, FFT and return the
Chris@115 29 * magnitudes, instantaneous phases, and unwrapped phases.
Chris@115 30 *
Chris@115 31 * src must have size values (where size is the frame size value
Chris@115 32 * as passed to the PhaseVocoder constructor), and should have
Chris@115 33 * been windowed as necessary by the caller (but not fft-shifted).
Chris@115 34 *
Chris@115 35 * mag, phase, and unwrapped must each be non-NULL and point to
Chris@115 36 * enough space for size/2 + 1 values. The redundant conjugate
Chris@115 37 * half of the output is not returned.
Chris@115 38 */
Chris@119 39 void processTimeDomain(const double *src,
Chris@119 40 double *mag, double *phase, double *unwrapped);
Chris@119 41
Chris@119 42 /**
Chris@119 43 * Given one frame of frequency-domain samples, return the
Chris@119 44 * magnitudes, instantaneous phases, and unwrapped phases.
Chris@119 45 *
Chris@119 46 * reals and imags must each contain size/2+1 values (where size
Chris@119 47 * is the frame size value as passed to the PhaseVocoder
Chris@119 48 * constructor).
Chris@119 49 *
Chris@119 50 * mag, phase, and unwrapped must each be non-NULL and point to
Chris@119 51 * enough space for size/2+1 values.
Chris@119 52 */
Chris@119 53 void processFrequencyDomain(const double *reals, const double *imags,
Chris@119 54 double *mag, double *phase, double *unwrapped);
Chris@115 55
Chris@115 56 /**
Chris@115 57 * Reset the stored phases to zero. Note that this may be
Chris@115 58 * necessary occasionally (depending on the application) to avoid
Chris@115 59 * loss of floating-point precision in the accumulated unwrapped
Chris@115 60 * phase values as they grow.
Chris@115 61 */
Chris@115 62 void reset();
cannam@0 63
cannam@0 64 protected:
Chris@115 65 void FFTShift(double *src);
Chris@115 66 void getMagnitudes(double *mag);
Chris@115 67 void getPhases(double *theta);
Chris@115 68 void unwrapPhases(double *theta, double *unwrapped);
cannam@0 69
Chris@115 70 int m_n;
Chris@115 71 int m_hop;
cannam@64 72 FFTReal *m_fft;
Chris@119 73 double *m_time;
Chris@115 74 double *m_imag;
Chris@115 75 double *m_real;
Chris@115 76 double *m_phase;
Chris@115 77 double *m_unwrapped;
cannam@0 78 };
cannam@0 79
cannam@0 80 #endif