PageRenderTime 23ms CodeModel.GetById 9ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.hpp

http://github.com/xbmc/xbmc
C++ Header | 73 lines | 34 code | 8 blank | 31 comment | 0 complexity | 54f4c6a4d57f11cbb842c014f9587cdc 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 * Beat detection class. Takes decompressed sound buffers and returns
25 * various characteristics
26 *
27 * $Log$
28 *
29 */
30
31#ifndef _BEAT_DETECT_H
32#define _BEAT_DETECT_H
33
34#include "PCM.hpp"
35
36class BeatDetect
37{
38	public:
39		/** Vars */
40		float beat_buffer[32][80],
41		beat_instant[32],
42		beat_history[32];
43		float beat_val[32],
44		beat_att[32],
45		beat_variance[32];
46		int beat_buffer_pos;
47		float vol_buffer[80],
48		vol_instant,
49		vol_history;
50
51		float treb ;
52		float mid ;
53		float bass ;
54		float vol_old ;
55		float beat_sensitivity;
56		float treb_att ;
57		float mid_att ;
58		float bass_att ;
59		float vol;
60
61		PCM *pcm;
62
63		/** Methods */
64		BeatDetect(PCM *pcm);
65		~BeatDetect();
66		void initBeatDetect();
67		void reset();
68		void detectFromSamples();
69		void getBeatVals ( float *vdataL, float *vdataR );
70
71};
72
73#endif /** !_BEAT_DETECT_H */