annotate dsp/phasevocoder/PhaseVocoder.h @ 483:fdaa63607c15

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