PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/visualizations/XBMCProjectM/libprojectM/PCM.hpp

http://github.com/xbmc/xbmc
C++ Header | 68 lines | 29 code | 10 blank | 29 comment | 0 complexity | 36ba1d5c48339201ba0e5fb10a38cc25 MD5 | raw file
 1/**
 2 * projectM -- Milkdrop-esque visualisation SDK
 3 * Copyright (C)2003-2007 projectM Team
 4 *
 5 * This library is free software; you can redistribute it and/or
 6 * modify it under the terms of the GNU Lesser General Public
 7 * License as published by the Free Software Foundation; either
 8 * version 2.1 of the License, or (at your option) any later version.
 9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 * See 'LICENSE.txt' included within this release
19 *
20 */
21/**
22 * $Id$
23 *
24 * Encapsulation of raw sound buffer. Used in beat detection
25 *
26 * $Log$
27 */
28
29#ifndef _PCM_H
30#define _PCM_H
31
32class PCM {
33public:
34    mutable float **PCMd;
35    mutable int start;
36
37    /** Use wave smoothing */
38    float waveSmoothing;
39
40    int *ip;
41    double *w;
42    mutable int newsamples;
43
44    mutable int numsamples; //size of new PCM info
45    float *pcmdataL;     //holder for most recent pcm data 
46    float *pcmdataR;     //holder for most recent pcm data 
47
48    /** PCM data */
49    mutable float vdataL[512];  //holders for FFT data (spectrum)
50    mutable float vdataR[512];
51
52    static int maxsamples;
53    PCM();
54    ~PCM();
55    void initPCM(int maxsamples);
56    void addPCMfloat(const float *PCMdata, int samples) const;
57    void addPCM16(short [2][512]) const;
58    void addPCM16Data(const short* pcm_data, short samples) const;
59    void addPCM8( unsigned char [2][1024]) const;
60	void addPCM8_512( const unsigned char [2][512]) const;
61    void getPCM(float *data, int samples, int channel, int freq, float smoothing, int derive) const;
62    void freePCM();
63    int getPCMnew(float *PCMdata, int channel, int freq, float smoothing, int derive,int reset) const;
64    
65
66  };
67
68#endif /** !_PCM_H */