svcore  1.9
FFTFuzzyAdapter.cpp
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #include "FFTFuzzyAdapter.h"
17 
18 #include <cassert>
19 
21  int channel,
22  WindowType windowType,
23  int windowSize,
24  int windowIncrement,
25  int fftSize,
26  bool polar,
27  int fillFromColumn) :
28  m_server(0),
29  m_xshift(0),
30  m_yshift(0)
31 {
33  channel,
34  windowType,
35  windowSize,
36  windowIncrement,
37  fftSize,
38  polar,
39  fillFromColumn);
40 
41  int xratio = windowIncrement / m_server->getWindowIncrement();
42  int yratio = m_server->getFFTSize() / fftSize;
43 
44  while (xratio > 1) {
45  if (xratio & 0x1) {
46  cerr << "ERROR: FFTFuzzyAdapter: Window increment ratio "
47  << windowIncrement << " / "
49  << " must be a power of two" << endl;
50  assert(!(xratio & 0x1));
51  }
52  ++m_xshift;
53  xratio >>= 1;
54  }
55 
56  while (yratio > 1) {
57  if (yratio & 0x1) {
58  cerr << "ERROR: FFTFuzzyAdapter: FFT size ratio "
59  << m_server->getFFTSize() << " / " << fftSize
60  << " must be a power of two" << endl;
61  assert(!(yratio & 0x1));
62  }
63  ++m_yshift;
64  yratio >>= 1;
65  }
66 }
67 
69 {
71 }
72 
FFTDataServer * m_server
WindowType
Definition: Window.h:27
int getWindowIncrement() const
Definition: FFTDataServer.h:74
static void releaseInstance(FFTDataServer *)
int getFFTSize() const
Definition: FFTDataServer.h:75
Base class for models containing dense two-dimensional data (value against time).
FFTFuzzyAdapter(const DenseTimeValueModel *model, int channel, WindowType windowType, int windowSize, int windowIncrement, int fftSize, bool polar, int fillFromColumn=0)
static FFTDataServer * getFuzzyInstance(const DenseTimeValueModel *model, int channel, WindowType windowType, int windowSize, int windowIncrement, int fftSize, bool polar, StorageAdviser::Criteria criteria=StorageAdviser::NoCriteria, int fillFromColumn=0)