/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. #ifndef _BEAT_DETECT_H
  31. #define _BEAT_DETECT_H
  32. #include "PCM.hpp"
  33. class BeatDetect
  34. {
  35. public:
  36. /** Vars */
  37. float beat_buffer[32][80],
  38. beat_instant[32],
  39. beat_history[32];
  40. float beat_val[32],
  41. beat_att[32],
  42. beat_variance[32];
  43. int beat_buffer_pos;
  44. float vol_buffer[80],
  45. vol_instant,
  46. vol_history;
  47. float treb ;
  48. float mid ;
  49. float bass ;
  50. float vol_old ;
  51. float beat_sensitivity;
  52. float treb_att ;
  53. float mid_att ;
  54. float bass_att ;
  55. float vol;
  56. PCM *pcm;
  57. /** Methods */
  58. BeatDetect(PCM *pcm);
  59. ~BeatDetect();
  60. void initBeatDetect();
  61. void reset();
  62. void detectFromSamples();
  63. void getBeatVals ( float *vdataL, float *vdataR );
  64. };
  65. #endif /** !_BEAT_DETECT_H */