Use PBD::ffs for portability
[ardour.git] / libs / rubberband / src / AudioCurve.cpp
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-2008 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 #include "AudioCurve.h"
16
17 #include <iostream>
18 using namespace std;
19
20 namespace RubberBand
21 {
22
23 AudioCurve::AudioCurve(size_t sampleRate, size_t windowSize) :
24     m_sampleRate(sampleRate),
25     m_windowSize(windowSize)
26 {
27 }
28
29 AudioCurve::~AudioCurve()
30 {
31 }
32
33 float
34 AudioCurve::processDouble(const double *R__ mag, size_t increment)
35 {
36     cerr << "AudioCurve::processDouble: WARNING: Using inefficient and lossy conversion for AudioCurve::process(float)" << endl;
37     float *tmp = new float[m_windowSize];
38     for (int i = 0; i < int(m_windowSize); ++i) tmp[i] = float(mag[i]);
39     float df = process(tmp, increment);
40     delete[] tmp;
41     return df;
42 }
43
44 }