Mercurial > audlegacy-plugins
changeset 1936:a55b1c903628
branch merge
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 01 Oct 2007 15:35:02 -0500 |
parents | c276e2b74646 (current diff) c62011e48c61 (diff) |
children | ac07c60dba5d |
files | src/projectm-1.0/COPYING src/projectm-1.0/main.cxx src/projectm-1.0/sdltoprojectM.h src/projectm-1.0/video_init.cxx src/projectm-1.0/video_init.h |
diffstat | 23 files changed, 1644 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/buildsys.mk.in Mon Oct 01 15:34:40 2007 -0500 +++ b/buildsys.mk.in Mon Oct 01 15:35:02 2007 -0500 @@ -35,6 +35,8 @@ OBJCFLAGS = @OBJCFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +PROG_IMPLIB_NEEDED = @PROG_IMPLIB_NEEDED@ +PROG_IMPLIB_LDFLAGS = @PROG_IMPLIB_LDFLAGS@ PROG_SUFFIX = @EXEEXT@ LIB_CPPFLAGS = @LIB_CPPFLAGS@ LIB_CFLAGS = @LIB_CFLAGS@ @@ -73,7 +75,7 @@ .SILENT: .SUFFIXES: .beam .c .cc .cxx .d .erl .m -.PHONY: all subdirs depend install uninstall clean distclean +.PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean all: for i in subdirs depend ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST}; do \ @@ -93,7 +95,6 @@ if test x"$$regen" = x"1"; then \ list=""; \ ${DEPEND_STATUS}; \ - rm -f .deps; \ for i in ${SRCS}; do \ case $${i##*.} in \ c|cc|cxx|m) \ @@ -101,10 +102,13 @@ ;; \ esac; \ done; \ - if ${CPP} ${CPPFLAGS} ${CFLAGS} -M $$list >.deps; then \ - ${DEPEND_OK}; \ - else \ - ${DEPEND_FAILED}; \ + if test x"$$list" != "x"; then \ + if ${CPP} ${CPPFLAGS} -M $$list >.deps; then \ + ${DEPEND_OK}; \ + else \ + rm -f .deps; \ + ${DEPEND_FAILED}; \ + fi; \ fi; \ fi @@ -208,7 +212,7 @@ for i in ${STATIC_LIB}; do \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i; then \ + if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \
--- a/configure.ac Mon Oct 01 15:34:40 2007 -0500 +++ b/configure.ac Mon Oct 01 15:35:02 2007 -0500 @@ -22,6 +22,11 @@ CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" fi +dnl append audacious header path to CPPFLAGS when --prefix is specified. +if test "$prefix" != "NONE" ; then + CPPFLAGS="$CPPFLAGS -I${includedir}" +fi + dnl OMK bootstrap AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME]) AC_SUBST([VERSION], [AC_PACKAGE_VERSION]) @@ -185,6 +190,8 @@ dnl ======================== BUILDSYS_SHARED_LIB +BUILDSYS_PROG_IMPLIB +test x"$PROG_IMPLIB_NEEDED" = x"yes" && LIBS="$LIBS -L\${libdir} -laudacious.exe" dnl Ok, first we find out what flags we need to use. AC_MSG_CHECKING([for what extension and flags to use for plugin compilation]) @@ -1364,7 +1371,7 @@ CONTAINER_PLUGINS="$CONTAINER_PLUGINS xspf" fi -dnl *** ProjectM (GL Milkdrop port) +dnl *** projectM (GL Milkdrop port) AC_ARG_ENABLE(projectm, [ --disable-projectm disable projectM vis plugin. (default=enabled)], @@ -1372,7 +1379,7 @@ [have_projectm=yes]) if test "$have_projectm" = "yes"; then - PKG_CHECK_MODULES(LIBPROJECTM, libprojectM >= 0.0.0, [have_projectm="yes"], [have_projectm="no"]) + PKG_CHECK_MODULES(LIBPROJECTM, libprojectM < 1.0, [have_projectm="yes"], [have_projectm="no"]) AM_PATH_SDL(1.2.5, , [ AC_MSG_WARN([*** SDL is not installed. projectM will not be built. ***]) have_projectm="no" @@ -1380,7 +1387,7 @@ if test x$libprjM = xno; then AC_MSG_WARN([*** libprojectM not found. libprojectM is needed to build this package. - You can download libprojectM at http://xmms-projectM.sf.net/]) + You can download libprojectM at http://projectm.sf.net/]) fi LIBPROJECTM_datadir=`pkg-config --variable=pkgdatadir libprojectM`; LIBPROJECTM_sysconfdir=`pkg-config --variable=sysconfdir libprojectM`; @@ -1393,6 +1400,36 @@ VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS projectm" fi +dnl *** projectM (GL Milkdrop port) + +AC_ARG_ENABLE(projectm-1.0, +[ --disable-projectm-1.0 disable projectM 1.0+ vis plugin. (default=enabled)], +[have_projectm1=$enableval], +[have_projectm1=yes]) + +if test "$have_projectm1" = "yes"; then + PKG_CHECK_MODULES(LIBPROJECTM1, libprojectM >= 1.0, [have_projectm1="yes"], [have_projectm1="no"]) + AM_PATH_SDL(1.2.5, , [ + AC_MSG_WARN([*** SDL is not installed. projectM will not be built. ***]) + have_projectm1="no" + ]) + if test x$libprjM = xno; then + AC_MSG_WARN([*** libprojectM not found. + libprojectM is needed to build this package. + You can download libprojectM at http://projectm.sf.net/]) + fi + LIBPROJECTM1_datadir=`pkg-config --variable=pkgdatadir libprojectM`; + LIBPROJECTM1_sysconfdir=`pkg-config --variable=sysconfdir libprojectM`; + LIBPROJECTM1_prefix=`pkg-config --variable=prefix libprojectM`; + LIBPROJECTM1_CFLAGS="$LIBPROJECTM1_CFLAGS -DPROJECTM_DATADIR=\\\"$LIBPROJECTM1_datadir\\\" -DPROJECTM_SYSCONFDIR=\\\"$LIBPROJECTM1_sysconfdir\\\" -DPROJECTM_PREFIX=\\\"$LIBPROJECTM1_prefix\\\""; +fi +AC_SUBST(LIBPROJECTM1_LIBS) +AC_SUBST(LIBPROJECTM1_CFLAGS) + +if test "$have_projectm1" = "yes"; then + VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS projectm-1.0" +fi + dnl *** TTA AC_ARG_ENABLE(tta, @@ -1625,7 +1662,8 @@ echo " Blur Scope: yes" echo " Spectrum Analyzer: yes" echo " Paranormal Visualization Library: $have_paranormal" -echo " ProjectM (GL milkdrop): $have_projectm" +echo " projectM 0.x (GL milkdrop): $have_projectm" +echo " projectM 1.x (GL milkdrop): $have_projectm1" echo " RootVis plugin: $have_rootvis" echo echo " Transport"
--- a/extra.mk.in Mon Oct 01 15:34:40 2007 -0500 +++ b/extra.mk.in Mon Oct 01 15:35:02 2007 -0500 @@ -357,6 +357,8 @@ XXF86VM_LIBS ?= @XXF86VM_LIBS@ LIBPROJECTM_CFLAGS ?= @LIBPROJECTM_CFLAGS@ LIBPROJECTM_LIBS ?= @LIBPROJECTM_LIBS@ +LIBPROJECTM1_CFLAGS ?= @LIBPROJECTM1_CFLAGS@ +LIBPROJECTM1_LIBS ?= @LIBPROJECTM1_LIBS@ MMS_CFLAGS ?= @MMS_CFLAGS@ MMS_LIBS ?= @MMS_LIBS@ MAD_CFLAGS ?= @MAD_CFLAGS@
--- a/m4/buildsys.m4 Mon Oct 01 15:34:40 2007 -0500 +++ b/m4/buildsys.m4 Mon Oct 01 15:35:02 2007 -0500 @@ -18,6 +18,25 @@ dnl POSSIBILITY OF SUCH DAMAGE. dnl +AC_DEFUN([BUILDSYS_PROG_IMPLIB], [ + AC_MSG_CHECKING(wether we need an implib) + case "$target" in + *-*-cygwin | *-*-mingw32) + AC_MSG_RESULT(yes) + PROG_IMPLIB_NEEDED='yes' + PROG_IMPLIB_LDFLAGS='-Wl,-export-all-symbols,--out-implib,lib${PROG}.a' + ;; + *) + AC_MSG_RESULT(no) + PROG_IMPLIB_NEEDED='no' + PROG_IMPLIB_LDFLAGS='' + ;; + esac + + AC_SUBST(PROG_IMPLIB_NEEDED) + AC_SUBST(PROG_IMPLIB_LDFLAGS) +]) + AC_DEFUN([BUILDSYS_SHARED_LIB], [ AC_MSG_CHECKING(for shared library system) case "$target" in
--- a/mk/rules.mk.in Mon Oct 01 15:34:40 2007 -0500 +++ b/mk/rules.mk.in Mon Oct 01 15:35:02 2007 -0500 @@ -357,6 +357,8 @@ XXF86VM_LIBS ?= @XXF86VM_LIBS@ LIBPROJECTM_CFLAGS ?= @LIBPROJECTM_CFLAGS@ LIBPROJECTM_LIBS ?= @LIBPROJECTM_LIBS@ +LIBPROJECTM1_CFLAGS ?= @LIBPROJECTM1_CFLAGS@ +LIBPROJECTM1_LIBS ?= @LIBPROJECTM1_LIBS@ MMS_CFLAGS ?= @MMS_CFLAGS@ MMS_LIBS ?= @MMS_LIBS@ MAD_CFLAGS ?= @MAD_CFLAGS@
--- a/src/alsa/audio.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/alsa/audio.c Mon Oct 01 15:35:02 2007 -0500 @@ -158,7 +158,8 @@ */ switch (err) { - case -ESTRPIPE: /* "suspend": wait until ALSA is "running" again. */ + case -ESTRPIPE: + case ESTRPIPE: /* "suspend": wait until ALSA is "running" again. */ while ((err2 = snd_pcm_resume(alsa_pcm)) == -EAGAIN) g_usleep(100000); @@ -167,10 +168,15 @@ break; - case -EPIPE: /* under-run and the I/O pipe closed on us */ + case -EPIPE: + case EPIPE: /* under-run and the I/O pipe closed on us */ return snd_pcm_prepare(alsa_pcm); break; + case EINTR: + case -EINTR: + break; + default: g_warning("Unhandled ALSA exception code %d (%s), trying hard restart.", err, snd_strerror(err)); return snd_pcm_prepare(alsa_pcm); @@ -701,7 +707,7 @@ alsa_recovery(wr); } } - else + else /* XXX: why is this here? --nenolod */ g_usleep(10000); if (pause_request != paused)
--- a/src/cdaudio-ng/Makefile Mon Oct 01 15:34:40 2007 -0500 +++ b/src/cdaudio-ng/Makefile Mon Oct 01 15:35:02 2007 -0500 @@ -7,6 +7,6 @@ include ../../buildsys.mk include ../../extra.mk -CPPFLAGS = ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${CDIO_CFLAGS} ${CDDB_CFLAGS} -I../.. ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${ARCH_DEFINES} +CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${CDIO_CFLAGS} ${CDDB_CFLAGS} -I../.. ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${ARCH_DEFINES} CFLAGS += ${PLUGIN_CFLAGS} LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${CDIO_LIBS} ${CDDB_LIBS}
--- a/src/filewriter/vorbis.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/filewriter/vorbis.c Mon Oct 01 15:35:02 2007 -0500 @@ -20,6 +20,9 @@ */ #include "plugins.h" + +#ifdef FILEWRITER_VORBIS + #include <vorbis/vorbisenc.h> #include <stdlib.h> @@ -310,3 +313,5 @@ gtk_widget_show_all(configure_win); } + +#endif
--- a/src/lirc/about.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/lirc/about.c Mon Oct 01 15:35:02 2007 -0500 @@ -23,9 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include <glib.h> #include <audacious/i18n.h>
--- a/src/lirc/lirc.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/lirc/lirc.c Mon Oct 01 15:35:02 2007 -0500 @@ -24,9 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include <stdio.h> #include <unistd.h>
--- a/src/madplug/Makefile Mon Oct 01 15:34:40 2007 -0500 +++ b/src/madplug/Makefile Mon Oct 01 15:35:02 2007 -0500 @@ -13,6 +13,6 @@ include ../../buildsys.mk include ../../extra.mk -CPPFLAGS += ${PLUGIN_CPPFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${MOWGLI_CFLAGS} ${ARCH_DEFINES} -I../.. -CFLAGS += ${PLUGIN_CFLAGS} ${SIMD_CFLAGS} +CPPFLAGS += ${PLUGIN_CPPFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${MOWGLI_CFLAGS} ${ARCH_DEFINES} ${SIMD_CFLAGS} -I../.. +CFLAGS += ${PLUGIN_CFLAGS} LIBS += -L${libdir} -laudid3tag -lmad ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS}
--- a/src/neon/neon.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/neon/neon.c Mon Oct 01 15:35:02 2007 -0500 @@ -531,7 +531,10 @@ _ENTER; db = bmp_cfg_db_open(); - bmp_cfg_db_get_bool(db, NULL, "use_proxy", &use_proxy); + if (FALSE == bmp_cfg_db_get_bool(db, NULL, "use_proxy", &use_proxy)) { + use_proxy = FALSE; + } + if (use_proxy) { if (FALSE == bmp_cfg_db_get_string(db, NULL, "proxy_host", &proxy_host)) { _ERROR("Could not read proxy host, disabling proxy use");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/COPYING Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/ConfigFile.cxx Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,142 @@ +// ConfigFile.cpp + +#include "ConfigFile.h" + +using std::string; + +ConfigFile::ConfigFile( string filename, string delimiter, + string comment, string sentry ) + : myDelimiter(delimiter), myComment(comment), mySentry(sentry) +{ + // Construct a ConfigFile, getting keys and values from given file + + std::ifstream in( filename.c_str() ); + + if( !in ) throw file_not_found( filename ); + + in >> (*this); +} + + +ConfigFile::ConfigFile() + : myDelimiter( string(1,'=') ), myComment( string(1,'#') ) +{ + // Construct a ConfigFile without a file; empty +} + + +void ConfigFile::remove( const string& key ) +{ + // Remove key and its value + myContents.erase( myContents.find( key ) ); + return; +} + + +bool ConfigFile::keyExists( const string& key ) const +{ + // Indicate whether key is found + mapci p = myContents.find( key ); + return ( p != myContents.end() ); +} + + +/* static */ +void ConfigFile::trim( string& s ) +{ + // Remove leading and trailing whitespace + static const char whitespace[] = " \n\t\v\r\f"; + s.erase( 0, s.find_first_not_of(whitespace) ); + s.erase( s.find_last_not_of(whitespace) + 1U ); +} + + +std::ostream& operator<<( std::ostream& os, const ConfigFile& cf ) +{ + // Save a ConfigFile to os + for( ConfigFile::mapci p = cf.myContents.begin(); + p != cf.myContents.end(); + ++p ) + { + os << p->first << " " << cf.myDelimiter << " "; + os << p->second << std::endl; + } + return os; +} + + +std::istream& operator>>( std::istream& is, ConfigFile& cf ) +{ + // Load a ConfigFile from is + // Read in keys and values, keeping internal whitespace + typedef string::size_type pos; + const string& delim = cf.myDelimiter; // separator + const string& comm = cf.myComment; // comment + const string& sentry = cf.mySentry; // end of file sentry + const pos skip = delim.length(); // length of separator + + string nextline = ""; // might need to read ahead to see where value ends + + while( is || nextline.length() > 0 ) + { + // Read an entire line at a time + string line; + if( nextline.length() > 0 ) + { + line = nextline; // we read ahead; use it now + nextline = ""; + } + else + { + std::getline( is, line ); + } + + // Ignore comments + line = line.substr( 0, line.find(comm) ); + + // Check for end of file sentry + if( sentry != "" && line.find(sentry) != string::npos ) return is; + + // Parse the line if it contains a delimiter + pos delimPos = line.find( delim ); + if( delimPos < string::npos ) + { + // Extract the key + string key = line.substr( 0, delimPos ); + line.replace( 0, delimPos+skip, "" ); + + // See if value continues on the next line + // Stop at blank line, next line with a key, end of stream, + // or end of file sentry + bool terminate = false; + while( !terminate && is ) + { + std::getline( is, nextline ); + terminate = true; + + string nlcopy = nextline; + ConfigFile::trim(nlcopy); + if( nlcopy == "" ) continue; + + nextline = nextline.substr( 0, nextline.find(comm) ); + if( nextline.find(delim) != string::npos ) + continue; + if( sentry != "" && nextline.find(sentry) != string::npos ) + continue; + + nlcopy = nextline; + ConfigFile::trim(nlcopy); + if( nlcopy != "" ) line += "\n"; + line += nextline; + terminate = false; + } + + // Store key and value + ConfigFile::trim(key); + ConfigFile::trim(line); + cf.myContents[key] = line; // overwrites if key is repeated + } + } + + return is; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/ConfigFile.h Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,253 @@ +// ConfigFile.h +// Class for reading named values from configuration files +// Richard J. Wagner v2.1 24 May 2004 wagnerr@umich.edu + +// Copyright (c) 2004 Richard J. Wagner +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +// Typical usage +// ------------- +// +// Given a configuration file "settings.inp": +// atoms = 25 +// length = 8.0 # nanometers +// name = Reece Surcher +// +// Named values are read in various ways, with or without default values: +// ConfigFile config( "settings.inp" ); +// int atoms = config.read<int>( "atoms" ); +// double length = config.read( "length", 10.0 ); +// string author, title; +// config.readInto( author, "name" ); +// config.readInto( title, "title", string("Untitled") ); +// +// See file example.cpp for more examples. + +#ifndef CONFIGFILE_H +#define CONFIGFILE_H + +#include <string> +#include <map> +#include <iostream> +#include <fstream> +#include <sstream> + +using std::string; + +class ConfigFile { +// Data +protected: + string myDelimiter; // separator between key and value + string myComment; // separator between value and comments + string mySentry; // optional string to signal end of file + std::map<string,string> myContents; // extracted keys and values + + typedef std::map<string,string>::iterator mapi; + typedef std::map<string,string>::const_iterator mapci; + +// Methods +public: + ConfigFile( string filename, + string delimiter = "=", + string comment = "#", + string sentry = "EndConfigFile" ); + ConfigFile(); + + // Search for key and read value or optional default value + template<class T> T read( const string& key ) const; // call as read<T> + template<class T> T read( const string& key, const T& value ) const; + template<class T> bool readInto( T& var, const string& key ) const; + template<class T> + bool readInto( T& var, const string& key, const T& value ) const; + + // Modify keys and values + template<class T> void add( string key, const T& value ); + void remove( const string& key ); + + // Check whether key exists in configuration + bool keyExists( const string& key ) const; + + // Check or change configuration syntax + string getDelimiter() const { return myDelimiter; } + string getComment() const { return myComment; } + string getSentry() const { return mySentry; } + string setDelimiter( const string& s ) + { string old = myDelimiter; myDelimiter = s; return old; } + string setComment( const string& s ) + { string old = myComment; myComment = s; return old; } + + // Write or read configuration + friend std::ostream& operator<<( std::ostream& os, const ConfigFile& cf ); + friend std::istream& operator>>( std::istream& is, ConfigFile& cf ); + +protected: + template<class T> static string T_as_string( const T& t ); + template<class T> static T string_as_T( const string& s ); + static void trim( string& s ); + + +// Exception types +public: + struct file_not_found { + string filename; + file_not_found( const string& filename_ = string() ) + : filename(filename_) {} }; + struct key_not_found { // thrown only by T read(key) variant of read() + string key; + key_not_found( const string& key_ = string() ) + : key(key_) {} }; +}; + + +/* static */ +template<class T> +string ConfigFile::T_as_string( const T& t ) +{ + // Convert from a T to a string + // Type T must support << operator + std::ostringstream ost; + ost << t; + return ost.str(); +} + + +/* static */ +template<class T> +T ConfigFile::string_as_T( const string& s ) +{ + // Convert from a string to a T + // Type T must support >> operator + T t; + std::istringstream ist(s); + ist >> t; + return t; +} + + +/* static */ +template<> +inline string ConfigFile::string_as_T<string>( const string& s ) +{ + // Convert from a string to a string + // In other words, do nothing + return s; +} + + +/* static */ +template<> +inline bool ConfigFile::string_as_T<bool>( const string& s ) +{ + // Convert from a string to a bool + // Interpret "false", "F", "no", "n", "0" as false + // Interpret "true", "T", "yes", "y", "1", "-1", or anything else as true + bool b = true; + string sup = s; + for( string::iterator p = sup.begin(); p != sup.end(); ++p ) + *p = toupper(*p); // make string all caps + if( sup==string("FALSE") || sup==string("F") || + sup==string("NO") || sup==string("N") || + sup==string("0") || sup==string("NONE") ) + b = false; + return b; +} + + +template<class T> +T ConfigFile::read( const string& key ) const +{ + // Read the value corresponding to key + mapci p = myContents.find(key); + if( p == myContents.end() ) throw key_not_found(key); + return string_as_T<T>( p->second ); +} + + +template<class T> +T ConfigFile::read( const string& key, const T& value ) const +{ + // Return the value corresponding to key or given default value + // if key is not found + mapci p = myContents.find(key); + if( p == myContents.end() ) return value; + return string_as_T<T>( p->second ); +} + + +template<class T> +bool ConfigFile::readInto( T& var, const string& key ) const +{ + // Get the value corresponding to key and store in var + // Return true if key is found + // Otherwise leave var untouched + mapci p = myContents.find(key); + bool found = ( p != myContents.end() ); + if( found ) var = string_as_T<T>( p->second ); + return found; +} + + +template<class T> +bool ConfigFile::readInto( T& var, const string& key, const T& value ) const +{ + // Get the value corresponding to key and store in var + // Return true if key is found + // Otherwise set var to given default + mapci p = myContents.find(key); + bool found = ( p != myContents.end() ); + if( found ) + var = string_as_T<T>( p->second ); + else + var = value; + return found; +} + + +template<class T> +void ConfigFile::add( string key, const T& value ) +{ + // Add a key with given value + string v = T_as_string( value ); + trim(key); + trim(v); + myContents[key] = v; + return; +} + +#endif // CONFIGFILE_H + +// Release notes: +// v1.0 21 May 1999 +// + First release +// + Template read() access only through non-member readConfigFile() +// + ConfigurationFileBool is only built-in helper class +// +// v2.0 3 May 2002 +// + Shortened name from ConfigurationFile to ConfigFile +// + Implemented template member functions +// + Changed default comment separator from % to # +// + Enabled reading of multiple-line values +// +// v2.1 24 May 2004 +// + Made template specializations inline to avoid compiler-dependent linkage +// + Allowed comments within multiple-line values +// + Enabled blank line termination for multiple-line values +// + Added optional sentry to detect end of configuration file +// + Rewrote messy trimWhitespace() function as elegant trim()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/Makefile Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,15 @@ +PLUGIN = projectm-1.0${PLUGIN_SUFFIX} +SRCS = main.cxx \ + video_init.cxx \ + ConfigFile.cxx \ + main_visplugin.c + +plugindir = audacious/${VISUALIZATION_PLUGIN_DIR} + +include ../../buildsys.mk +include ../../extra.mk + +CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${ARCH_DEFINES} ${XML_CPPFLAGS} ${SDL_CFLAGS} ${LIBPROJECTM1_CFLAGS} -I../../intl -I../.. +CFLAGS += ${PLUGIN_CFLAGS} +CXXFLAGS += ${PLUGIN_CFLAGS} +LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${SDL_LIBS} ${LIBPROJECTM1_LIBS}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/main.cxx Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,454 @@ +/* +projectM v1.01 - xmms-projectm.sourceforge.net +-------------------------------------------------- + +Lead Developers: Carmelo Piccione (carmelo.piccione@gmail.com) & + Peter Sperl (peter@sperl.com) + +We have also been advised by some professors at CMU, namely Roger B. Dannenberg. +http://www-2.cs.cmu.edu/~rbd/ + +The inspiration for this program was Milkdrop by Ryan Geiss. Obviously. + +This code is distributed under the GPL. + + +THANKS FOR THE CODE!!! +------------------------------------------------- +The base for this program was andy@nobugs.org's XMMS plugin tutorial +http://www.xmms.org/docs/vis-plugin.html + +We used some FFT code by Takuya OOURA instead of XMMS' built-in fft code +fftsg.c - http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html + +and some beat detection code was inspired by Frederic Patin @ +www.gamedev.net/reference/programming/features/beatdetection/ + +*/ + +#include <stdio.h> +#include <string.h> +#include <string> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <SDL/SDL.h> +#include <SDL/SDL_thread.h> +#include <GL/gl.h> +#include <GL/glu.h> +extern "C" { +#include <audacious/util.h> +#include <audacious/plugin.h> +#include <audacious/auddrct.h> +} +#include <math.h> +#include "ConfigFile.h" + +#include <libprojectM/BeatDetect.hpp> +#include <libprojectM/PCM.hpp> +#include <libprojectM/projectM.hpp> +#include <libprojectM/KeyHandler.hpp> +#include "sdltoprojectM.h" +#include "video_init.h" + +#define CONFIG_FILE "/share/projectM/config.inp" + +// Forward declarations +extern "C" void projectM_xmms_init(void); +extern "C" void projectM_cleanup(void); +extern "C" void projectM_about(void); +extern "C" void projectM_configure(void); +extern "C" void projectM_playback_start(void); +extern "C" void projectM_playback_stop(void); +extern "C" void projectM_render_pcm(gint16 pcm_data[2][512]); +extern "C" void projectM_render_freq(gint16 pcm_data[2][256]); +extern "C" int worker_func(void*); +std::string read_config(); +void saveSnapshotToFile(); + +extern "C" VisPlugin projectM_vtable; + +//extern preset_t * active_preset; + +//FILE * debugFile = fopen("./dwrite-dump", "wb"); + +// Callback functions + +// Our worker thread +SDL_Thread *worker_thread = NULL; +SDL_sem *sem = NULL; +SDL_mutex *mutex = NULL; + +SDL_Event event; + +SDL_Surface *screen; + + +projectM * globalPM = NULL; + +int maxsamples=512; + +int texsize=512; +int gx=32,gy=24; +int wvw=400,wvh=400; +int fvw=1024,fvh=768; +int fps=35, fullscreen=0; + +// char *title; + +gint disable_projectm(void *something) { + projectM_vtable.disable_plugin(&projectM_vtable); + return 0; +} + +Uint32 get_xmms_title(Uint32 something, void *somethingelse) { + static char check_title = 1; + static int last_pos; + static char *last_title = NULL; + int pos; + char *title = NULL; + + //Nice optimization, but we want the title no matter what so I can display it when the song changes +#if 0 + if(!(globalPM->showtitle%2)) { + /* Repeat less often when not showing title */ + return 1000; + } +#endif + + pos = audacious_drct_pl_get_pos(); + /* Only check every 1 second for title change, otherwise check pos */ + if(check_title || pos != last_pos) { + title = audacious_drct_pl_get_title(pos); + if(title && (!last_title || strcmp(last_title,title))) { + globalPM->renderer->title = title; + globalPM->renderer->drawtitle = 1; + g_free(last_title); + last_title = title; + } else if(title && last_title != title) { + /* New copy of last title */ + g_free(title); + } + check_title = !check_title; + } + last_pos = pos; + /* Repeat every 500ms */ + return 500; +} + +int capture = 0; + +int worker_func(void*) +{ +// char projectM_data[1024]; + SDL_TimerID title_timer = NULL; + std::string config_file; + config_file = read_config(); + + ConfigFile config(config_file); + + int wvw = config.read<int>( "Window Width", 512 ); + int wvh = config.read<int>( "Window Height", 512 ); + int fullscreen = 0; + if (config.read("Fullscreen", true)) fullscreen = 1; + else fullscreen = 0; + + init_display(wvw,wvh,&fvw,&fvh,fullscreen); + SDL_WM_SetCaption("projectM v1.00", "projectM v1.00"); + + + /** Initialise projectM */ + + globalPM = new projectM(config_file); + + title_timer = SDL_AddTimer(500, (SDL_NewTimerCallback) get_xmms_title, NULL); + /** Initialise the thread */ + // SDL_SemTryWait(sem); + while ( SDL_SemValue(sem)==1 ) { + projectMEvent evt; + projectMKeycode key; + projectMModifier mod; + + /** Process SDL events */ + SDL_Event event; + while ( SDL_PollEvent( &event ) ) { + /** Translate into projectM codes and process */ + evt = sdl2pmEvent( event ); + + key = sdl2pmKeycode( event.key.keysym.sym ); + mod = sdl2pmModifier( event.key.keysym.mod ); + + if ( evt == PROJECTM_KEYDOWN ) { + + if(key == PROJECTM_K_c) + { + //SDL_SaveBMP(screen, "/home/pete/1.bmp"); + saveSnapshotToFile(); + } + if(key == PROJECTM_K_v) + { + // capture++; + } + if(key == PROJECTM_K_f) + { + + + int w, h; + if (fullscreen == 0) { + w = fvw; + h = fvh; + } else { + w = wvw; + h = wvh; + } + globalPM->fullscreen = fullscreen ^= 1; + resize_display(w, h, fullscreen); + globalPM->projectM_resetGL( w, h ); + } + else globalPM->key_handler(evt,key,mod); + + } + else if ( evt == PROJECTM_VIDEORESIZE ) + { + + + + wvw=event.resize.w; + wvh=event.resize.h; + + + resize_display(wvw,wvh,fullscreen); + globalPM->projectM_resetGL( wvw, wvh ); + + } + else if ( evt == PROJECTM_VIDEOQUIT ) { + + (void) g_idle_add((GSourceFunc) disable_projectm, NULL); + } + } + + /** Add the waveform data */ + + + /** Render the new frame */ + // strcpy(title,xmms_remote_get_playlist_title(projectM_vtable.xmms_session, xmms_remote_get_playlist_pos(projectM_vtable.xmms_session))); + + //printf("%s\n",title); + // strcpy(globalPM->title,title); + //SDL_mutexP(mutex); + globalPM->renderFrame(); + //SDL_mutexV(mutex); + + + SDL_GL_SwapBuffers(); + + if (capture % 2 == 1) saveSnapshotToFile(); + // SDL_SemPost(sem); + } + + + + printf("Worker thread: Exiting\n"); + if(title_timer) + SDL_RemoveTimer(title_timer); + delete globalPM; + globalPM = NULL; + close_display(); + + return 0; +} + +extern "C" void projectM_xmms_init(void) +{ + + printf("projectM plugin: Initializing\n"); + + SDL_EnableUNICODE(1); + + mutex = SDL_CreateMutex(); + sem = SDL_CreateSemaphore(1); + worker_thread = SDL_CreateThread ( *worker_func, NULL); + +} + + + +extern "C"void projectM_cleanup(void) +{ + + if(worker_thread) { + SDL_SemWait(sem); + SDL_WaitThread(worker_thread, NULL); + SDL_DestroyMutex(mutex); + SDL_DestroySemaphore(sem); + SDL_Quit(); + worker_thread = NULL; + sem = NULL; + mutex = NULL; + printf("projectM plugin: Cleanup completed\n"); + } +} +extern "C" void projectM_about(void) +{ + printf("projectM plugin: About\n"); +} +extern "C" void projectM_configure(void) +{ + printf("projectM plugin: Configure\n"); +} +extern "C" void projectM_playback_start(void) +{//thread_control = GO; + printf("projectM plugin: Playback starting\n"); +} +extern "C" void projectM_playback_stop(void) +{//thread_control = STOP; + printf("projectM plugin: Playback stopping\n"); +} +extern "C" void projectM_render_pcm(gint16 pcm_data[2][512]) +{ + //SDL_mutexP(mutex); + + if(globalPM) + globalPM->beatDetect->pcm->addPCM16(pcm_data); + + //SDL_mutexV(mutex); + +} + +extern "C" void projectM_render_freq(gint16 freq_data[2][256]) +{ + printf("NO GOOD\n"); + } + +std::string read_config() +{ + +// int n; + + char num[512]; + FILE *in; + FILE *out; + + char* home; + char projectM_home[1024]; + char projectM_config[1024]; + + strcpy(projectM_config, PROJECTM_PREFIX); + strcpy(projectM_config+strlen(PROJECTM_PREFIX), CONFIG_FILE); + projectM_config[strlen(PROJECTM_PREFIX)+strlen(CONFIG_FILE)]='\0'; + printf("dir:%s \n",projectM_config); + home=getenv("HOME"); + strcpy(projectM_home, home); + strcpy(projectM_home+strlen(home), "/.projectM/config.inp"); + projectM_home[strlen(home)+strlen("/.projectM/config.inp")]='\0'; + + + if ((in = fopen(projectM_home, "r")) != 0) + { + printf("reading ~/.projectM/config.inp \n"); + fclose(in); + return std::string(projectM_home); + } + else + { + printf("trying to create ~/.projectM/config.inp \n"); + + strcpy(projectM_home, home); + strcpy(projectM_home+strlen(home), "/.projectM"); + projectM_home[strlen(home)+strlen("/.projectM")]='\0'; + mkdir(projectM_home,0755); + + strcpy(projectM_home, home); + strcpy(projectM_home+strlen(home), "/.projectM/config.inp"); + projectM_home[strlen(home)+strlen("/.projectM/config.inp")]='\0'; + + if((out = fopen(projectM_home,"w"))!=0) + { + + if ((in = fopen(projectM_config, "r")) != 0) + { + + while(fgets(num,80,in)!=NULL) + { + fputs(num,out); + } + fclose(in); + fclose(out); + + + if ((in = fopen(projectM_home, "r")) != 0) + { + printf("created ~/.projectM/config.inp successfully\n"); + fclose(in); + return std::string(projectM_home); + } + else{printf("This shouldn't happen, using implementation defualts\n");abort();} + } + else{printf("Cannot find projectM default config, using implementation defaults\n");abort();} + } + else + { + printf("Cannot create ~/.projectM/config.inp, using default config file\n"); + if ((in = fopen(projectM_config, "r")) != 0) + { printf("Successfully opened default config file\n"); + fclose(in); + return std::string(projectM_config);} + else{ printf("Using implementation defaults, your system is really messed up, I'm suprised we even got this far\n"); abort();} + + } + + } + + + + abort(); +} + +int frame = 1; +char dumpPath[128]; + + +void saveSnapshotToFile() +{ + + SDL_Surface * bitmap; + + GLint viewport[4]; + long bytewidth; + GLint width, height; + long bytes; + + glReadBuffer(GL_FRONT); + glGetIntegerv(GL_VIEWPORT, viewport); + + width = viewport[2]; + height = viewport[3]; + + bytewidth = width * 4; + bytewidth = (bytewidth + 3) & ~3; + bytes = bytewidth * height; + + /* + glFinish(); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + glPixelStorei(GL_PACK_ROW_LENGTH, 0); + glPixelStorei(GL_PACK_SKIP_ROWS, 0); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + */ + + + bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,0,0,0,0); + glReadPixels(0, 0, width, height, + GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, + bitmap->pixels); + + sprintf(dumpPath, "/home/pete/.projectM/%.8d.bmp", frame++); + + SDL_SaveBMP(bitmap, dumpPath); + + SDL_FreeSurface(bitmap); + + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/main_visplugin.c Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,28 @@ +#include <audacious/plugin.h> + +extern void projectM_xmms_init(void); +extern void projectM_cleanup(void); +extern void projectM_about(void); +extern void projectM_configure(void); +extern void projectM_playback_start(void); +extern void projectM_playback_stop(void); +extern void projectM_render_pcm(gint16 pcm_data[2][512]); +extern void projectM_render_freq(gint16 pcm_data[2][256]); + +VisPlugin projectM_vtable = { + .description = "projectM v1.0", + .num_pcm_chs_wanted = 2, + .init = projectM_xmms_init, + .cleanup = projectM_cleanup, + .about = projectM_about, + .configure = projectM_configure, + .playback_start = projectM_playback_start, + .playback_stop = projectM_playback_stop, + .render_pcm = projectM_render_pcm, + .render_freq = projectM_render_freq, +}; + +VisPlugin *projectM_vplist[] = { &projectM_vtable, NULL }; + +DECLARE_PLUGIN(projectm, NULL, NULL, NULL, NULL, NULL, NULL, + projectM_vplist, NULL);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/sdltoprojectM.h Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,148 @@ +/** + * $Id: sdltoprojectM.h,v 1.1.1.1 2005/12/23 18:42:00 psperl Exp $ + * + * Translates SDL -> projectM variables + * + * $Log: sdltoprojectM.h,v $ + * Revision 1.1.1.1 2005/12/23 18:42:00 psperl + * Initial Import + * + * Revision 1.1 2004/10/08 00:35:28 cvs + * Moved and imported + * + * Revision 1.1.1.1 2004/10/04 12:56:00 cvs + * Imported + * + */ + +#ifndef _SDLTOPROJECTM_H +#define _SDLTOPROJECTM_H + +#include "libprojectM/event.h" +#ifdef WIN32 +#include <SDL.h> +#else +#include <SDL/SDL.h> +#endif + +projectMEvent sdl2pmEvent( SDL_Event event ) { \ + + switch ( event.type ) { \ + case SDL_VIDEORESIZE: + return PROJECTM_VIDEORESIZE; \ + case SDL_KEYUP: \ + return PROJECTM_KEYUP; \ + case SDL_KEYDOWN: \ + return PROJECTM_KEYDOWN; \ + case SDL_QUIT: \ + return PROJECTM_VIDEOQUIT; \ + default: + return PROJECTM_KEYUP; \ + } \ + } \ + +projectMKeycode sdl2pmKeycode( SDLKey keysym ) { \ + switch ( keysym ) { \ + case SDLK_F1: \ + return PROJECTM_K_F1; \ + case SDLK_F2: \ + return PROJECTM_K_F2; \ + case SDLK_F3: \ + return PROJECTM_K_F3; \ + case SDLK_F4: \ + return PROJECTM_K_F4; \ + case SDLK_F5: \ + return PROJECTM_K_F5; \ + case SDLK_F6: \ + return PROJECTM_K_F6; \ + case SDLK_F7: \ + return PROJECTM_K_F7; \ + case SDLK_F8: \ + return PROJECTM_K_F8; \ + case SDLK_F9: \ + return PROJECTM_K_F9; \ + case SDLK_F10: \ + return PROJECTM_K_F10; \ + case SDLK_F11: \ + return PROJECTM_K_F11; \ + case SDLK_F12: \ + return PROJECTM_K_F12; \ + case SDLK_ESCAPE: \ + return PROJECTM_K_ESCAPE; + case SDLK_a: + return PROJECTM_K_a; + case SDLK_b: + return PROJECTM_K_b; + case SDLK_c: + return PROJECTM_K_c; + case SDLK_d: + return PROJECTM_K_d; + case SDLK_e: + return PROJECTM_K_e; + case SDLK_f: + return PROJECTM_K_f; + case SDLK_g: + return PROJECTM_K_g; + case SDLK_h: + return PROJECTM_K_h; + case SDLK_i: + return PROJECTM_K_i; + case SDLK_j: + return PROJECTM_K_j; + case SDLK_k: + return PROJECTM_K_k; + case SDLK_l: + return PROJECTM_K_l; + case SDLK_m: + return PROJECTM_K_m; + case SDLK_n: + return PROJECTM_K_n; + case SDLK_o: + return PROJECTM_K_o; + case SDLK_p: + return PROJECTM_K_p; + case SDLK_q: + return PROJECTM_K_q; + case SDLK_r: + return PROJECTM_K_r; + case SDLK_s: + return PROJECTM_K_s; + case SDLK_t: + return PROJECTM_K_t; + case SDLK_u: + return PROJECTM_K_u; + case SDLK_v: + return PROJECTM_K_v; + case SDLK_w: + return PROJECTM_K_w; + case SDLK_x: + return PROJECTM_K_x; + case SDLK_y: + return PROJECTM_K_y; + case SDLK_z: + return PROJECTM_K_z; + case SDLK_UP: + return PROJECTM_K_UP; + case SDLK_RETURN: + return PROJECTM_K_RETURN; + case SDLK_RIGHT: + return PROJECTM_K_RIGHT; + case SDLK_LEFT: + return PROJECTM_K_LEFT; + case SDLK_DOWN: + return PROJECTM_K_DOWN; + case SDLK_PAGEUP: + return PROJECTM_K_PAGEUP; + case SDLK_PAGEDOWN: + return PROJECTM_K_PAGEDOWN; + + default: \ + return PROJECTM_K_NONE; \ + } \ + } \ + +projectMModifier sdl2pmModifier( SDLMod mod ) { \ + return PROJECTM_KMOD_LSHIFT; \ + } \ + +#endif /** _SDLTOPROJECTM_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/video_init.cxx Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,156 @@ +//video_init.c - SDL/Opengl Windowing Creation/Resizing Functions +// +//by Peter Sperl +// +//Opens an SDL Window and creates an OpenGL session +//also able to handle resizing and fullscreening of windows +//just call init_display again with differant variables + +#include <SDL/SDL.h> +#include <GL/gl.h> +#include <GL/glu.h> + +extern SDL_Surface *screen; +extern int texsize; +void setup_opengl( int w, int h ); + +void close_display() { + printf("quitting\n"); + SDL_Quit(); +} + +void resize_display(int w, int h, int f) { + int flags; + if (f) flags = SDL_OPENGL|SDL_HWSURFACE|SDL_FULLSCREEN; + else flags = SDL_OPENGL|SDL_HWSURFACE|SDL_RESIZABLE; +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + screen = SDL_SetVideoMode( w, h, 0, flags ) ; + if(screen == 0 ) { + fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) ); + return; + } + setup_opengl(w,h); + SDL_ShowCursor(f ? SDL_DISABLE : SDL_ENABLE); +} + +//init_display +// +//Sets screen to new width and height (w,h) +//Also switches between fullscreen and windowed +//with the boolean f (fullscreen) +void init_display(int w, int h, int *fvw, int *fvh, int f) +{ + + /* Information about the current video settings. */ + const SDL_VideoInfo* info = NULL; + int bpp = 0; + /* Flags we will pass into SDL_SetVideoMode. */ + int flags = 0; + /* First, initialize SDL's video subsystem. */ + if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) { + /* Failed, exit. */ + fprintf( stderr, "Video initialization failed: %s\n", + SDL_GetError( ) ); + //projectM_vtable.disable_plugin (&projectM_vtable); + return; + + } + /* Let's get some video information. */ + info = SDL_GetVideoInfo( ); + if( !info ) { + /* This should probably never happen. */ + fprintf( stderr, "Video query failed: %s\n", + SDL_GetError( ) ); + // projectM_vtable.disable_plugin (&projectM_vtable); + return; + } + + printf("Screen Resolution: %d x %d\n", info->current_w, info->current_h); + *fvw = info->current_w; + *fvh = info->current_h; + printf("set fvw and fvw\n"); + bpp = info->vfmt->BitsPerPixel; + printf("set bpp\n"); + //SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 ); + //SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); + //SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 ); + + // SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 8 ); + // SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 8 ); + // SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 8 ); + SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 ); + SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); + SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + printf("set gl attributes\n"); + if (f==0) + flags = SDL_OPENGL|SDL_HWSURFACE|SDL_RESIZABLE; + else flags = SDL_OPENGL|SDL_HWSURFACE|SDL_FULLSCREEN; + printf("set gl attributes2\n"); + screen= SDL_SetVideoMode( w, h, bpp, flags ) ; + printf("set screen\n"); + if(screen == 0 ) { + /* + * This could happen for a variety of reasons, + * including DISPLAY not being set, the specified + * resolution not being available, etc. + */ + fprintf( stderr, "Video mode set failed: %s\n", + SDL_GetError( ) ); + + // projectM_vtable.disable_plugin (&projectM_vtable); + return; + + } + + printf("video init done\n"); + // setup_opengl(w,h); + //gluOrtho2D(0, w, 0, h); +} + + + void setup_opengl( int w, int h ) +{ + + /* Our shading model--Gouraud (smooth). */ + glShadeModel( GL_SMOOTH); + /* Culling. */ + // glCullFace( GL_BACK ); + // glFrontFace( GL_CCW ); + // glEnable( GL_CULL_FACE ); + /* Set the clear color. */ + glClearColor( 0, 0, 0, 0 ); + /* Setup our viewport. */ + glViewport( 0, 0, w, h ); + /* + * Change to the projection matrix and set + * our viewing volume. + */ + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + + // gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + // glFrustum(0.0, height, 0.0,width,10,40); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + +glDrawBuffer(GL_BACK); + glReadBuffer(GL_BACK); + glEnable(GL_BLEND); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + // glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POINT_SMOOTH); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClear(GL_COLOR_BUFFER_BIT); + + // glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0); + //glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize); + glLineStipple(2, 0xAAAA); + + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/projectm-1.0/video_init.h Mon Oct 01 15:35:02 2007 -0500 @@ -0,0 +1,6 @@ + void setup_opengl( int w, int h ); + void init_display( int w, int h, int *fvw, int *fvh, int fullscreen ); + void resize_display( int w, int h, int fullscreen ); + void close_display(); + +void CreateRenderTarget(int texsize,int *RenderTargetTextureID, int *RenderTarget);
--- a/src/pulse_audio/pulse_audio.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/pulse_audio/pulse_audio.c Mon Oct 01 15:35:02 2007 -0500 @@ -17,9 +17,7 @@ USA. ***/ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "config.h" #include <stdio.h> #include <assert.h>
--- a/src/scrobbler/fmt.c Mon Oct 01 15:34:40 2007 -0500 +++ b/src/scrobbler/fmt.c Mon Oct 01 15:35:02 2007 -0500 @@ -10,7 +10,7 @@ char *fmt_escape(const char *str) { if (str == NULL) - return ""; + return NULL; return curl_escape(str, 0); } @@ -18,7 +18,7 @@ char *fmt_unescape(char *str) { if (str == NULL) - return ""; + return NULL; return curl_unescape(str, 0); }