Mercurial > audlegacy-plugins
annotate src/paranormal/beatdetect.c @ 611:3f7a52adfe0e trunk
[svn] merge recent changes from yaz's branch.
- stable shoutcast playback.
- tag handling improvement.
- view track detail on streaming won't crash. (disabled.)
- filepopup for streaming is partially supported. filepopup displays track name and stream name, but not updated automatically.
author | yaz |
---|---|
date | Tue, 06 Feb 2007 12:11:42 -0800 |
parents | 65c4d8591b4a |
children | 3b034150d31e |
rev | line source |
---|---|
170
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
1 #include "paranormal.h" |
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
2 |
281 | 3 /* |
4 * This algorithm is by Janusz Gregorcyzk, the implementation is | |
5 * mine, however. | |
6 * | |
7 * -- nenolod | |
8 */ | |
170
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
9 int |
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
10 pn_is_new_beat(void) |
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
11 { |
281 | 12 gint i; |
13 gint total = 0; | |
14 gboolean ret = FALSE; | |
15 static gint previous; | |
170
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
16 |
281 | 17 for (i = 1; i < 512; i++) |
18 { | |
19 total += abs (pn_sound_data->pcm_data[0][i] - | |
20 pn_sound_data->pcm_data[0][i - 1]); | |
21 } | |
22 | |
23 total /= 512; | |
24 | |
25 ret = (total > (2 * previous)); | |
26 | |
27 previous = total; | |
28 | |
29 return ret; | |
170
13955c70fbec
[svn] - split out beat detection code into beatdetect.c
nenolod
parents:
diff
changeset
|
30 } |