add more spacing
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / voicesignature.h
blob5032a4df6f5a1e2dffec9e95e9ddb56badf13088
1 /***************************************************************************
2 * Copyright (C) 2005 by Olivier Goffart *
3 * ogoffart@kde.org *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20 #ifndef SIGNATURE_H
21 #define SIGNATURE_H
24 #include <QVector>
25 #include <QtCore/QMap>
26 #include <kdemacros.h>
27 #include <KConfig>
29 class Sound;
32 #define WINDOW_MINIMUM 0.10
33 #define WINDOW_MINIMUM_ECART 200
34 #define WINDOW_NUMBER 7
35 #define WINDOW_SUPER 0.43
36 #define WINDOW_UNIT sound.fs()/4
37 #define FOUR_NUMBER 7
38 #define FOUR_SUPER 0
41 #define FFT_RANGE_INF 370
42 #define FFT_RANGE_SUP 2000
43 // #define FFT_PONDERATION(f) ((double)log(1+(f))/log(10))
44 #define FFT_PONDERATION(f) 1
47 // theses settings are better in a 8000Hz fs
48 /*#define FFT_RANGE_INF 300
49 #define FFT_RANGE_SUP 1500*/
52 //#define REJECT_FACTOR_ECART_REL 0.5
53 #define REJECT_FACTOR_DIFF 0.0018
57 #define HAMMING false
62 namespace KHotKeys
66 /**
67 @author Olivier Goffart
69 class KDE_EXPORT VoiceSignature{
70 public:
71 explicit VoiceSignature(const Sound& s);
73 VoiceSignature(){}
74 ~VoiceSignature();
76 QMap<int, QMap<int, double> > data;
78 static QMap<int, QMap<int, double> > pond;
80 static float diff(const VoiceSignature &s1, const VoiceSignature &s2);
83 static int size1();
84 static int size2();
87 static QVector<double> fft(const Sound& sound, unsigned int start, unsigned int stop);
88 static bool window(const Sound& sound, unsigned int *start, unsigned int *stop);
90 void write(KConfigGroup& cfg, const QString &key) const;
91 void read(KConfigGroup& cfg, const QString &key);
93 inline bool isNull() const
95 return data.isEmpty();
101 #endif