Mercurial > audlegacy-plugins
view src/rovascope/beatdetect.c @ 953:ae7e96e44f22 trunk
[svn] Now in sync with AdPlug upstream, merging their commit: "Removed superfluous exit() call. This was detected as part of a GCC 4.3
compilation regression test. Thanks to Martin Michlmayr! Fixes Debian bug
#417078."
author | chainsaw |
---|---|
date | Fri, 13 Apr 2007 09:27:41 -0700 |
parents | 290588854a9d |
children |
line wrap: on
line source
#include "paranormal.h" /* * This algorithm is by Janusz Gregorcyzk, the implementation is * mine, however. * * -- nenolod */ int pn_is_new_beat(void) { gint i; gint total = 0; gboolean ret = FALSE; static gint previous; for (i = 1; i < 512; i++) { total += abs (pn_sound_data->pcm_data[0][i] - pn_sound_data->pcm_data[0][i - 1]); } total /= 512; ret = (total > (2 * previous)); previous = total; return ret; }