Merge branch 'master' into cairocanvas
[ardour.git] / libs / rubberband / rubberband / TimeStretcher.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     Rubber Band
5     An audio time-stretching and pitch-shifting library.
6     Copyright 2007 Chris Cannam.
7     
8     This program is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License as
10     published by the Free Software Foundation; either version 2 of the
11     License, or (at your option) any later version.  See the file
12     COPYING included with this distribution for more information.
13 */
14
15 #ifndef _RUBBERBAND_TIMESTRETCHER_H_
16 #define _RUBBERBAND_TIMESTRETCHER_H_
17
18 #include <sys/types.h>
19
20 namespace RubberBand
21 {
22
23 /**
24  * Base class for time stretchers.  RubberBand currently provides only
25  * a single subclass implementation.
26  *
27  * @see RubberBandStretcher
28  */
29 class TimeStretcher
30 {
31 public:
32     TimeStretcher(size_t sampleRate, size_t channels) :
33         m_sampleRate(sampleRate),
34         m_channels(channels)
35     { }
36     virtual ~TimeStretcher()
37     { }
38
39     virtual void reset() = 0;
40     virtual void setTimeRatio(double ratio) = 0;
41     virtual void setPitchScale(double scale) = 0;
42     virtual size_t getLatency() const = 0;
43
44     virtual void study(const float *const *input, size_t samples, bool final) = 0;
45     virtual size_t getSamplesRequired() const = 0;
46     virtual void process(const float *const *input, size_t samples, bool final) = 0;
47     virtual int available() const = 0;
48     virtual size_t retrieve(float *const *output, size_t samples) const = 0;
49
50 protected:
51     size_t m_sampleRate;
52     size_t m_channels;
53 };
54
55 }
56
57 #endif
58