~ubuntu-branches/debian/lenny/libofa/lenny

« back to all changes in this revision

Viewing changes to lib/signal_op.h

  • Committer: Bazaar Package Importer
  • Author(s): Lukáš Lalinský
  • Date: 2006-08-21 23:06:01 UTC
  • Revision ID: james.westby@ubuntu.com-20060821230601-ik253yugpxbbo9xt
Tags: upstream-0.9.3
Import upstream version 0.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ------------------------------------------------------------------
 
2
 
 
3
   libofa -- the Open Fingerprint Architecture library
 
4
 
 
5
   Copyright (C) 2006 MusicIP Corporation
 
6
   All rights reserved.
 
7
 
 
8
-------------------------------------------------------------------*/
 
9
// FILE: "signal_op.h"
 
10
// MODULE: Class header for Signal_op
 
11
// AUTHOR: Frode Holm
 
12
// DATE CREATED: 1/12/06
 
13
 
 
14
#ifndef __SIGNAL_OP_H
 
15
#define __SIGNAL_OP_H 1
 
16
 
 
17
 
 
18
const int MaxSample = 32767;
 
19
const int MinSample = -32768;
 
20
 
 
21
class Signal_op {
 
22
public:
 
23
        Signal_op();
 
24
        ~Signal_op();
 
25
        void Load(short* samples, long size, int sRate, bool stereo);
 
26
        void CutSignal(double start, double dur);
 
27
        void PrepareStereo(long rate, double silTh);
 
28
        void PrepareMono(long rate, double silTh);
 
29
        void LPlusR();
 
30
        void LMinusR();
 
31
        void RemoveSilence(double startTh, double endTh);
 
32
        void RemoveDCOffset();
 
33
        void Normalize();
 
34
        void ConvertSampleRate(long targetSR);
 
35
        double GetCrossCorrelation();
 
36
        double GetDuration() { return (double) NumBlocks * 1000.0 / (double) Rate; }            // In msec
 
37
        short* GetBuffer() { return Data; }
 
38
        long GetLength() { return NumBlocks; }
 
39
        long GetRate() { return Rate; }
 
40
 
 
41
private:
 
42
        short* Data;            // buffer
 
43
        bool iOwnData;
 
44
        long BufSize;           // Total size of Data in terms of # of data items (short or float)
 
45
        long NumBlocks;         // number of data blocks (= number of sample points)
 
46
        long Rate;                      // Sample rate
 
47
        int NumChannels;        // number of channels
 
48
};
 
49
 
 
50
 
 
51
 
 
52
 
 
53
#endif
 
54
 
 
55