comparison src/rocklight/rocklight.c @ 12:3da1b8942b8b trunk

[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author nenolod
date Mon, 18 Sep 2006 03:14:20 -0700
parents src/Visualization/rocklight/rocklight.c@13389e613d67
children 78a5e9c37469
comparison
equal deleted inserted replaced
11:cff1d04026ae 12:3da1b8942b8b
1 /***************************************************************************
2 * rocklight.c
3 *
4 * Sun Dec 26 18:26:59 2004
5 * Copyright 2004 Benedikt 'Hunz' Heinz
6 * rocklight@hunz.org
7 * Audacious implementation by Tony Vroon <chainsaw@gentoo.org> in August 2006
8 ****************************************************************************/
9
10 /*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 */
25
26 #include "audacious/plugin.h"
27 #include "thinklight.h"
28
29 static int fd, last, state;
30
31 static void rocklight_init(void) {
32 fd=thinklight_open();
33 }
34
35 static void rocklight_cleanup(void) {
36 thinklight_close(fd);
37 }
38
39 static void rocklight_playback_start(void) {
40 last=state=thinklight_get(fd);
41 }
42
43 static void rocklight_playback_stop(void) {
44 if(last!=state)
45 thinklight_set(fd,state);
46 }
47
48 static void rocklight_render_freq(gint16 data[2][256]) {
49 int new=((data[0][0]+data[1][0])>>7)>=80?1:0;
50
51 if(new!=last) {
52 thinklight_set(fd,new);
53 last=new;
54 }
55 }
56
57 VisPlugin rocklight_vp = {
58 NULL,
59 NULL,
60 0,
61 "RockLight",
62 0,
63 2,
64 rocklight_init,
65 rocklight_cleanup,
66 NULL,
67 NULL,
68 NULL,
69 rocklight_playback_start,
70 rocklight_playback_stop,
71 NULL,
72 rocklight_render_freq
73 };
74
75 VisPlugin *get_vplugin_info(void) {
76 return &rocklight_vp;
77 }