changeset 1457:bbd5869239e5 trunk

[svn] RockLight visualization plugin ported from XMMS.
author chainsaw
date Wed, 02 Aug 2006 14:26:56 -0700
parents 6fe7ba6e5489
children f12d7e208b43
files ChangeLog Plugins/Visualization/rocklight/Makefile.in Plugins/Visualization/rocklight/rocklight.c Plugins/Visualization/rocklight/thinklight.c Plugins/Visualization/rocklight/thinklight.h configure.ac
diffstat 6 files changed, 200 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 31 17:06:44 2006 -0700
+++ b/ChangeLog	Wed Aug 02 14:26:56 2006 -0700
@@ -1,3 +1,14 @@
+2006-08-01 00:06:44 +0000  George Averill <nhjm449@gmail.com>
+  revision [1826]
+  - Don't poll the config database if not using TCP sockets.
+  
+
+  Changes:        Modified:
+  +4 -0           trunk/audacious/controlsocket.c  
+  +26 -8          trunk/libaudacious/beepctrl.c  
+  +1 -0           trunk/libaudacious/beepctrl.h  
+
+
 2006-07-29 23:23:16 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1824]
   changes link order to avoid linkage with installed library.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Visualization/rocklight/Makefile.in	Wed Aug 02 14:26:56 2006 -0700
@@ -0,0 +1,14 @@
+include ../../../mk/rules.mk
+include ../../../mk/objective.mk
+
+OBJECTIVE_LIBS = librocklight.so
+
+LIBDIR = $(plugindir)/$(VISUALIZATION_PLUGIN_DIR)
+
+LIBADD = $(GTK_LIBS)
+
+SOURCES = rocklight.c thinklight.c
+
+OBJECTS = ${SOURCES:.c=.o}
+
+CFLAGS += -fPIC -DPIC $(GTK_CFLAGS) $(ARCH_DEFINES) -I../../../intl -I../../..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Visualization/rocklight/rocklight.c	Wed Aug 02 14:26:56 2006 -0700
@@ -0,0 +1,77 @@
+/***************************************************************************
+ *            rocklight.c
+ *
+ *  Sun Dec 26 18:26:59 2004
+ *  Copyright  2004  Benedikt 'Hunz' Heinz
+ *  rocklight@hunz.org
+ *  Audacious implementation by Tony Vroon <chainsaw@gentoo.org> in August 2006
+ ****************************************************************************/
+
+/*
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+ 
+#include "audacious/plugin.h"
+#include "thinklight.h"
+
+static int fd, last, state;
+
+static void rocklight_init(void) {
+	fd=thinklight_open();
+}
+
+static void rocklight_cleanup(void) {
+	thinklight_close(fd);
+}
+
+static void rocklight_playback_start(void) {
+	last=state=thinklight_get(fd);
+}
+
+static void rocklight_playback_stop(void) {
+	if(last!=state)
+		thinklight_set(fd,state);
+}
+
+static void rocklight_render_freq(gint16 data[2][256]) {
+	int new=((data[0][0]+data[1][0])>>7)>=80?1:0;
+	
+	if(new!=last) {
+		thinklight_set(fd,new);
+		last=new;
+	}
+}
+
+VisPlugin rocklight_vp = {
+	NULL,
+	NULL,
+	0,  
+	"RockLight",
+	0,
+	2,
+	rocklight_init,
+	rocklight_cleanup,
+	NULL,
+	NULL,
+	NULL,
+	rocklight_playback_start,
+	rocklight_playback_stop,
+	NULL,
+	rocklight_render_freq
+};
+
+VisPlugin *get_vplugin_info(void) {
+	return &rocklight_vp;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Visualization/rocklight/thinklight.c	Wed Aug 02 14:26:56 2006 -0700
@@ -0,0 +1,57 @@
+/***************************************************************************
+ *            thinklight.c
+ *
+ *  Sun Dec 26 17:02:38 2004
+ *  Copyright  2004  Benedikt 'Hunz' Heinz
+ *  rocklight@hunz.org
+ *  $Id: thinklight.c,v 1.2 2005/03/26 21:29:17 hunz Exp $
+ ****************************************************************************/
+
+/*
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+ 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int thinklight_open(void) {
+	return open("/proc/acpi/ibm/light",O_RDWR);
+}
+
+void thinklight_close(int fd) {
+	close(fd);	
+}
+
+int thinklight_set(int fd, int state) {
+	return write(fd,state?"on\n":"off\n",state?3:4);
+}
+
+int thinklight_get(int fd) {
+	char buf[256];
+	int ret=read(fd,&buf,sizeof(buf));
+	
+	if(ret<0)
+		return ret;
+	else if(ret<11)
+		return -23;
+	else if(buf[10]=='f')
+		return 0;
+	else if(buf[10]=='n')
+		return 1;
+	else
+		return -42;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Visualization/rocklight/thinklight.h	Wed Aug 02 14:26:56 2006 -0700
@@ -0,0 +1,34 @@
+/***************************************************************************
+ *            thinklight.h
+ *
+ *  Sun Dec 26 17:01:00 2004
+ *  Copyright  2004  Benedikt 'Hunz' Heinz
+ *  rocklight@hunz.org
+ *  $Id: thinklight.h,v 1.2 2005/03/26 21:29:17 hunz Exp $
+ ****************************************************************************/
+
+/*
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+ 
+#ifndef _THINKLIGHT_H
+#define _THINKLIGHT_H
+
+int thinklight_open(void);
+void thinklight_close(int fd);
+int thinklight_set(int fd, int state);
+int thinklight_get(int fd);
+
+#endif /* _THINKLIGHT_H */
--- a/configure.ac	Mon Jul 31 17:06:44 2006 -0700
+++ b/configure.ac	Wed Aug 02 14:26:56 2006 -0700
@@ -295,6 +295,10 @@
 	INPUT_PLUGINS="$INPUT_PLUGINS mpg123"
 fi
 
+dnl *** ThinkLight support
+
+AC_CHECK_FILE([/proc/acpi/ibm/light], [VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS rocklight"])
+
 dnl *** LIRC client libraries
 
 AC_ARG_ENABLE(lirc,
@@ -996,8 +1000,9 @@
 	Plugins/Input/amidi-plug/backend-alsa/Makefile
 	Plugins/Input/amidi-plug/backend-fluidsynth/Makefile
 	Plugins/Input/amidi-plug/backend-dummy/Makefile
-        Plugins/Visualization/Makefile
-        Plugins/Visualization/blur_scope/Makefile
+	Plugins/Visualization/Makefile
+	Plugins/Visualization/blur_scope/Makefile
+	Plugins/Visualization/rocklight/Makefile
 	Plugins/General/Makefile
 	Plugins/General/song_change/Makefile
 	Plugins/General/lirc/Makefile