Mercurial > audlegacy-plugins
changeset 230:ee81e087615c trunk
[svn] - remove plugins that now live in -ugly
author | nenolod |
---|---|
date | Mon, 06 Nov 2006 23:06:03 -0800 |
parents | 5783d6281431 |
children | 49136c75b018 |
files | ChangeLog configure.ac src/a52dec/Makefile src/a52dec/a52dec.c src/a52dec/a52dec.h src/iris/3Dstuff.c src/iris/Makefile src/iris/color.c src/iris/config.c src/iris/config.h src/iris/iris.c src/iris/iris.h src/iris/particle.h src/iris/theme.c src/iris/theme_flash.c src/iris/theme_float.c src/iris/theme_fountain.c src/iris/theme_knot.c src/iris/theme_original.c src/iris/theme_pinwheel.c src/iris/theme_pipes.c src/iris/theme_pyramid.c src/iris/theme_spectrotoy.c src/iris/theme_spectrum.c src/iris/theme_squarefield.c src/iris/theme_waves.c src/iris/transition.c src/mplayer/AUTHORS src/mplayer/Makefile src/mplayer/README src/mplayer/README.audacious src/mplayer/common.c src/mplayer/interface.c src/mplayer/xmmsmplayer.c src/mplayer/xmmsmplayer.h src/notify/Makefile src/notify/notify.c src/sap/Makefile src/sap/doc/CHANGES src/sap/doc/COMPILATION src/sap/doc/CREDITS src/sap/doc/README src/sap/doc/README.audacious src/sap/doc/TODO src/sap/fileinfo.c src/sap/fileinfo.h src/sap/sap_plug.c src/sap/sap_plug.h src/sap/sapfile.c src/sap/sapfile.h src/sap/saplib/Makefile src/sap/saplib/legal.txt src/sap/saplib/pokey.png src/sap/saplib/pokey0.cxx src/sap/saplib/pokey1.cxx src/sap/saplib/pokeyNamespace.h src/sap/saplib/sapCpu.cxx src/sap/saplib/sapEngine.cxx src/sap/saplib/sapGlobals.h src/sap/saplib/sapLib.h src/sap/saplib/sapPokey.cxx src/sap/scripts/gen_symbols src/sap/syms |
diffstat | 63 files changed, 8 insertions(+), 15370 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Nov 06 15:04:13 2006 -0800 +++ b/ChangeLog Mon Nov 06 23:06:03 2006 -0800 @@ -1,3 +1,11 @@ +2006-11-06 23:04:13 +0000 William Pitcock <nenolod@nenolod.net> + revision [458] + - revert due to branching issue + + trunk/src/sexypsf/xmms.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + + 2006-11-06 22:11:04 +0000 Tony Vroon <chainsaw@gentoo.org> revision [456] New-style VFS probe function. If you want an #ifdef feel free to bolt some on.
--- a/configure.ac Mon Nov 06 15:04:13 2006 -0800 +++ b/configure.ac Mon Nov 06 23:06:03 2006 -0800 @@ -364,25 +364,6 @@ GENERAL_PLUGINS="$GENERAL_PLUGINS lirc" fi -dnl *** libnotify requirement - -AC_ARG_ENABLE(notify, - [ --disable-notify disable libnotify plugin (default=enabled)], - [enable_libnotify=$enableval], - [enable_libnotify="yes"] -) - -if test "$enable_libnotify" = "yes"; then - PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.4.2], - [have_libnotify=yes - GENERAL_PLUGINS="$GENERAL_PLUGINS notify"], - [have_libnotify=no] - ) -else - AC_MSG_RESULT([*** libnotify plugin disabled per user request ***]) - have_libnotify="no" -fi - dnl *** AdPlug requirement (libbinio) AC_ARG_ENABLE(adplug, @@ -403,26 +384,6 @@ INPUT_PLUGINS="$INPUT_PLUGINS adplug" fi -AC_ARG_ENABLE(mplayer, - [ --enable-mplayer enable mplayer plugin. (default=disabled) ], - [enable_mplayer=$enableval], - [enable_mplayer=no] -) - -if test "$enable_mplayer" = "yes"; then - INPUT_PLUGINS="$INPUT_PLUGINS mplayer" -fi - -AC_ARG_ENABLE(sap, - [ --enable-sap enable Atari XL SAP plugin. (default=disabled) ], - [enable_sap=$enableval], - [enable_sap=no] -) - -if test "$enable_sap" = "yes"; then - INPUT_PLUGINS="$INPUT_PLUGINS sap" -fi - dnl *** Ogg Vorbis AC_ARG_ENABLE(vorbis, @@ -857,25 +818,6 @@ INPUT_PLUGINS="$INPUT_PLUGINS timidity" fi -dnl *** Iris - -AC_ARG_ENABLE(iris, -[ --disable-iris disable iris plugin. (default=enabled)], -[enable_iris=$enableval], -[enable_iris=yes] -) - -if test "$enable_iris" = "yes"; then - PKG_CHECK_MODULES(XXF86VM, [xxf86vm >= 1.0.0], - [enable_iris=yes - VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS iris"], - [enable_iris=no] - ) -else - AC_MSG_RESULT([*** Iris plugin disabled per user request ***]) - enable_iris=no -fi - dnl FreeBSD newpcm driver detection AC_CACHE_CHECK(for FreeBSD newpcm driver, beep_cv_newpcm_driver, @@ -1162,8 +1104,6 @@ echo " AdLib synthesizer (adplug): $have_adplug" echo " Apple Lossless Audio Codec (alac): yes" echo " WavPack 4.31+ (wavpack): $have_wavpack" -echo " Mplayer controls (mplayer): $enable_mplayer" -echo " Atari XL SAP playback (sap): $enable_sap" echo echo " General" echo " -------" @@ -1171,7 +1111,6 @@ echo " Song Change: yes" echo " LIRC: $have_lirc" echo " AudioScrobbler Client: $scrobbler" -echo " libnotify Plugin: $have_libnotify" echo echo " Effect" echo " ------" @@ -1186,7 +1125,6 @@ echo " Blur Scope: yes" echo " Spectrum Analyzer: yes" echo " Paranormal Visualization Library: $have_paranormal" -echo " IRIS 3D: $enable_iris" echo echo " Container" echo " ---------"
--- a/src/a52dec/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -OBJECTIVE_LIBS = liba52dec$(SHARED_SUFFIX) - -LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR) - -SOURCES = a52dec.c - -LIBADD = -L/usr/local/lib -la52 - -CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) -I../../intl -I../.. - -OBJECTS = ${SOURCES:.c=.o} - -include ../../mk/objective.mk
--- a/src/a52dec/a52dec.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1536 +0,0 @@ - -/* - * xmms-a52dec.c - * - * xmms-a52dec 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, or (at your option) - * any later version. - * - * xmms-a52dec 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/errno.h> -#include <errno.h> -#include <pthread.h> -#include <semaphore.h> -#include <math.h> -#include <inttypes.h> -#include <gtk/gtk.h> -#include <audacious/util.h> -#include <audacious/plugin.h> -#include <audacious/configdb.h> -#include <audacious/vfs.h> - -#include <a52dec/a52.h> -#include <a52dec/mm_accel.h> - -#include "a52dec.h" - -#define DRC_BOTH 0 -#define DRC_BOOST 1 -#define DRC_REDUCE 2 - -#define SYNC_SEARCH_LIMIT 65536 -#define COMPRESSION_FACTOR_DEFAULT 0.0 -#define COMPRESSION_TYPE_DEFAULT DRC_BOTH -#define NODOWNMIX_SURROUND_DEFAULT FALSE -#define NODOWNMIX_LFE_DEFAULT FALSE -#define UPMIX_STEREO_DEFAULT FALSE -#define DUALMONO_DEFAULT 1 -#define REQUESTED_OUTPUT_DEFAULT A52_STEREO - -sample_t *sample; -char *buf; -long int lastset_time; -char *name; -int flags, sample_rate, bit_rate, frame_size, length; -VFSFile *in_file; -int a52_run, a52_not_eof; -gint output_type; // See also: requested_output -int output_nch; - -// Configuration Options. - -gdouble compression_factor; -gboolean compression_type; -gint requested_output; // See also: output_type -gint dualmono_channel; -gboolean nodownmix_surround, nodownmix_lfe, upmix_stereo; - -static pthread_t decode_thread = (pthread_t) NULL; -sem_t play_loop_signal; -pthread_mutex_t infile_lock; - -extern InputPlugin a52_ip; - -static int is_our_file_a52 (char *); -static int synchronise_a52(VFSFile *, int *, int *, int *, int *); -sample_t dynamic_range(sample_t, void *); -static void init_a52 (void); -static void *play_loop (void *); -void convertsample(sample_t *, int16_t *, int); -int16_t float2int (float); -static void play_a52 (char *); -static void stop_a52 (void); -static int get_time_a52 (void); -static void get_song_info_a52 (char *, char **, int *); -static void pause_a52 (short); -static void seek_a52 (int); -static void about_a52 (void); -static void configure_a52 (void); -static void configure_ok(GtkWidget *, gpointer); -static void configure_apply(GtkWidget *, gpointer); -static void info_a52 (char *); - -InputPlugin a52_ip = { - NULL, - NULL, - "AC-3 / A52 Decoding Plugin", - init_a52, - about_a52, - configure_a52, - is_our_file_a52, - NULL, - play_a52, - stop_a52, - pause_a52, - seek_a52, - NULL, - get_time_a52, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_song_info_a52, - info_a52, - NULL -}; - -InputPlugin * -get_iplugin_info (void) -{ - return &a52_ip; -} - -static void -init_a52 (void) -{ - ConfigDb *config; - - // Retrieve settings from file, setting to default if not found. - - config = bmp_cfg_db_open(); - if (!bmp_cfg_db_get_double(config, "xmms-a52dec", "compression_factor", - &compression_factor)) - { - bmp_cfg_db_set_double(config, "xmms-a52dec", "compression_factor", - COMPRESSION_FACTOR_DEFAULT); - compression_factor = COMPRESSION_FACTOR_DEFAULT; - } - - if (!bmp_cfg_db_get_int(config, "xmms-a52dec", "compression_type", - &compression_type)) - { - bmp_cfg_db_set_int(config, "xmms-a52dec", "compression_type", - COMPRESSION_TYPE_DEFAULT); - compression_type = COMPRESSION_TYPE_DEFAULT; - } - - if (!bmp_cfg_db_get_bool(config, "xmms-a52dec", "nodownmix_surround", - &nodownmix_surround)) - { - bmp_cfg_db_set_bool(config, "xmms-a52dec", "nodownmix_surround", - NODOWNMIX_SURROUND_DEFAULT); - nodownmix_surround = NODOWNMIX_SURROUND_DEFAULT; - } - - if (!bmp_cfg_db_get_bool(config, "xmms-a52dec", "nodownmix_lfe", - &nodownmix_lfe)) - { - bmp_cfg_db_set_bool(config, "xmms-a52dec", "nodownmix_lfe", - NODOWNMIX_LFE_DEFAULT); - nodownmix_lfe = NODOWNMIX_LFE_DEFAULT; - } - - if (!bmp_cfg_db_get_bool(config, "xmms-a52dec", "upmix_stereo", - &upmix_stereo)) - { - bmp_cfg_db_set_bool(config, "xmms-a52dec", "upmix_stereo", - UPMIX_STEREO_DEFAULT); - upmix_stereo = UPMIX_STEREO_DEFAULT; - } - - if (!bmp_cfg_db_get_int(config, "xmms-a52dec", "dualmono_channel", - &dualmono_channel)) - { - bmp_cfg_db_set_int(config, "xmms-a52dec", "dualmono_channel", - DUALMONO_DEFAULT); - requested_output = DUALMONO_DEFAULT; - } - - bmp_cfg_db_close(config); -} - -static int -is_our_file_a52 (char *filename) -{ - int l_flags, l_sample_rate, l_bit_rate, l_frame_size; - gchar *extension; - VFSFile *temp_file; - - temp_file = vfs_fopen (filename, "r"); - if (!temp_file) - return FALSE; - - extension = strrchr (filename, '.'); - - if (extension) - if (!strcasecmp (extension, ".a52") || !strcasecmp (extension, ".ac3")) - if (synchronise_a52(temp_file, &l_flags, &l_sample_rate, - &l_bit_rate, &l_frame_size) == 0) - { - vfs_fclose (temp_file); - return TRUE; - } - - vfs_fclose (temp_file); - return FALSE; -} - -/* Synchronises a52 bitstream and set parameters. - - Starting from the current file pointer position, search up to - SYNC_SEARCH_LIMIT bytes for a valid frame, and set file pointer - to start of frame. file pointer will be set to an undefined position if - no valid frame found. - - Return 0 if successful. - Return -1 if failed. */ - -static int -synchronise_a52(VFSFile *file, int *l_flags, int *l_sample_rate, - int *l_bit_rate, int *l_frame_size) -{ - int count; - char temp_buf[7]; - - for (count=0; count <= SYNC_SEARCH_LIMIT; count++) - { - if (vfs_fread(temp_buf, 7, 1, file) != 1) - return -1; - - if (vfs_fseek(file, -6, SEEK_CUR)) - return -1; - - *l_frame_size = a52_syncinfo (temp_buf, l_flags, l_sample_rate, l_bit_rate); - if (*l_frame_size != 0) - break; - } - - // No valid frame found. - - if (count == SYNC_SEARCH_LIMIT) - return -1; - - // Valid frame found. Go back 1 bytes to return to start of frame. - - if (vfs_fseek(file, -1, SEEK_CUR)) - return -1; - - return 0; -} - -sample_t dynamic_range(sample_t recommend, void *nothing) -{ - switch (compression_type) - { - case DRC_BOOST: - if (recommend > 1) - return pow(recommend, (double) compression_factor); - else - return 1; - case DRC_REDUCE: - if (recommend < 1) - return pow(recommend, (double) compression_factor); - else - return 1; - case DRC_BOTH: - default: - return pow(recommend, (double) compression_factor); - } -} - -static void * -play_loop (void *arg) -{ - int old_frame_size, old_bit_rate; - a52_state_t *dec_state; - char *filebuf; - int16_t outbuf[256*6]; - int sample_type; - int first_run=1; - int tempcount; - sample_t level=32766.0; - - /* Re-initialise the a52 library. Without this, there will be - some noise when switching songs */ - - dec_state = a52_init(0); - sample = a52_samples(dec_state); - - a52_run = 1; - lastset_time = 0; - - old_frame_size = frame_size; - old_bit_rate = bit_rate; - filebuf = malloc(frame_size); - - while (a52_run) - { - a52_not_eof = 1; - - /* Lock the mutex before synch and read. - - This prevent a52_seek from calling an vfs_fseek between a - synch and read. */ - - pthread_mutex_lock(&infile_lock); - - // Re-synchronise before reading each frame. - - if (synchronise_a52(in_file, &flags, &sample_rate, - &bit_rate, &frame_size) == -1) - { - pthread_mutex_unlock(&infile_lock); - a52_not_eof = 0; - xmms_usleep(1000); - continue; - } - - // Check if frame_size has changed. If yes, realloc filebuf. - - if (frame_size != old_frame_size) - { - filebuf = realloc(filebuf, frame_size); - old_frame_size = frame_size; - } - - if(!vfs_fread(filebuf, frame_size, 1, in_file)) - { - pthread_mutex_unlock(&infile_lock); - a52_not_eof = 0; - xmms_usleep(1000); - continue; - } - - pthread_mutex_unlock(&infile_lock); - - if (bit_rate != old_bit_rate) - { - a52_ip.set_info (name, length / (bit_rate / 8 / 1000), - bit_rate, sample_rate, output_nch); - old_bit_rate = bit_rate; - } - - if (nodownmix_surround == TRUE) - sample_type = A52_3F2R | A52_ADJUST_LEVEL; - else - sample_type = output_type | A52_ADJUST_LEVEL; - - if (nodownmix_lfe == TRUE) - sample_type |= A52_LFE; - else - sample_type &= A52_CHANNEL_MASK; - - // The above is for non-5.1, for 5.1 we add in the LFE channel. - - sample_type |= output_type & A52_LFE; - - if(a52_frame(dec_state, filebuf, &sample_type, &level, 0.0)) - break; // Don't know how to deal with this properly. - - a52_dynrng (dec_state, dynamic_range, NULL); - - for (tempcount = 0; tempcount < 6; tempcount++) - { - a52_block(dec_state); - - convertsample(sample, outbuf, sample_type); - - /* Sleep while the buffer is full */ - while (a52_run && (a52_ip.output->buffer_free () < 512 * output_nch)) - xmms_usleep (10000); - - a52_ip.output->write_audio (outbuf, 512 * output_nch); - - /* Signal the play_a52 thread to let it know that we have - finished writing to buffer. It can safely exit now. - - Without this, get_time_a52 may run before we have started - playing anything. get_time_a52 will find that the buffer - is not playing (yet) and return -1 causing stop_a52 to - stop play_loop. - - We must only run this once, because play_a52 will destroy - the semaphore once it receive the signal. */ - - if (first_run) - { - sem_post(&play_loop_signal); - first_run=0; - } - - /* Add visualisation data. Do not use a52_ip.gettime() - for the time. Due to buffering, the time for which the - data is submitted and the current playing time is not - the same. The vis data is sent in advance and must be - set for the correct time. */ - - a52_ip.add_vis_pcm (vfs_ftell(in_file) / (bit_rate / 8 / 1000), - FMT_S16_LE, output_nch, 512 * output_nch, outbuf); - } - } - - /* If sem_post didn't run above, we'll run it now */ - - if (first_run) - { - sem_post(&play_loop_signal); - first_run=0; - } - - // Free memory allocated by a52_init. - - a52_free(dec_state); - - /* If we break from the loop due to end of file, the music - is probably still playing, so we'll sleep and wait for - it to end. We'll set a52_not_eof to 0 to let get_time_a52 - know that we have reached the end of file.*/ - - vfs_fclose (in_file); - a52_not_eof=0; - - pthread_exit (NULL); -} - -void -convertsample(sample_t *sample, int16_t *outbuf, int sample_type) -{ - int count; - int lfe_offset; - - if (sample_type & A52_LFE) - lfe_offset = 256; - else - lfe_offset = 0; - - for (count = 0; count < 256; count++) - if (output_type == A52_STEREO) - switch (sample_type & A52_CHANNEL_MASK) - { - case A52_MONO: - case A52_CHANNEL1: - case A52_CHANNEL2: - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - break; - case A52_CHANNEL: - if (dualmono_channel == 1) - { - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - } - else - { - outbuf[count * 2] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - } - break; - case A52_STEREO: - case A52_DOLBY: - case A52_2F1R: - case A52_2F2R: - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = float2int (sample[count + 256 + lfe_offset]); - break; - case A52_3F: - case A52_3F1R: - case A52_3F2R: - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = float2int (sample[count + 512 + lfe_offset]); - break; - } - else if (output_type == A52_2F2R) - switch (sample_type & A52_CHANNEL_MASK) - { - case A52_MONO: - case A52_CHANNEL1: - case A52_CHANNEL2: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = outbuf[count * 4]; - if (upmix_stereo == TRUE) - { - outbuf[count * 4 + 2] = outbuf[count * 4]; - outbuf[count * 4 + 3] = outbuf[count * 4]; - } - else - { - outbuf[count * 4 + 2] = 0; - outbuf[count * 4 + 3] = 0; - } - break; - case A52_CHANNEL: - if (dualmono_channel == 1) - { - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = outbuf[count * 4]; - if (upmix_stereo == TRUE) - { - outbuf[count * 4 + 2] = outbuf[count * 4]; - outbuf[count * 4 + 3] = outbuf[count * 4]; - } - else - { - outbuf[count * 4 + 2] = 0; - outbuf[count * 4 + 3] = 0; - } - } - else - { - outbuf[count * 4] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 4 + 1] = outbuf[count * 4]; - if (upmix_stereo == TRUE) - { - outbuf[count * 4 + 2] = outbuf[count * 4]; - outbuf[count * 4 + 3] = outbuf[count * 4]; - } - else - { - outbuf[count * 4 + 2] = 0; - outbuf[count * 4 + 3] = 0; - } - } - break; - case A52_STEREO: - case A52_DOLBY: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 256 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 4 + 2] = outbuf[count * 4]; - outbuf[count * 4 + 3] = outbuf[count * 4 + 1]; - } - else - { - outbuf[count * 4 + 2] = 0; - outbuf[count * 4 + 3] = 0; - } - break; - case A52_3F: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 512 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 4 + 2] = outbuf[count * 4]; - outbuf[count * 4 + 3] = outbuf[count * 4 + 1]; - } - else - { - outbuf[count * 4 + 2] = 0; - outbuf[count * 4 + 3] = 0; - } - break; - case A52_2F1R: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 4 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 4 + 3] = outbuf[count * 4 + 2]; - break; - case A52_2F2R: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 4 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 4 + 3] = float2int (sample[count + 768 + lfe_offset]); - break; - case A52_3F1R: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 4 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 4 + 3] = outbuf[count * 4 + 2]; - break; - case A52_3F2R: - outbuf[count * 4] = float2int (sample[count + lfe_offset]); - outbuf[count * 4 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 4 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 4 + 3] = float2int (sample[count + 1024 + lfe_offset]); - break; - } - else if (output_type == A52_3F2R) - switch (sample_type & A52_CHANNEL_MASK) - { - case A52_MONO: - case A52_CHANNEL1: - case A52_CHANNEL2: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = outbuf[count * 5]; - if (upmix_stereo == TRUE) - { - outbuf[count * 5 + 2] = outbuf[count * 5]; - outbuf[count * 5 + 3] = outbuf[count * 5]; - } - else - { - outbuf[count * 5 + 2] = 0; - outbuf[count * 5 + 3] = 0; - } - outbuf[count * 5 + 4] = outbuf[count * 5]; - break; - case A52_CHANNEL: - if (dualmono_channel == 1) - { - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = outbuf[count * 5]; - if (upmix_stereo == TRUE) - { - outbuf[count * 5 + 2] = outbuf[count * 5]; - outbuf[count * 5 + 3] = outbuf[count * 5]; - } - else - { - outbuf[count * 5 + 2] = 0; - outbuf[count * 5 + 3] = 0; - } - } - else - { - outbuf[count * 5] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 5 + 1] = outbuf[count * 5]; - if (upmix_stereo == TRUE) - { - outbuf[count * 5 + 2] = outbuf[count * 5]; - outbuf[count * 5 + 3] = outbuf[count * 5]; - } - else - { - outbuf[count * 5 + 2] = 0; - outbuf[count * 5 + 3] = 0; - } - } - break; - case A52_STEREO: - case A52_DOLBY: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 256 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 5 + 2] = outbuf[count * 5]; - outbuf[count * 5 + 3] = outbuf[count * 5 + 1]; - } - else - { - outbuf[count * 5 + 2] = 0; - outbuf[count * 5 + 3] = 0; - } - outbuf[count * 5 + 4] = 0; - break; - case A52_3F: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 512 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 5 + 2] = outbuf[count * 5]; - outbuf[count * 5 + 3] = outbuf[count * 5 + 1]; - } - else - { - outbuf[count * 5 + 2] = 0; - outbuf[count * 5 + 3] = 0; - } - outbuf[count * 5 + 4] = float2int (sample[count + 256 + lfe_offset]); - break; - case A52_2F1R: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 5 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 5 + 3] = outbuf[count * 5 + 2]; - outbuf[count * 5 + 4] = 0; - break; - case A52_2F2R: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 5 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 5 + 3] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 5 + 4] = 0; - break; - case A52_3F1R: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 5 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 5 + 3] = outbuf[count * 5 + 2]; - outbuf[count * 5 + 4] = float2int (sample[count + 256 + lfe_offset]); - break; - case A52_3F2R: - outbuf[count * 5] = float2int (sample[count + lfe_offset]); - outbuf[count * 5 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 5 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 5 + 3] = float2int (sample[count + 1024 + lfe_offset]); - outbuf[count * 5 + 4] = float2int (sample[count + 256 + lfe_offset]); - break; - } - else if (output_type == (A52_3F2R | A52_LFE)) - switch (sample_type & A52_CHANNEL_MASK) - { - case A52_MONO: - case A52_CHANNEL1: - case A52_CHANNEL2: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = outbuf[count * 6]; - if (upmix_stereo == TRUE) - { - outbuf[count * 6 + 2] = outbuf[count * 6]; - outbuf[count * 6 + 3] = outbuf[count * 6]; - } - else - { - outbuf[count * 6 + 2] = 0; - outbuf[count * 6 + 3] = 0; - } - outbuf[count * 6 + 4] = outbuf[count * 6]; - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_CHANNEL: - if (dualmono_channel == 1) - { - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = outbuf[count * 6]; - if (upmix_stereo == TRUE) - { - outbuf[count * 6 + 2] = outbuf[count * 6]; - outbuf[count * 6 + 3] = outbuf[count * 6]; - } - else - { - outbuf[count * 6 + 2] = 0; - outbuf[count * 6 + 3] = 0; - } - } - else - { - outbuf[count * 6] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 6 + 1] = outbuf[count * 6]; - if (upmix_stereo == TRUE) - { - outbuf[count * 6 + 2] = outbuf[count * 6]; - outbuf[count * 6 + 3] = outbuf[count * 6]; - } - else - { - outbuf[count * 6 + 2] = 0; - outbuf[count * 6 + 3] = 0; - } - } - break; - case A52_STEREO: - case A52_DOLBY: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 256 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 6 + 2] = outbuf[count * 6]; - outbuf[count * 6 + 3] = outbuf[count * 6 + 1]; - } - else - { - outbuf[count * 6 + 2] = 0; - outbuf[count * 6 + 3] = 0; - } - outbuf[count * 6 + 4] = 0; - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_3F: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 512 + lfe_offset]); - if (upmix_stereo == TRUE) - { - outbuf[count * 6 + 2] = outbuf[count * 6]; - outbuf[count * 6 + 3] = outbuf[count * 6 + 1]; - } - else - { - outbuf[count * 6 + 2] = 0; - outbuf[count * 6 + 3] = 0; - } - outbuf[count * 6 + 4] = float2int (sample[count + 256 + lfe_offset]); - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_2F1R: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 6 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 6 + 3] = outbuf[count * 6 + 2]; - outbuf[count * 6 + 4] = 0; - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_2F2R: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 6 + 2] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 6 + 3] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 6 + 4] = 0; - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_3F1R: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 6 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 6 + 3] = outbuf[count * 6 + 2]; - outbuf[count * 6 + 4] = float2int (sample[count + 256 + lfe_offset]); - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - case A52_3F2R: - outbuf[count * 6] = float2int (sample[count + lfe_offset]); - outbuf[count * 6 + 1] = float2int (sample[count + 512 + lfe_offset]); - outbuf[count * 6 + 2] = float2int (sample[count + 768 + lfe_offset]); - outbuf[count * 6 + 3] = float2int (sample[count + 1024 + lfe_offset]); - outbuf[count * 6 + 4] = float2int (sample[count + 256 + lfe_offset]); - if (lfe_offset) - outbuf[count * 6 + 5] = float2int (sample[count]); - else - outbuf[count * 6 + 5] = 0; - break; - } - else if (output_type == A52_DOLBY) - switch (sample_type & A52_CHANNEL_MASK) - { - case A52_CHANNEL1: - case A52_CHANNEL2: - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - break; - case A52_CHANNEL: - if (dualmono_channel == 1) - { - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - } - else - { - outbuf[count * 2] = float2int (sample[count + 256 + lfe_offset]); - outbuf[count * 2 + 1] = outbuf[count * 2]; - } - break; - case A52_STEREO: - case A52_DOLBY: - outbuf[count * 2] = float2int (sample[count + lfe_offset]); - outbuf[count * 2 + 1] = float2int (sample[count + 256 + lfe_offset]); - break; - } -} - -int16_t -float2int (float sample) -{ - if (sample > 32767.0) - return 32767; - else if (sample < -32767.0) - return -32767; - else - return (int16_t) sample; -} - -static void -play_a52 (char *filename) -{ - char *temp; - - if (a52_run) - return; - - in_file = vfs_fopen (filename, "r"); - - if (!in_file) - return; - - if (synchronise_a52(in_file, &flags, &sample_rate, - &bit_rate, &frame_size) == -1) - { - vfs_fclose(in_file); - return; - } - - output_type = requested_output; - - if ((output_type & A52_STEREO) || (output_type & A52_DOLBY)) - { - output_nch = a52_ip.output->open_audio (FMT_S16_NE, sample_rate, 2); - if (output_nch == 0) - { - vfs_fclose (in_file); - return; - } - } - - if (output_type != A52_DOLBY) - output_type = A52_STEREO; - - /* don't ask. -nenolod */ - if (output_nch == 1) - output_nch = 2; - - // Get song title - - temp = strrchr (filename, '/'); - if (!temp) - temp = filename; - else - temp++; - name = malloc (strlen (temp) + 1); - strcpy (name, temp); - *strrchr (name, '.') = '\0'; - - // Get song length - - vfs_fseek (in_file, 0, SEEK_END); - - /* If we can get the file length, we divide it by byterate (not bitrate) - and multiply by 1000 to get time in milliseconds. - If we can't get file length, we'll set it to -1 - - length (the variable) : file length - length (passed to set_info) : milliseconds - bit_rate : bits/second - sample_rate : sample/second */ - - if ((length = vfs_ftell (in_file)) != -1) - a52_ip.set_info (name, length / (bit_rate / 8 / 1000), - bit_rate, sample_rate, 2); - else - a52_ip.set_info (name, -1, bit_rate, sample_rate, 2); - - free(name); - - // Return to start of file. - - vfs_fseek (in_file, 0, SEEK_SET); - - // Mutex will be used in play_loop. - - pthread_mutex_destroy(&infile_lock); - pthread_mutex_init(&infile_lock, NULL); - - /* Ensure that play_loop has written to the buffer before exiting. - See play_loop for further details. */ - - sem_init(&play_loop_signal, 0, 0); - pthread_create (&decode_thread, NULL, play_loop, NULL); - sem_wait(&play_loop_signal); - sem_destroy(&play_loop_signal); - - return; -} - -static void -stop_a52 (void) -{ - if (a52_run) - { - a52_run = 0; - pthread_join (decode_thread, NULL); - a52_ip.output->close_audio (); - } -} - -static int -get_time_a52 (void) -{ - /* lastset_time is set when playing starts and - when seeking. We can't use it directly because - it's based on file position for reading. Due to - buffering, the file position is always ahead of - the play position. - - Instead, we set lastset_time when playing and - seeking, and use the output_time() as an offset. */ - - a52_ip.output->buffer_free(); - - if ((a52_run && a52_not_eof) || a52_ip.output->buffer_playing ()) - return lastset_time + a52_ip.output->output_time (); - - return -1; -} - -static void -pause_a52 (short paused) -{ - a52_ip.output->pause (paused); -} - -static void -get_song_info_a52 (gchar * filename, gchar ** title, gint * info_length) -{ - int l_flags, l_sample_rate, l_bit_rate, l_frame_size; - VFSFile *temp_file; - char *temp_name, *temp; - - // Set the song title - - temp = strrchr (filename, '/'); - if (!temp) - temp = filename; - else - temp++; - temp_name = malloc (strlen (temp) + 1); - strcpy (temp_name, temp); - *strrchr (temp_name, '.') = '\0'; - (*title) = temp_name; - - // Determine the song length from filesize. - - temp_file = vfs_fopen (filename, "r"); - - if (synchronise_a52(temp_file, &l_flags, &l_sample_rate, - &l_bit_rate, &l_frame_size) == -1) - { - *info_length = -1; - return; - } - - vfs_fseek (temp_file, 0, SEEK_END); - - if ((*info_length = vfs_ftell (temp_file)) == -1) - { - // Can't get file position - *info_length = -1; - return; - } - - // Song length in milliseconds - - *info_length = *info_length / (l_bit_rate / 8 / 1000); -} - -static void -seek_a52 (gint time) -{ - // time is in seconds. - - // Don't seek while play_loop is reading/synching. - - pthread_mutex_lock(&infile_lock); - vfs_fseek(in_file, time * bit_rate / 8, SEEK_SET); - pthread_mutex_unlock(&infile_lock); - - a52_ip.output->flush (0); - lastset_time = time * 1000; -} - -void -about_a52 (void) -{ - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkStyle *style; - static GtkWidget *dialog, *button, *label, *pixmapwid; - - if (dialog) - return; - - dialog = gtk_dialog_new (); - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), &dialog); - gtk_window_set_title (GTK_WINDOW (dialog), "About xmms-a52dec 1.0"); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, FALSE, FALSE); - gtk_container_border_width (GTK_CONTAINER (dialog), 5); - label = gtk_label_new ("\nXMMS-AC3DEC VERSION 1.0\n\n \ -An A52/AC3 decoder plugin for xmms based on the a52dec package.\n \ -\nCoded by Cort <ccwee@cyberway.com.sg>\nEnhanced by David Weisgerber <tnt@md.2y.net>"); - - /* now for the pixmap from gdk */ - style = gtk_widget_get_style (dialog); - pixmap = gdk_pixmap_create_from_xpm_d (dialog->window, &mask, - &style->bg[GTK_STATE_NORMAL], - (gchar **) a52dec_xpm); - /* a pixmap widget to contain the pixmap */ - pixmapwid = gtk_pixmap_new (pixmap, NULL); - gtk_widget_show (pixmapwid); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), pixmapwid, TRUE, - TRUE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, - 0); - gtk_widget_show (label); - - button = gtk_button_new_with_label (" Close "); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (dialog)); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button, - FALSE, FALSE, 0); - - gtk_widget_show (button); - gtk_widget_show (dialog); - gtk_widget_grab_focus (button); -} - -static GtkWidget *drc_scale, *drc_both, *drc_boost, *drc_reduce; -static GtkWidget *effect_surround, *effect_lfe, *effect_upmix; -static GtkWidget *dualmono_channel1, *dualmono_channel2; - -void -configure_a52 (void) -{ - static GtkWidget *dialog; - static GtkWidget *button_cancel, *button_apply, *button_ok; - static GtkWidget *hbox, *vbox, *vbox2; - static GtkWidget *effect_vbox, *button_hbox, *dualmono_vbox; - static GtkWidget *drc_vbox; - static GtkWidget *range_frame, *effect_frame, *output_frame, *dualmono_frame; - static GtkTooltips *tooltips; - - if (dialog) - return; - - tooltips = gtk_tooltips_new(); - - // Create dialog and set window parameters. - - dialog = gtk_dialog_new (); - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), &dialog); - gtk_window_set_title (GTK_WINDOW (dialog), "xmms-a52dec Configuration"); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, FALSE, FALSE); - gtk_container_border_width (GTK_CONTAINER (dialog), 5); - - // Prepare all the vbox and hbox. - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, - 0); - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - vbox2 = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); - - // Prepare all the frames. - - range_frame = gtk_frame_new("Dynamic Range Compression"); - effect_frame = gtk_frame_new("Effect"); - output_frame = gtk_frame_new("Output"); - dualmono_frame = gtk_frame_new("Dual Mono"); - - // Pack the frames in. - - gtk_box_pack_start (GTK_BOX (vbox), range_frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), effect_frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox2), output_frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox2), dualmono_frame, TRUE, TRUE, 0); - - // Create Dynamic Range Compression options. - - drc_vbox = gtk_vbox_new(FALSE, 0); - drc_scale = gtk_hscale_new (GTK_ADJUSTMENT - (gtk_adjustment_new - (compression_factor, 0, 1, 0.01, 0.1, 0))); - gtk_scale_set_digits (GTK_SCALE (drc_scale), 2); - drc_both = gtk_radio_button_new_with_label (NULL, "Boost and Reduce"); - drc_boost = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(drc_both), "Boost only"); - drc_reduce = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(drc_both), "Reduce only"); - gtk_box_pack_start (GTK_BOX (drc_vbox), drc_scale, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (drc_vbox), drc_both, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (drc_vbox), drc_boost, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (drc_vbox), drc_reduce, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER(range_frame), drc_vbox); - - if (compression_type == DRC_BOTH) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(drc_both), TRUE); - else if (compression_type == DRC_BOOST) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(drc_boost), TRUE); - else if (compression_type == DRC_REDUCE) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(drc_reduce), TRUE); - - - // Create effect toggle button. - - effect_vbox = gtk_vbox_new(FALSE, 0); - effect_surround = gtk_check_button_new_with_label("No downmix of surround"); - effect_lfe = gtk_check_button_new_with_label("No downmix of LFE channel"); - effect_upmix = gtk_check_button_new_with_label("Upmix stereo to surround"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effect_surround), - nodownmix_surround); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effect_lfe), nodownmix_lfe); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effect_upmix), upmix_stereo); - gtk_box_pack_start (GTK_BOX (effect_vbox), effect_surround, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (effect_vbox), effect_lfe, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (effect_vbox), effect_upmix, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER(effect_frame), effect_vbox); - - // Create dualmono channel radio button. - - dualmono_vbox = gtk_vbox_new(FALSE, 0); - dualmono_channel1 = gtk_radio_button_new_with_label (NULL, "Play First channel"); - dualmono_channel2 = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(dualmono_channel1), "Play Second channel"); - - if (dualmono_channel == 1) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dualmono_channel1), TRUE); - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dualmono_channel2), TRUE); - - gtk_box_pack_start (GTK_BOX (dualmono_vbox), dualmono_channel1, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (dualmono_vbox), dualmono_channel2, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER(dualmono_frame), dualmono_vbox); - - // Create hbuttonbox for buttons. - - button_hbox = gtk_hbutton_box_new(); - - // Create cancel button. - - button_cancel = gtk_button_new_with_label ("Cancel"); - gtk_signal_connect_object (GTK_OBJECT (button_cancel), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (dialog)); - gtk_box_pack_start(GTK_BOX(button_hbox), button_cancel, TRUE, TRUE, 0); - - // Create apply button. - - button_apply = gtk_button_new_with_label ("Apply"); - gtk_signal_connect_object (GTK_OBJECT (button_apply), "clicked", - GTK_SIGNAL_FUNC (configure_apply), - GTK_OBJECT (dialog)); - gtk_box_pack_start(GTK_BOX(button_hbox), button_apply, TRUE, TRUE, 0); - - // Create ok button. - - button_ok = gtk_button_new_with_label ("Ok"); - gtk_signal_connect_object (GTK_OBJECT (button_ok), "clicked", - GTK_SIGNAL_FUNC (configure_ok), - GTK_OBJECT (dialog)); - gtk_box_pack_start(GTK_BOX(button_hbox), button_ok, TRUE, TRUE, 0); - - // Pack hbuttonbox into dialog. - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), - button_hbox, TRUE, TRUE,0); - - // Set tooltips. - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), drc_scale, - "Dynamic range compression is used to lower the\ - volume of loud sounds and increase the volume of\ - soft sounds.\nSet to 0.00 if you wish to disable this feature.", NULL); - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), drc_both, - "Boost the volume of soft sounds and reduce the volume\ - of loud sounds.", NULL); - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), drc_boost, - "Boost the volume of soft sounds, but leave loud sounds\ - unchanged.", NULL); - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), drc_reduce, - "Reduce the volume of loud sounds, but leave soft sounds\ - unchanged.", NULL); - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), dualmono_channel1, - "Dualmono tracks contain 2 seperate mono channels. Select\ - this option to play the first channels.", NULL); - - gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), dualmono_channel2, - "Dualmono tracks contain 2 seperate mono channels. Select\ - this option to play the second channels.", NULL); - - // Show all of the above. - - gtk_widget_show (hbox); - gtk_widget_show (vbox); - gtk_widget_show (vbox2); - gtk_widget_show (range_frame); - gtk_widget_show (drc_scale); - gtk_widget_show (drc_both); - gtk_widget_show (drc_boost); - gtk_widget_show (drc_reduce); - gtk_widget_show (drc_vbox); - gtk_widget_show (effect_frame); - gtk_widget_show (effect_surround); - gtk_widget_show (effect_lfe); - gtk_widget_show (effect_upmix); - gtk_widget_show (effect_vbox); - gtk_widget_show (dualmono_vbox); - gtk_widget_show (dualmono_channel1); - gtk_widget_show (dualmono_channel2); - gtk_widget_show (dualmono_frame); - gtk_widget_show (button_hbox); - gtk_widget_show (button_cancel); - gtk_widget_show (button_apply); - gtk_widget_show (button_ok); - gtk_widget_show (dialog); - gtk_widget_grab_focus (button_ok); -} - -static void configure_ok(GtkWidget * w, gpointer data) -{ - // Let configure_apply set and save compression_factor. - - configure_apply(NULL, NULL); - - // Close the window. - - gtk_widget_destroy(w); -} - -static void configure_apply(GtkWidget * w, gpointer data) -{ - GtkAdjustment *scale_adj; - ConfigDb *config; - - scale_adj = gtk_range_get_adjustment(GTK_RANGE(drc_scale)); - compression_factor = (gdouble) scale_adj->value; - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(drc_both)) == TRUE) - compression_type = DRC_BOTH; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(drc_boost)) == TRUE) - compression_type = DRC_BOOST; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(drc_reduce)) == TRUE) - compression_type = DRC_REDUCE; - - nodownmix_surround = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effect_surround)); - nodownmix_lfe = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effect_lfe)); - upmix_stereo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effect_upmix)); - requested_output = A52_STEREO; - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dualmono_channel1)) == TRUE) - dualmono_channel = 1; - else - dualmono_channel = 2; - - config = bmp_cfg_db_open(); - bmp_cfg_db_set_double(config, "xmms-a52dec", "compression_factor", - compression_factor); - bmp_cfg_db_set_int(config, "xmms-a52dec", "compression_type", - compression_type); - bmp_cfg_db_set_bool(config, "xmms-a52dec", "nodownmix_surround", - nodownmix_surround); - bmp_cfg_db_set_bool(config, "xmms-a52dec", "nodownmix_lfe", - nodownmix_lfe); - bmp_cfg_db_set_bool(config, "xmms-a52dec", "upmix_stereo", - upmix_stereo); - bmp_cfg_db_set_int(config, "xmms-a52dec", "requested_output", - requested_output); - bmp_cfg_db_close(config); -} - -void -info_a52 (char *filename) -{ - static GtkWidget *window; - static GtkWidget *button_ok; - static GtkWidget *hbox, *vbox, *label, *label2, *entry, *frame; - static char *temp_text, *label2_text, *temp, *temp_name; - VFSFile *temp_file; - int l_flags, l_sample_rate, l_bit_rate, l_frame_size, l_length; - int no_window = 0; - - if (!window) - no_window = 1; - - // Create window and set parameters. - - if (no_window) - { - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window); - gtk_window_set_default_size (GTK_WINDOW (window), 485, -1); - gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, TRUE); - gtk_container_border_width (GTK_CONTAINER (window), 5); - } - - temp = strrchr (filename, '/'); - if (!temp) - temp = filename; - else - temp++; - temp_name = malloc (strlen (temp) + 1); - strcpy (temp_name, temp); - *strrchr (temp_name, '.') = '\0'; - - sprintf(temp_text, "File Info - %s", temp_name); - gtk_window_set_title (GTK_WINDOW (window), temp_text); - - free(temp_name); - free(temp_text); - - // Create vbuttonbox for filename and fileinfo frame. - - if (no_window) - { - vbox = gtk_vbox_new(FALSE, 0); - - // Create label with a text entry containing filename. - - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8); - label = gtk_label_new ("Filename: "); - gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - entry = gtk_entry_new (); - gtk_widget_set_usize (entry, 400, -1); - gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); - } - gtk_entry_set_text (GTK_ENTRY(entry), filename); - - // Determine the song length from filesize. - - temp_file = vfs_fopen (filename, "r"); - - if (synchronise_a52(temp_file, &l_flags, &l_sample_rate, - &l_bit_rate, &l_frame_size) == -1) - { - l_length = -1; - return; - } - - vfs_fseek (temp_file, 0, SEEK_END); - - if ((l_length = vfs_ftell (temp_file)) == -1) - { - // Can't get file position - l_length = -1; - return; - } - - // Determine channel type. - - switch (l_flags & A52_CHANNEL_MASK) - { - case A52_CHANNEL: - sprintf(temp_text, "Channel"); - break; - case A52_MONO: - sprintf(temp_text, "Mono"); - break; - case A52_STEREO: - sprintf(temp_text, "Stereo"); - break; - case A52_3F: - sprintf(temp_text, "3 Front"); - break; - case A52_2F1R: - sprintf(temp_text, "2 Front 1 Rear"); - break; - case A52_3F1R: - sprintf(temp_text, "3 Front 1 Rear"); - break; - case A52_2F2R: - sprintf(temp_text, "2 Front 2 Rear"); - break; - case A52_3F2R: - sprintf(temp_text, "3 Front 2 Rear"); - break; - case A52_CHANNEL1: - sprintf(temp_text, "Channel1"); - break; - case A52_CHANNEL2: - sprintf(temp_text, "Channel2"); - break; - case A52_DOLBY: - sprintf(temp_text, "Dolby"); - break; - } - - // Create frame for file info. - - if (no_window) - { - frame = gtk_frame_new ("A/52 Info:"); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 8); - - // Create label inside frame. - - label2 = gtk_label_new (NULL); - gtk_container_add(GTK_CONTAINER(frame), label2); - gtk_misc_set_alignment (GTK_MISC (label2), 0, 0); - gtk_label_set_justify (GTK_LABEL(label2), GTK_JUSTIFY_LEFT); - - } - - // Set text of label inside frame. - - if (l_flags & A52_LFE) - sprintf(label2_text, "\n Bitrate: %d kb/s\n Samplerate: %d Hz\n Channel Type: %s\n Low Frequency Enhancement: Yes\n %d frames\n Filesize: %d B\n", - l_bit_rate / 1000, l_sample_rate, temp_text, l_length / l_frame_size, l_length); - else - sprintf(label2_text, "\n Bitrate: %d kb/s\n Samplerate: %d Hz\n Channel Type: %s\n Low Frequency Enhancement: No\n %d frames\n Filesize: %d B\n", - l_bit_rate / 1000, l_sample_rate, temp_text, l_length / l_frame_size, l_length); - - gtk_label_set_text (GTK_LABEL(label2), label2_text); - - if (no_window) - { - // Create ok button. - - button_ok = gtk_button_new_with_label ("Ok"); - gtk_signal_connect_object (GTK_OBJECT (button_ok), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (window)); - gtk_widget_set_usize (button_ok, 100, -1); - gtk_box_pack_start(GTK_BOX (vbox), button_ok, - TRUE, FALSE, 8); - - // Pack vbuttonbox into window. - - gtk_container_add (GTK_CONTAINER (window), vbox); - - // Show all of the above. - - gtk_widget_show (label2); - gtk_widget_show (label); - gtk_widget_show (entry); - gtk_widget_show (frame); - gtk_widget_show (hbox); - gtk_widget_show (button_ok); - gtk_widget_show (vbox); - gtk_widget_show (window); - gtk_widget_grab_focus (button_ok); - } -}
--- a/src/a52dec/a52dec.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* - * xmms-a52dec.h - * - * xmms-a52dec 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, or (at your option) - * any later version. - * - * xmms-a52dec 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -static char * a52dec_xpm[] = { -"400 50 83 1", -" c None", -". c #000000", -"+ c #555555", -"@ c #E2E2E2", -"# c #FFFFFF", -"$ c #8D8D8D", -"% c #AAAAAA", -"& c #1C1C1C", -"* c #717171", -"= c #383838", -"- c #999999", -"; c #666666", -"> c #333333", -", c #C6C6C6", -"' c #CCCCCC", -") c #D7D7D7", -"! c #525252", -"~ c #191919", -"{ c #4C4C4C", -"] c #EBEBEB", -"^ c #212121", -"/ c #080808", -"( c #494949", -"_ c #4B4B4B", -": c #323232", -"< c #8A8A8A", -"[ c #252525", -"} c #6B6B6B", -"| c #585858", -"1 c #B0B0B0", -"2 c #3B3B3B", -"3 c #424242", -"4 c #101010", -"5 c #8E8E8E", -"6 c #505050", -"7 c #6A6A6A", -"8 c #696969", -"9 c #9C9C9C", -"0 c #303030", -"a c #7E7E7E", -"b c #565656", -"c c #939393", -"d c #535353", -"e c #707070", -"f c #878787", -"g c #8F8F8F", -"h c #3E3E3E", -"i c #404040", -"j c #676767", -"k c #757575", -"l c #454545", -"m c #747474", -"n c #464646", -"o c #7B7B7B", -"p c #898989", -"q c #626262", -"r c #232323", -"s c #595959", -"t c #5B5B5B", -"u c #7A7A7A", -"v c #111111", -"w c #515151", -"x c #9D9D9D", -"y c #434343", -"z c #2B2B2B", -"A c #A5A5A5", -"B c #7F7F7F", -"C c #2A2A2A", -"D c #4A4A4A", -"E c #818181", -"F c #A8A8A8", -"G c #B1B1B1", -"H c #F5F5F5", -"I c #6F6F6F", -"J c #6D6D6D", -"K c #3A3A3A", -"L c #828282", -"M c #A2A2A2", -"N c #5F5F5F", -"O c #181818", -"P c #A9A9A9", -"Q c #D8D8D8", -"R c #C5C5C5", -"................................................................................................................................................................................................................................................................................................................................................................................................................", -"................................................................................................................................................................................................................................................................................................................................................................................................................", -"..................+@#$............+#+...........................................................................................................................................................................................................................................................................................................................................................................", -".................%####&..........+###*..........................................................................................................................................................................................................................................................................................................................................................................", -"...............&%#####$.........+#####+.........................................................................................................................................................................................................................................................................................................................................................................", -"..............$########=.......+#######+........................................................................................................................................................................................................................................................................................................................................................................", -"............+@#########%......+#########=....................-;-;-;-;-;-;-;-;;.-;-;-;-;-;-;-;-;;...>;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;->...............................................................................................................................................................................................................................................", -"..........=,############&....+##########@&...................################'.################'...>############################################################-...............................................................................................................................................................................................................................................", -".........+#######%@#####*...=####@,######,...................################'.################'...>#->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;#;...............................................................................................................................................................................................................................................", -"........%#####@*&.&#####@..+@###%&.$######+..................###';-;--#######'.########-;-;-###'...>#-........................................................>#-.........................................................................................................................................*%%%%%%%%%$....................&*%,#####%%+.............................&+%,#####,%+&.................", -"......=@####@*.....$#####*+####,....+#####@&.................###'......-#####'.######-......###'...>#;........................................................>#;.........................................................................................................................................###########=.................=,#############$&........................&$#############$&...............", -".....$####@*.......&##########@&.....+#####%.................###'.......-####'.#####;.......###'...>#-........................................................>#-........................................................................................................................................+###########$...............&%################@=......................&@###############@&..............", -"...&,####$..........,########@&.......+#####%................###'........-###'.####;........###'...>#;.....;-;-;->>....>-;-;>..;-;>....;-;-;-;>.;-;>..>;-;....>#;........................................................................................................................................,###########@..............&@###################+....................&@#################@..............", -"...*####,...........+########+.........+#####*...............###'........>###'.###'.........###'...>#-.....########;.;#######;.'##>....########;'##-..'##;....>#-.......................................................................................................................................&#############=............&@#####################&...................,###################*.............", -"....@####&...........@######+..........*######...............###'.........-##'.###-.........###'...>#;.....########'.'########.'##>....########->###.;###.....>#;.......................................................................................................................................*#############%............%######################,..................=########,++$########,.............", -"....&@###,...........*#####+..........+#####@+...............###'.........;##'.###>.........###'...>#-.....##'..>###>###>..'##>'##>....###..;##'.-##-'##;.....>#-.......................................................................................................................................,##############...........=###########,%%##########=.................%#######,....*########.............", -".....+####=..........&####+..........=#####@&................###'.........>##'.###..........###'...>#;.....##'...'##>##'...'##>'##>....###;--##;.>#####'......>#;......................................................................................................................................=#######@#######*..........,#########%&....*########,.................%%@#####+.....########.............", -"......+#)#@...........$##!..........&@####@&.................###'.........>##'.###..........###'...>#-.....##'...'##>##'...'##>'##>....########>..-####>......>#-......................................................................................................................................$#######$#######,.........&#########%.......+########=....................&++%.....&#######,.............", -"......~{{]#*..........=]{{^........&@####@&..................###'.........>##'.###..........###'...>#;.....##'...'##>##'...'##>'##>....###'''##-...###'.......>#;......................................................................................................................................@#######.########&........+########@.........,###,%+&..............................%#######*.............", -"...../{{{%#@&.{{{{.....({{_....:{{{<####@&...................###'.........;##'.###>.........###'...>#-.....##'...###>###...'##>'##>....###..>##'...'##>.......>#-.....................................................................................................................................=#######%.%#######*........%########$.........+*+...............................=+*@#######@..............", -".....[{{{}##$.{{{{.....{{{{/...|{{{1###)2{{{~................###'.........-##'.###;.........###'...>#;.....##'''####.####''###>'##''''>###'''##'...'##>.......>#;.....................................................................................................................................%#######+.+#######@........,########+...........................................%#########@&..............", -".....3{{{{)##&{{{{....4{{{{:...|{{{1##5{{{{{{/...............###'.........###'.###'.........###'...>#-.....########-.;#######-.'######>########-...'##>.......>#-.....................................................................................................................................########...########=.......#########............................................%########$................", -".....6{{7{8##9{{{{~...0{{7{{/..{{{{a#@{{bcb{{[...............###'........-###'.####;........###'...>#;.....''''''';...;-'''-;..-''''''>''''''';....-''>.......>#;....................................................................................................................................+#######,...%#######$.......#########............................................%########@$&..............", -".....d{beb{f#g{{{{h...i{{jk{l/4{{{{m@&b{{no7p=...............###'.......;####'.#####>.......###'...>#-........................................................>#-....................................................................................................................................,#######*...+########.......#########............................................###########@=.............", -".....{{q.o{{m{{b{{h..._{{rsb{l({b{{e&.<k{{{t=................###'......;#####'.######>......###'...>#;........................................................>#;...................................................................................................................................&########&...&########+......#########.....................%%%%%%%%%%%=...........############@&............", -"..../{{t.=7{{{bu{{3...d{b.vo{{{{g{{w..vtxkb{y~...............###'>>>>;'######'.#######';>>>>###'...>#-........................................................>#-...................................................................................................................................*#######@.....,#######,......#########.....................###########+...........+&.&*########%............", -"....z{{b..e7{bA9{{6../{{q..=p{{p@{{{....vtcB{{C..............################'.################'...>#;........................................................>#;...................................................................................................................................,#######$.....*########&.....,########=.........&@$=.......###########+................+########............", -"....D{{2...EFGH@{{|..:{{t...IFF@#7{{...C...(p{{^.............################'.################'...>############################################################-..................................................................................................................................=#######################*.....%########+.........*###@$+....###########+.................@#######+...........", -"...^{{{r..&@###@{{{./{{{b....@###J{{~.^{:~~~l{{_.............''''''''''''''''-.''''''''''''''''-...>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';..................................................................................................................................$#######################,.....*########%.........,#######*..###########+.................%#######+...........", -"...(ppp..&@###%.b{{.vcppK....&@##L{{h.D{{{{{{{b}...................................................................................................................................................................................................................................................@########################=....&#########&.......+########+..###########+.....=++$*.......%#######+...........", -"....===.=@###%..q{{/.r==v.....&@#M{{N.(Fpk777pcv..................................................................................................................................................................................................................................................=#########################$.....,########@&.....=@########...%%%%%%%%%%%=.&@#######.......@#######&...........", -".......+####$...}k7O...........=#@B7P+..=teee=................................................>>>>................................................................................................................................................................................................%#########################@.....=##########%+++%#########$.................@#######*.....*#######@............", -"......*####+....vtev............+#QR@#*......................>######-..........'##..........>'####-..........'#'........-#######'.........;##-...........'#'......................................................................................................................................###########################+.....,#######################&.................*########$&.&*########$............", -".....%###@=......................+#####%.....................>#######-.........'##.........>#######-.........'#'........;#######'.........'###>..........'#'.....................................................................................................................................+########$+++++++++$########%.....&@#####################*...................@####################&............", -"....%###@&........................*#####*....................>##;>;###>........'##.........-##-.>###.........'#'........>>>'##>>>........>####;..........'#'.....................................................................................................................................,########&..........#########......=####################%....................+###################+.............", -"...+####*...........&+.............%#####&...................>##>..;##;........'##.........##'...>>>.........'#'...........'##...........-##'#'..........'#'....................................................................................................................................&########,...........%########*......&@#################%......................+#################+..............", -"....@####*.........&@#%............+#####$...................>##>..>##-........'##.........##-..####>........'#'...........'##...........##-;##>.........'#'....................................................................................................................................*########$...........*########,.......&$##############@*........................=@#############@+...............", -"....&@####*.......=@###,&........&,######%...................>##>..;##;........'##.........##'..####>........'#'...........'##..........;##-;##-.........'#'....................................................................................................................................,########=...........&#########&........&*,#########,*&...........................*%#########,*.................", -".....&#####+.....+######@&......+@######%&...................>##>..'##;........'##.........'##>.>-##>........'#'...........'##..........-#######.........'#'................................................................................................................................................................................&+++++&..................................&+++++&....................", -"......+#####+...+########@&....$#######+.....................>##''###'.........'##.........;###''###>........'#'...........'##..........##''''##;........'##''''>...............................................................................................................................................................................................................................................", -".......+#####+.+##########@&&*@######@&......................>######'>.........'##..........-#######>........'#'...........'##.........;##;..>##-........'######>...............................................................................................................................................................................................................................................", -"........%#####%############@########%&.......................>;-;-;;...........;;-...........>-'-;;;>........;;;...........;;-.........;;-....;;-........;-;-;-;>...............................................................................................................................................................................................................................................", -".........%###########*&%###########%............................................................................................................................................................................................................................................................................................................................................................................", -"..........@#########+...%#########%.............................................................................................................................................................................................................................................................................................................................................................................", -"..........&@######@=.....%#######+..............................................................................................................................................................................................................................................................................................................................................................................", -"...........&#####@&.......%####@+...............................................................................................................................................................................................................................................................................................................................................................................", -"............+###@&........&@##%&................................................................................................................................................................................................................................................................................................................................................................................", -".............+#%&..........&,+..................................................................................................................................................................................................................................................................................................................................................................................", -"..............*.................................................................................................................................................................................................................................................................................................................................................................................................", -"................................................................................................................................................................................................................................................................................................................................................................................................................"}; - -
--- a/src/iris/3Dstuff.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include "iris.h" - - -void -bar_top_or_bottom (GLfloat height, xz * xz1, xz * xz2, xz * xz3, xz * xz4) -{ - glVertex3f (xz1->x, height, xz1->z); - glVertex3f (xz2->x, height, xz2->z); - glVertex3f (xz4->x, height, xz4->z); - glVertex3f (xz3->x, height, xz3->z); -} - - -void -bar_side (GLfloat height, xz * xz1, xz * xz2) -{ - glVertex3f (xz1->x, height, xz1->z); - glVertex3f (xz1->x, 0, xz1->z); - glVertex3f (xz2->x, 0, xz2->z); - - glVertex3f (xz2->x, height, xz2->z); -} - - -void -bar_full (GLfloat height, xz * xz1, xz * xz2, xz * xz3, xz * xz4) -{ - bar_top_or_bottom (height, xz1, xz2, xz3, xz4); - bar_side (height, xz1, xz2); - bar_side (height, xz3, xz4); - bar_side (height, xz1, xz2); - bar_side (height, xz3, xz4); -}
--- a/src/iris/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -OBJECTIVE_LIBS = libiris$(SHARED_SUFFIX) - -LIBDIR = $(plugindir)/$(VISUALIZATION_PLUGIN_DIR) - -LIBADD = $(GTK_LIBS) -lGL $(XXF86VM_LIBS) - -SOURCES = \ - 3Dstuff.c \ - color.c \ - config.c \ - iris.c \ - theme.c \ - theme_flash.c \ - theme_float.c \ - theme_fountain.c \ - theme_knot.c \ - theme_original.c \ - theme_pinwheel.c \ - theme_pipes.c \ - theme_pyramid.c \ - theme_spectrotoy.c \ - theme_spectrum.c \ - theme_squarefield.c \ - theme_waves.c \ - transition.c - -OBJECTS = ${SOURCES:.c=.o} - -CFLAGS += $(PICFLAGS) -D_REENTRANT $(GTK_CFLAGS) $(ARCH_DEFINES) -I../../intl -I../.. $(XXF86VM_CFLAGS) - -include ../../mk/objective.mk
--- a/src/iris/color.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include "iris.h" - -void -get_color (GLfloat * red, GLfloat * green, GLfloat * blue, GLfloat * signal) -{ - switch (config.color_mode) - { - case 0: - { - *red = config.color_red; - *green = config.color_green; - *blue = config.color_blue; - break; - } - case 1: - { - *red = - config.color1_red + - ((*signal) * (config.color2_red - config.color1_red)); - *green = - config.color1_green + - ((*signal) * (config.color2_green - config.color1_green)); - *blue = - config.color1_blue + - ((*signal) * (config.color2_blue - config.color1_blue)); - break; - } - case 2: - { - *red = 1.0 * rand () / (RAND_MAX + 1.0); - *green = 1.0 * rand () / (RAND_MAX + 1.0); - *blue = 1.0 * rand () / (RAND_MAX + 1.0); - break; - } - } -}
--- a/src/iris/config.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1289 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <gtk/gtk.h> -#include <audacious/configdb.h> -#include <GL/gl.h> -#include "iris.h" -#include "config.h" - -iris_config config; -iris_config newconfig; -GLWindow GLWin; - -static char section_name[] = "iris"; - -GtkWidget *config_window; - -GtkWidget *preview_color_one_color; -GtkWidget *preview_color_two_colors_1; -GtkWidget *preview_color_two_colors_2; -GtkWidget *preview_background; -GtkWidget *preview_flash; - -static GtkWidget *config_ctree; -static GtkWidget *config_notebook; -static gint config_page; - -static gboolean -check_cfg_version (ConfigDb * db) -{ - char *vstr; - - if (bmp_cfg_db_get_string (db, "iris", "version", &vstr)) - if (!strcmp (vstr, VERSION)) - return FALSE; - return TRUE; -} - - -void -iris_set_default_prefs (void) -{ - int i; - - for (i = 0; i < THEME_NUMBER; i++) - { - theme_config_global_default (i); - if (theme[i].config_default != NULL) - theme[i].config_default (); - } - - config.bgc_red = 0.0; - config.bgc_green = 0.0; - config.bgc_blue = 0.0; - - config.bgc_random = FALSE; - - config.color_red = 0.0; - config.color_green = 0.0; - config.color_blue = 1.0; - - config.color_random = TRUE; - - config.color1_red = 1.0; - config.color1_green = 0.0; - config.color1_blue = 0.0; - - config.color2_red = 0.0; - config.color2_green = 1.0; - config.color2_blue = 0.0; - - config.color12_random = TRUE; - - config.color_flash_red = 1.0; - config.color_flash_green = 1.0; - config.color_flash_blue = 1.0; - - config.color_mode = 1; - - config.color_beat = TRUE; - - config.flash_speed = 5; - - config.fps = 50; - - config.change_theme_on_beat = FALSE; - - config.fs_width = 640; - config.fs_height = 480; - - config.window_width = 640; - config.window_height = 480; - - config.fullscreen = FALSE; - - config.transition = TRUE; - config.trans_duration = 10.0; -} - - -void -iris_config_read (void) -{ - ConfigDb *db; - - db = bmp_cfg_db_open(); - - /* Check the config version string. If the string is too old, default values - * are installed. If the string returns NULL, iris has not been run before, - * and default values are installed. */ - if (check_cfg_version (db)) - { - printf("Bad iris plugin version detected in config, using default configuration\n"); - iris_set_default_prefs (); - } - else - { - int i; - - /* load config of all the theme */ - for (i = 0; i < THEME_NUMBER; i++) - { - theme_config_global_read (db, section_name, i); - if (theme[i].config_read != NULL) - theme[i].config_read (db, section_name); - } - - bmp_cfg_db_get_float (db, section_name, "bgc_red", &config.bgc_red); - bmp_cfg_db_get_float (db, section_name, "bgc_green", &config.bgc_green); - bmp_cfg_db_get_float (db, section_name, "bgc_blue", &config.bgc_blue); - bmp_cfg_db_get_bool (db, section_name, "bgc_random", &config.bgc_random); - bmp_cfg_db_get_float (db, section_name, "color_red", &config.color_red); - bmp_cfg_db_get_float (db, section_name, "color_green", &config.color_green); - bmp_cfg_db_get_float (db, section_name, "color_blue", &config.color_blue); - bmp_cfg_db_get_bool (db, section_name, "color_random", &config.color_random); - bmp_cfg_db_get_float (db, section_name, "color1_red", &config.color1_red); - bmp_cfg_db_get_float (db, section_name, "color1_green", &config.color1_green); - bmp_cfg_db_get_float (db, section_name, "color1_blue", &config.color1_blue); - bmp_cfg_db_get_float (db, section_name, "color2_red", &config.color2_red); - bmp_cfg_db_get_float (db, section_name, "color2_green", &config.color2_green); - bmp_cfg_db_get_float (db, section_name, "color2_blue", &config.color2_blue); - bmp_cfg_db_get_bool (db, section_name, "color12_random", &config.color12_random); - bmp_cfg_db_get_float (db, section_name, "color_flash_red", &config.color_flash_red); - bmp_cfg_db_get_float (db, section_name, "color_flash_green", &config.color_flash_green); - bmp_cfg_db_get_float (db, section_name, "color_flash_blue", &config.color_flash_blue); - bmp_cfg_db_get_int (db, section_name, "color_mode", &config.color_mode); - bmp_cfg_db_get_bool (db, section_name, "color_beat", &config.color_beat); - bmp_cfg_db_get_int (db, section_name, "flash_speed", &config.flash_speed); - bmp_cfg_db_get_int (db, section_name, "fps", &config.fps); - bmp_cfg_db_get_bool (db, section_name, "change_theme_on_beat", &config.change_theme_on_beat); - bmp_cfg_db_get_int (db, section_name, "fs_width", &config.fs_width); - bmp_cfg_db_get_int (db, section_name, "fs_height", &config.fs_height); - bmp_cfg_db_get_int (db, section_name, "window_width", &config.window_width); - bmp_cfg_db_get_int (db, section_name, "window_height", &config.window_height); - bmp_cfg_db_get_bool (db, section_name, "fullscreen", &config.fullscreen); - bmp_cfg_db_get_bool (db, section_name, "transition", &config.transition); - bmp_cfg_db_get_float (db, section_name, "trans_duration", &config.trans_duration); - } - bmp_cfg_db_close(db); -} - - -void -iris_config_write (iris_config * config) -{ - ConfigDb *db; - int i; - - db = bmp_cfg_db_open(); - - /* save config of all the theme */ - for (i = 0; i < THEME_NUMBER; i++) - { - theme_config_global_write (db, section_name, i); - if (theme[i].config_write != NULL) - theme[i].config_write (db, section_name); - } - - /* Save the current configuration in the "iris" section */ - bmp_cfg_db_set_string (db, section_name, "version", VERSION); - bmp_cfg_db_set_float (db, section_name, "bgc_red", config->bgc_red); - bmp_cfg_db_set_float (db, section_name, "bgc_green", config->bgc_green); - bmp_cfg_db_set_float (db, section_name, "bgc_blue", config->bgc_blue); - bmp_cfg_db_set_bool (db, section_name, "bgc_random", config->bgc_random); - bmp_cfg_db_set_float (db, section_name, "color_red", config->color_red); - bmp_cfg_db_set_float (db, section_name, "color_green", config->color_green); - bmp_cfg_db_set_float (db, section_name, "color_blue", config->color_blue); - bmp_cfg_db_set_bool (db, section_name, "color_random", config->color_random); - bmp_cfg_db_set_float (db, section_name, "color1_red", config->color1_red); - bmp_cfg_db_set_float (db, section_name, "color1_green", config->color1_green); - bmp_cfg_db_set_float (db, section_name, "color1_blue", config->color1_blue); - bmp_cfg_db_set_float (db, section_name, "color2_red", config->color2_red); - bmp_cfg_db_set_float (db, section_name, "color2_green", config->color2_green); - bmp_cfg_db_set_float (db, section_name, "color2_blue", config->color2_blue); - bmp_cfg_db_set_bool (db, section_name, "color12_random", config->color12_random); - bmp_cfg_db_set_float (db, section_name, "color_flash_red", config->color_flash_red); - bmp_cfg_db_set_float (db, section_name, "color_flash_green", config->color_flash_green); - bmp_cfg_db_set_float (db, section_name, "color_flash_blue", config->color_flash_blue); - bmp_cfg_db_set_int (db, section_name, "color_mode", config->color_mode); - bmp_cfg_db_set_bool (db, section_name, "color_beat", config->color_beat); - bmp_cfg_db_set_int (db, section_name, "flash_speed", config->flash_speed); - bmp_cfg_db_set_int (db, section_name, "fps", config->fps); - bmp_cfg_db_set_bool (db, section_name, "change_theme_on_beat", config->change_theme_on_beat); - bmp_cfg_db_set_int (db, section_name, "fs_width", config->fs_width); - bmp_cfg_db_set_int (db, section_name, "fs_height", config->fs_height); - bmp_cfg_db_set_int (db, section_name, "window_width", config->window_width); - bmp_cfg_db_set_int (db, section_name, "window_height", config->window_height); - bmp_cfg_db_set_bool (db, section_name, "fullscreen", config->fullscreen); - bmp_cfg_db_set_bool (db, section_name, "transition", config->transition); - bmp_cfg_db_set_float (db, section_name, "trans_duration", config->trans_duration); - - /* write out the XMMS config file */ - bmp_cfg_db_close(db); -} - - -static void -set_color_preview (GLfloat red, GLfloat green, GLfloat blue, - GtkWidget * preview) -{ - unsigned int a; - guchar buf[3 * 32]; - char r, g, b; - char s[3]; - - // how to convert a float into a char ? - sprintf (s, "%.0f", red * 255); - r = (unsigned char) atoi (s); - sprintf (s, "%.0f", green * 255); - g = (unsigned char) atoi (s); - sprintf (s, "%.0f", blue * 255); - b = (unsigned char) atoi (s); - - for (a = 0; a < 32; a++) - { - buf[3 * a] = (char) r; - buf[3 * a + 1] = (char) g; - buf[3 * a + 2] = (char) b; - } - - for (a = 0; a < 16; a++) - gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, a, 32); - - gtk_widget_draw (preview, NULL); -} - - -static void -csel_ok (GtkWidget * w, GtkWidget * csel) -{ - gdouble a[3]; - - gtk_color_selection_get_color (GTK_COLOR_SELECTION - (GTK_COLOR_SELECTION_DIALOG (csel)-> - colorsel), &a[0]); - - gtk_widget_destroy (csel); -} - - -static void -csel_ok2 (GtkWidget * csel, gpointer data) -{ - gdouble a[3]; - - gtk_color_selection_get_color (GTK_COLOR_SELECTION - (GTK_COLOR_SELECTION_DIALOG (csel)-> - colorsel), &a[0]); - - switch ((int) data) - { - case 0: - { - newconfig.color_red = (GLfloat) a[0]; - newconfig.color_green = (GLfloat) a[1]; - newconfig.color_blue = (GLfloat) a[2]; - set_color_preview (newconfig.color_red, newconfig.color_green, - newconfig.color_blue, preview_color_one_color); - break; - } - case 1: - { - newconfig.color1_red = (GLfloat) a[0]; - newconfig.color1_green = (GLfloat) a[1]; - newconfig.color1_blue = (GLfloat) a[2]; - set_color_preview (newconfig.color1_red, newconfig.color1_green, - newconfig.color1_blue, preview_color_two_colors_1); - break; - } - case 2: - { - newconfig.color2_red = (GLfloat) a[0]; - newconfig.color2_green = (GLfloat) a[1]; - newconfig.color2_blue = (GLfloat) a[2]; - set_color_preview (newconfig.color2_red, newconfig.color2_green, - newconfig.color2_blue, preview_color_two_colors_2); - break; - } - case 3: - { - newconfig.bgc_red = (GLfloat) a[0]; - newconfig.bgc_green = (GLfloat) a[1]; - newconfig.bgc_blue = (GLfloat) a[2]; - set_color_preview (newconfig.bgc_red, newconfig.bgc_green, - newconfig.bgc_blue, preview_background); - break; - } - case 4: - { - newconfig.color_flash_red = (GLfloat) a[0]; - newconfig.color_flash_green = (GLfloat) a[1]; - newconfig.color_flash_blue = (GLfloat) a[2]; - set_color_preview (newconfig.color_flash_red, - newconfig.color_flash_green, - newconfig.color_flash_blue, preview_flash); - break; - } - } - - gtk_widget_destroy (csel); -} - - -static void -apply_clicked (void) -{ - gint i; - - memcpy (&config, &newconfig, sizeof (iris_config)); - for (i = 0; i < THEME_NUMBER; i++) - { - memcpy (theme[i].config->global, theme[i].config_new->global, - sizeof (config_global)); - theme_config_apply (i); - } -} - - -static void -cancel_clicked (GtkWidget * w, GtkWidget * window) -{ - gtk_widget_destroy (window); - config_window = NULL; -} - - -static void -csel_deleteevent (GtkWidget * w, GtkWidget * csel) -{ - gtk_widget_destroy (csel); -} - - -static void -ok_clicked (GtkWidget * w, GtkWidget * window) -{ - apply_clicked (); - iris_config_write (&newconfig); - cancel_clicked (w, window); -} - - -static void -color_clicked (GtkWidget * w, gpointer data) -{ - GtkWidget *csel; - gdouble a[3]; - - switch ((int) data) - { - case 0: - { - a[0] = (gdouble) newconfig.color_red; - a[1] = (gdouble) newconfig.color_green; - a[2] = (gdouble) newconfig.color_blue; - break; - } - case 1: - { - a[0] = (gdouble) newconfig.color1_red; - a[1] = (gdouble) newconfig.color1_green; - a[2] = (gdouble) newconfig.color1_blue; - break; - } - case 2: - { - a[0] = (gdouble) newconfig.color2_red; - a[1] = (gdouble) newconfig.color2_green; - a[2] = (gdouble) newconfig.color2_blue; - break; - } - case 3: - { - a[0] = (gdouble) newconfig.bgc_red; - a[1] = (gdouble) newconfig.bgc_green; - a[2] = (gdouble) newconfig.bgc_blue; - break; - } - case 4: - { - a[0] = (gdouble) newconfig.color_flash_red; - a[1] = (gdouble) newconfig.color_flash_green; - a[2] = (gdouble) newconfig.color_flash_blue; - break; - } - } - - csel = gtk_color_selection_dialog_new ("Please choose a color"); - /*gtk_window_set_modal (GTK_WINDOW - (&(GTK_COLOR_SELECTION_DIALOG (csel)->window)), TRUE); - gtk_window_set_transient_for (GTK_WINDOW - (& - (GTK_COLOR_SELECTION_DIALOG (csel)->window)), - GTK_WINDOW (config_window)); */ - gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (csel)->help_button); - gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (csel)->cancel_button); - gtk_color_selection_set_color (GTK_COLOR_SELECTION - (GTK_COLOR_SELECTION_DIALOG (csel)-> - colorsel), &a[0]); - gtk_widget_show (csel); - - gtk_signal_connect (GTK_OBJECT - (GTK_COLOR_SELECTION_DIALOG (csel)->ok_button), - "clicked", GTK_SIGNAL_FUNC (csel_ok), csel); - gtk_signal_connect (GTK_OBJECT (csel), "delete_event", - GTK_SIGNAL_FUNC (csel_deleteevent), csel); - gtk_signal_connect (GTK_OBJECT (csel), "destroy", - GTK_SIGNAL_FUNC (csel_ok2), data); -} - - -void -colormode_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.color_mode = (unsigned int) data; -} - - -void -colorbeat_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.color_beat = !newconfig.color_beat; -} - - -void -theme_beat_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.change_theme_on_beat = !newconfig.change_theme_on_beat; -} - - -void -color_random_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.color_random = !newconfig.color_random; -} - - -void -color12_random_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.color12_random = !newconfig.color12_random; -} - - -void -bgc_random_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.bgc_random = !newconfig.bgc_random; -} - - -void -wireframe_toggled (GtkWidget * widget, gpointer * data) -{ - newconfig.wireframe = !newconfig.wireframe; -} - - -void -fullscreen_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.fullscreen = !newconfig.fullscreen; -} - -void -transition_toggled (GtkWidget * widget, gpointer data) -{ - newconfig.transition = !newconfig.transition; -} - -static void -combo_fs_activated (GtkWidget * widget, gpointer data) -{ - sscanf (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (data)->entry)), "%dx%d", - &newconfig.fs_width, &newconfig.fs_height); -} - - -static void -value_flash_speed (GtkAdjustment * adj) -{ - newconfig.flash_speed = (int) adj->value; -} - -static void -value_trans_duration (GtkAdjustment * adj) -{ - newconfig.trans_duration = (int) adj->value; -} - -static void -conf_closed (GtkWidget * w, GdkEvent * e, GtkWidget ** window) -{ - gtk_widget_destroy (*window); - *window = NULL; -} - - -static void -priority_value_changed (GtkAdjustment * adj, gint i) -{ - theme[i].config_new->global->priority = adj->value / 100.0; -} - - -static void -create_config_color (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - GSList *group; - - GtkWidget *radio_button_one_color; - GtkWidget *button_color_one_color; - // GtkWidget *preview_color_one_color; must be static - - GtkWidget *radio_button_two_colors; - GtkWidget *button_color_two_colors_1; - GtkWidget *button_color_two_colors_2; - // GtkWidget *preview_color_two_colors_1; must be static - // GtkWidget *preview_color_two_colors_2; must be static - - GtkWidget *check_button; - - GtkWidget *hseparator; - - GtkWidget *label; - GtkWidget *button_background; - // GtkWidget *preview_background; static - - frame = gtk_frame_new ("color"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 0); - vbox = gtk_vbox_new (TRUE, 2); - gtk_container_add (GTK_CONTAINER (frame), vbox); - - /* the first hbox: a radio button and a color selection/preview button */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 8); - - radio_button_one_color = - gtk_radio_button_new_with_label (NULL, "one color"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_one_color, FALSE, FALSE, - 4); - gtk_widget_set_usize (radio_button_one_color, 100, 20); - gtk_widget_show (radio_button_one_color); - - button_color_one_color = gtk_button_new (); - gtk_box_pack_start (GTK_BOX (hbox), button_color_one_color, FALSE, FALSE, - 4); - gtk_widget_show (button_color_one_color); - preview_color_one_color = gtk_preview_new (GTK_PREVIEW_COLOR); - gtk_preview_size (GTK_PREVIEW (preview_color_one_color), 32, 16); - gtk_widget_show (preview_color_one_color); - gtk_container_add (GTK_CONTAINER (button_color_one_color), - preview_color_one_color); - set_color_preview (newconfig.color_red, newconfig.color_green, - newconfig.color_blue, preview_color_one_color); - gtk_widget_set_usize (button_color_one_color, 50, 20); - gtk_signal_connect (GTK_OBJECT (button_color_one_color), "clicked", - GTK_SIGNAL_FUNC (color_clicked), (gpointer) 0); - - /* the second hbox: a radio button and two color selection/preview buttons */ - - hbox = gtk_hbox_new (FALSE, 3); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 8); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button_one_color)); - radio_button_two_colors = - gtk_radio_button_new_with_label (group, "two colors"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button_two_colors), - TRUE); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_two_colors, FALSE, FALSE, - 4); - gtk_widget_set_usize (radio_button_two_colors, 100, 20); - gtk_widget_show (radio_button_two_colors); - - button_color_two_colors_1 = gtk_button_new (); - gtk_box_pack_start (GTK_BOX (hbox), button_color_two_colors_1, FALSE, FALSE, - 4); - gtk_widget_show (button_color_two_colors_1); - preview_color_two_colors_1 = gtk_preview_new (GTK_PREVIEW_COLOR); - gtk_preview_size (GTK_PREVIEW (preview_color_two_colors_1), 32, 16); - gtk_widget_show (preview_color_two_colors_1); - gtk_container_add (GTK_CONTAINER (button_color_two_colors_1), - preview_color_two_colors_1); - set_color_preview (newconfig.color1_red, newconfig.color1_green, - newconfig.color1_blue, preview_color_two_colors_1); - gtk_widget_set_usize (button_color_two_colors_1, 50, 20); - - gtk_signal_connect (GTK_OBJECT (button_color_two_colors_1), "clicked", - GTK_SIGNAL_FUNC (color_clicked), (gpointer) 1); - - button_color_two_colors_2 = gtk_button_new (); - gtk_box_pack_start (GTK_BOX (hbox), button_color_two_colors_2, FALSE, FALSE, - 4); - gtk_widget_show (button_color_two_colors_2); - preview_color_two_colors_2 = gtk_preview_new (GTK_PREVIEW_COLOR); - gtk_preview_size (GTK_PREVIEW (preview_color_two_colors_2), 32, 16); - gtk_widget_show (preview_color_two_colors_2); - gtk_container_add (GTK_CONTAINER (button_color_two_colors_2), - preview_color_two_colors_2); - set_color_preview (newconfig.color2_red, newconfig.color2_green, - newconfig.color2_blue, preview_color_two_colors_2); - gtk_widget_set_usize (button_color_two_colors_2, 50, 20); - - gtk_signal_connect (GTK_OBJECT (button_color_two_colors_2), "clicked", - GTK_SIGNAL_FUNC (color_clicked), (gpointer) 2); - - switch (newconfig.color_mode) - { - case 0: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_one_color), TRUE); - break; - } - case 1: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_two_colors), TRUE); - } - } - - gtk_signal_connect (GTK_OBJECT (radio_button_one_color), "toggled", - GTK_SIGNAL_FUNC (colormode_toggled), (gpointer) 0); - gtk_signal_connect (GTK_OBJECT (radio_button_two_colors), "toggled", - GTK_SIGNAL_FUNC (colormode_toggled), (gpointer) 1); - - check_button = gtk_check_button_new_with_label ("Random on beat"); - gtk_widget_show (check_button); - gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), - newconfig.color12_random); - gtk_signal_connect (GTK_OBJECT (check_button), "toggled", - GTK_SIGNAL_FUNC (color12_random_toggled), NULL); - - hseparator = gtk_hseparator_new (); - gtk_widget_show (hseparator); - gtk_box_pack_start (GTK_BOX (vbox), hseparator, FALSE, FALSE, 4); - - /* the third hbox: a color selection/preview button */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Background color"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - button_background = gtk_button_new (); - gtk_box_pack_start (GTK_BOX (hbox), button_background, FALSE, FALSE, 4); - gtk_widget_show (button_background); - preview_background = gtk_preview_new (GTK_PREVIEW_COLOR); - gtk_preview_size (GTK_PREVIEW (preview_background), 32, 16); - gtk_widget_show (preview_background); - gtk_container_add (GTK_CONTAINER (button_background), preview_background); - set_color_preview (newconfig.bgc_red, newconfig.bgc_green, - newconfig.bgc_blue, preview_background); - gtk_widget_set_usize (button_background, 50, 20); - - gtk_signal_connect (GTK_OBJECT (button_background), "clicked", - GTK_SIGNAL_FUNC (color_clicked), (gpointer) 3); - - check_button = gtk_check_button_new_with_label ("Random on beat"); - gtk_widget_show (check_button); - gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), - newconfig.bgc_random); - gtk_signal_connect (GTK_OBJECT (check_button), "toggled", - GTK_SIGNAL_FUNC (bgc_random_toggled), NULL); -/* - check_button = gtk_check_button_new_with_label ("Wireframe"); - gtk_widget_show (check_button); - gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), - newconfig.wireframe); - gtk_signal_connect (GTK_OBJECT (check_button), "toggled", - GTK_SIGNAL_FUNC (wireframe_toggled), NULL); -*/ - /* end */ - -} - - -static void -create_config_beat (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - - GtkWidget *button_beat; - GtkWidget *button_theme_beat; - - GtkWidget *label; - GtkWidget *button_flash; - GtkWidget *preview_flash; - - GtkObject *adjustment; - GtkWidget *hscale; - - frame = gtk_frame_new ("beat"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 0); - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (frame), vbox); - - /* the first hbox: two buttons */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button_beat = gtk_check_button_new_with_label ("Flash on beat"); - gtk_widget_show (button_beat); - gtk_box_pack_start (GTK_BOX (hbox), button_beat, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_beat), - newconfig.color_beat); - gtk_signal_connect (GTK_OBJECT (button_beat), "toggled", - GTK_SIGNAL_FUNC (colorbeat_toggled), NULL); - - button_theme_beat = - gtk_check_button_new_with_label ("Change theme on beat"); - gtk_widget_show (button_theme_beat); - gtk_box_pack_start (GTK_BOX (hbox), button_theme_beat, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_theme_beat), - newconfig.change_theme_on_beat); - gtk_signal_connect (GTK_OBJECT (button_theme_beat), "toggled", - GTK_SIGNAL_FUNC (theme_beat_toggled), NULL); - - /* the second hbox: a label and a color selection/preview button */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Flash color"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - button_flash = gtk_button_new (); - gtk_box_pack_start (GTK_BOX (hbox), button_flash, FALSE, FALSE, 4); - gtk_widget_show (button_flash); - preview_flash = gtk_preview_new (GTK_PREVIEW_COLOR); - gtk_preview_size (GTK_PREVIEW (preview_flash), 32, 16); - gtk_widget_show (preview_flash); - gtk_container_add (GTK_CONTAINER (button_flash), preview_flash); - set_color_preview (newconfig.color_flash_red, newconfig.color_flash_green, - newconfig.color_flash_blue, preview_flash); - gtk_widget_set_usize (button_flash, 50, 20); - gtk_signal_connect (GTK_OBJECT (button_flash), "clicked", - GTK_SIGNAL_FUNC (color_clicked), (gpointer) 4); - - /* the third hbox: a label and a horizontal scale */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Flash duration (in frames)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = gtk_adjustment_new (newconfig.flash_speed, 1, 50, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_LEFT); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_flash_speed), NULL); - - label = - gtk_label_new - ("Image are drawn at a rate of 50 frames per second.\n So a flash of 50 frames lasts 1 second."); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); -} - - -static void -create_config_fs (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - - GtkWidget *button_fs; - GtkWidget *combobox_fs; - - GtkWidget *label; - - char str[10]; - - frame = gtk_frame_new ("fullscreen"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 0); - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (frame), vbox); - - /* the first hbox: a button */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button_fs = gtk_check_button_new_with_label ("Start in fullscreen mode"); - gtk_widget_show (button_fs); - gtk_box_pack_start (GTK_BOX (hbox), button_fs, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_fs), - newconfig.fullscreen); - gtk_signal_connect (GTK_OBJECT (button_fs), "toggled", - GTK_SIGNAL_FUNC (fullscreen_toggled), NULL); - - /* the second hbox: a label combobox */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Fullscreen resolution"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - combobox_fs = gtk_combo_new (); - - gtk_combo_set_popdown_strings (GTK_COMBO (combobox_fs), GLWin.glist); - - gtk_box_pack_start (GTK_BOX (hbox), combobox_fs, FALSE, FALSE, 4); - gtk_widget_show (combobox_fs); - - gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combobox_fs)->entry), "changed", - GTK_SIGNAL_FUNC (combo_fs_activated), combobox_fs); - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combobox_fs)->entry), FALSE); - sprintf (str, "%dx%d", newconfig.fs_width, newconfig.fs_height); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combobox_fs)->entry), str); - - label = gtk_label_new - ("Use the f key in the GL window\nto switch to fullscreen and back.\n\ -Use the esc key to quit the plugin.\n\ -\n\ -If you use the sawfish window manager,\n\ -you may have problem going fullscreen.\n\ -In this case, switch to a console and\n\ -type \'killall xmms\'."); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); -} - -static void -create_config_transition (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - - GtkWidget *button_ts; - GtkWidget *label; - - GtkObject *adjustment; - GtkWidget *hscale; - - frame = gtk_frame_new ("transition"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 0); - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (frame), vbox); - - /* the first hbox: a button */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button_ts = - gtk_check_button_new_with_label ("Use transitions on theme change"); - gtk_widget_show (button_ts); - gtk_box_pack_start (GTK_BOX (hbox), button_ts, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_ts), - newconfig.transition); - gtk_signal_connect (GTK_OBJECT (button_ts), "toggled", - GTK_SIGNAL_FUNC (transition_toggled), NULL); - - label = gtk_label_new ("Chooses a random transition for now"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - /* the second hbox: a label and a horizontal scale */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Transition duration (in miliseconds)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (newconfig.trans_duration, 1.0, 50.0, 1.0, 1.0, 1.0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_LEFT); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_trans_duration), NULL); -} - -static void -create_config_glx_info (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - - GtkWidget *label; - - frame = gtk_frame_new ("GLX informations"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 0); - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (frame), vbox); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - if (GLWin.ctx == NULL) - { - label = gtk_label_new ("Launch the plugin and reopen the configure window to see\n\ -informations about your GL setup."); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - } - else - { - char *string; - string = g_strconcat ("GLX version: ", g_strdup_printf ("%d.%d", GLWin.glxMajorVersion, GLWin.glxMinorVersion), NULL); - label = gtk_label_new (string); - free(string); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - if (GLWin.DRI) - string = g_strconcat ("Use DRI: ", "yes", NULL); - else - string = g_strconcat ("Use DRI: ", "no", NULL); - label = gtk_label_new (string); - free(string); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - if (GLWin.DoubleBuffered) - string = g_strconcat ("Double buffered rendering: ", "yes", NULL); - else - string = g_strconcat ("Double buffered rendering: : ", "no", NULL); - label = gtk_label_new (string); - free(string); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - } -} - -static void -create_config_theme (GtkWidget * vbox_container) -{ - GtkWidget *frame; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *label; - gint i, y; - - frame = gtk_frame_new ("Themes priorities"); - gtk_box_pack_start (GTK_BOX (vbox_container), frame, TRUE, TRUE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_container_add (GTK_CONTAINER (frame), hbox); - - table = gtk_table_new (2, THEME_NUMBER, FALSE); - gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 12); - - for (i = 0, y = 0; i < THEME_NUMBER; i++) - { - GtkObject *adjustment; - GtkWidget *hscale; - - label = gtk_label_new (theme[i].name); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, y, y + 1, GTK_EXPAND, - 0, 0, 8); - adjustment = - gtk_adjustment_new (theme[i].config->global->priority * 100.0, 0.0, - 100.0, 1.0, 10.0, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_LEFT); - gtk_table_attach (GTK_TABLE (table), hscale, 1, 2, y, y + 1, - GTK_EXPAND | GTK_FILL, 0, 0, 8); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (priority_value_changed), - (void *) i); - - y++; - } - - gtk_widget_show (frame); -} - - -static void -cb_select_monitor_config (GtkWidget * ctree, GtkCTreeNode * node) -{ - gint row; - - if (!GTK_CLIST (ctree)->selection) - return; - row = - GPOINTER_TO_INT (gtk_ctree_node_get_row_data (GTK_CTREE (ctree), node)); - gtk_notebook_set_page (GTK_NOTEBOOK (config_notebook), row); -} - - -static GtkWidget * -create_config_page (GtkNotebook * notebook, gchar * text, GtkCTree * ctree, - GtkCTreeNode * node_parent, GtkCTreeNode ** node_result) -{ - GtkWidget *vbox; - GtkCTreeNode *node; - gchar *title[1] = { text }; - - vbox = gtk_vbox_new (FALSE, 0); - node = gtk_ctree_insert_node (ctree, node_parent, NULL, title, 0, - NULL, NULL, NULL, NULL, FALSE, FALSE); - gtk_ctree_node_set_row_data (ctree, node, GINT_TO_POINTER (config_page++)); - gtk_notebook_append_page (notebook, vbox, NULL); - if (node_result) - *node_result = node; - return vbox; -} - - -void -iris_first_init (void) -{ - static gboolean init; - int i; - - if (!init) - { - theme_register (); - theme_config_init (); - /* here we collect information about resolutions supported by the display */ - /* get a connection */ - GLWin.dpy = XOpenDisplay (0); - GLWin.screen = DefaultScreen (GLWin.dpy); - XF86VidModeQueryVersion (GLWin.dpy, &GLWin.vidModeMajorVersion, - &GLWin.vidModeMinorVersion); - XF86VidModeGetAllModeLines (GLWin.dpy, GLWin.screen, &GLWin.modeNum, - &GLWin.modes); - /* save desktop-resolution before switching modes */ - GLWin.deskMode = *(GLWin.modes[0]); - - /* fill an array of string for the config combo box */ - for (i = 0; i < GLWin.modeNum; i++) - GLWin.glist = - g_list_append (GLWin.glist, - g_strdup_printf ("%dx%d", GLWin.modes[i]->hdisplay, - GLWin.modes[i]->vdisplay)); - - init = TRUE; - XCloseDisplay (GLWin.dpy); - } -} - -void -iris_configure (void) -{ - GtkWidget *config_vbox; - - GtkWidget *vbox, *buttonbox, *ok, *apply, *cancel; - GtkWidget *config_hbox; - GtkWidget *config_scrolled; - - gchar *title[1] = { "iris config" }; - GtkCTreeNode *node; - GtkCTreeNode *node_themes; - gint i; - - if (config_window) - return; - config_page = 0; - - iris_first_init (); - iris_config_read (); - memcpy (&newconfig, &config, sizeof (iris_config)); - - config_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (config_window), "delete_event", - GTK_SIGNAL_FUNC (conf_closed), &config_window); - gtk_container_set_border_width (GTK_CONTAINER (config_window), 6); - gtk_window_set_title (GTK_WINDOW (config_window), "iris configuration"); - - config_hbox = gtk_hbox_new (FALSE, 4); - gtk_container_add (GTK_CONTAINER (config_window), config_hbox); - - config_scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (config_scrolled), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start (GTK_BOX (config_hbox), config_scrolled, TRUE, TRUE, 0); - - config_vbox = gtk_vbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (config_hbox), config_vbox, TRUE, TRUE, 0); - - config_ctree = gtk_ctree_new_with_titles (1, 0, title); - gtk_ctree_set_indent (GTK_CTREE (config_ctree), 16); - gtk_clist_column_titles_passive (GTK_CLIST (config_ctree)); - gtk_widget_set_usize (config_ctree, 150, 0); - gtk_container_add (GTK_CONTAINER (config_scrolled), config_ctree); - gtk_signal_connect (GTK_OBJECT (config_ctree), "tree_select_row", - (GtkSignalFunc) cb_select_monitor_config, NULL); - config_notebook = gtk_notebook_new (); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (config_notebook), FALSE); - gtk_box_pack_start (GTK_BOX (config_vbox), config_notebook, TRUE, TRUE, 0); - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), "Color", - GTK_CTREE (config_ctree), NULL, &node); - create_config_color (vbox); - gtk_ctree_select (GTK_CTREE (config_ctree), node); - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), "Beat", - GTK_CTREE (config_ctree), NULL, NULL); - create_config_beat (vbox); - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), - "Transition", GTK_CTREE (config_ctree), - NULL, NULL); - create_config_transition (vbox); - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), - "Fullscreen", GTK_CTREE (config_ctree), - NULL, NULL); - create_config_fs (vbox); - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), "Themes", - GTK_CTREE (config_ctree), NULL, &node_themes); - create_config_theme (vbox); - - for (i = 0; i < THEME_NUMBER; i++) - { - GtkWidget *tabs; - GtkWidget *vbox_1, *vbox_2, *vbox_3; - GtkWidget *label; - vbox = - create_config_page (GTK_NOTEBOOK (config_notebook), - theme[i].name, - GTK_CTREE (config_ctree), node_themes, &node); - - tabs = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (vbox), tabs, TRUE, TRUE, 4); - - /* first tab : global conf tab */ - vbox_1 = gtk_vbox_new (FALSE, 0); - gtk_container_border_width (GTK_CONTAINER (vbox_1), 0); - theme_config_global_widgets (vbox_1, i); - - label = gtk_label_new ("global settings"); - gtk_notebook_append_page (GTK_NOTEBOOK (tabs), vbox_1, label); - - /* second tab : specific theme tab */ - if (theme[i].config_create != NULL) - { - vbox_2 = gtk_vbox_new (FALSE, 2); - theme[i].config_create (vbox_2); - - label = gtk_label_new ("theme settings"); - gtk_notebook_append_page (GTK_NOTEBOOK (tabs), vbox_2, label); - } - - /* third tab : info tab */ - vbox_3 = gtk_vbox_new (FALSE, 0); - gtk_container_border_width (GTK_CONTAINER (vbox_3), 0); - theme_about (vbox_3, i); - - label = gtk_label_new ("theme info"); - gtk_notebook_append_page (GTK_NOTEBOOK (tabs), vbox_3, label); - - } - - vbox = create_config_page (GTK_NOTEBOOK (config_notebook), - "GLX infos", GTK_CTREE (config_ctree), - NULL, NULL); - create_config_glx_info (vbox); - - // vbox = create_config_page(GTK_NOTEBOOK(config_notebook), _("About"), - // GTK_CTREE(config_ctree), NULL, NULL); - // create_config_about(vbox); - - /* this is the box where are Ok, Cancel and Apply */ - buttonbox = gtk_hbutton_box_new (); - gtk_box_pack_end (GTK_BOX (config_vbox), buttonbox, FALSE, FALSE, 8); - gtk_hbutton_box_set_layout_default (GTK_BUTTONBOX_END); - gtk_widget_show (buttonbox); - - ok = gtk_button_new_with_label ("Quit\nand save"); - GTK_WIDGET_SET_FLAGS (ok, GTK_CAN_DEFAULT); - gtk_box_pack_end (GTK_BOX (buttonbox), ok, FALSE, FALSE, 8); - gtk_widget_show (ok); - - cancel = gtk_button_new_with_label ("Quit\nwithout saving"); - GTK_WIDGET_SET_FLAGS (cancel, GTK_CAN_DEFAULT); - gtk_box_pack_end (GTK_BOX (buttonbox), cancel, FALSE, FALSE, 8); - gtk_widget_show (cancel); - - apply = gtk_button_new_with_label ("Apply"); - GTK_WIDGET_SET_FLAGS (apply, GTK_CAN_DEFAULT); - gtk_box_pack_end (GTK_BOX (buttonbox), apply, FALSE, FALSE, 8); - gtk_widget_show (apply); - - gtk_window_set_default (GTK_WINDOW (config_window), ok); - - gtk_signal_connect (GTK_OBJECT (cancel), "clicked", - GTK_SIGNAL_FUNC (cancel_clicked), config_window); - gtk_signal_connect (GTK_OBJECT (ok), "clicked", - GTK_SIGNAL_FUNC (ok_clicked), config_window); - gtk_signal_connect (GTK_OBJECT (apply), "clicked", - GTK_SIGNAL_FUNC (apply_clicked), config_window); - - gtk_widget_show_all (config_window); -} - -/* -** Saves all window attributes (goal) -** saves only non-fullscreen window sizes for now -** ADDME : window position -*/ -void -iris_save_window_attributes (void) -{ - XWindowAttributes attr; - if (!GLWin.fs) - { - XGetWindowAttributes (GLWin.dpy, GLWin.window, &attr); - config.window_width = attr.width; - config.window_height = attr.height; - iris_config_write (&config); - } -}
--- a/src/iris/config.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the <GL/glx.h> header file. */ -#define HAVE_GL_GLX_H 1 - -/* Define to 1 if you have the <GL/gl.h> header file. */ -#define HAVE_GL_GL_H 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Name of package */ -#define PACKAGE "Iris" - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Iris OpenGL XMMS Visualization" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Iris OpenGL XMMS Visualization" - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.12" - -/* Define to 1 if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING
--- a/src/iris/iris.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1025 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include "config.h" - -#include <X11/Xlib.h> -#include <X11/keysym.h> -#include <gtk/gtk.h> -#include <math.h> - -#include <GL/gl.h> -#include <GL/glx.h> -#include <X11/extensions/xf86vmode.h> -#include <pthread.h> -#ifdef HAVE_SCHED_SETSCHEDULER -#include <sched.h> -#endif -#include <stdlib.h> -#include <sys/time.h> -#include <unistd.h> - -#include <audacious/plugin.h> -#include <audacious/util.h> -#include <audacious/beepctrl.h> -#include <audacious/configdb.h> -#include "iris.h" - -#define BEAT_MAX 100 - -GLfloat y_angle = 45.0, y_speed = 0.5; -GLfloat x_angle = 20.0, x_speed = 0.0; -GLfloat z_angle = 0.0, z_speed = 0.0; -static GLfloat scale; -static GLfloat x_angle_wanted; - -GLWindow GLWin; - -/* attributes for a single buffered visual in RGBA format with at least - * 4 bits per color and a 16 bit depth buffer */ -static int attrListSgl[] = { GLX_RGBA, GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_DEPTH_SIZE, 16, - None -}; - -/* attributes for a double buffered visual in RGBA format with at least - * 4 bits per color and a 16 bit depth buffer */ -static int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_DEPTH_SIZE, 16, - None -}; - -static gboolean going = FALSE; -static gboolean initialized = FALSE; -static gboolean grabbed_pointer = FALSE, firsttime = TRUE; -static Atom wmDelete; -static pthread_t draw_thread; - -datas_t datas; - -static int num_bands = NUM_BANDS; -static int beat = 0; - -unsigned int transition_frames = 0; -unsigned int max_transition_frames = 0; - -static void iris_init (void); -static void iris_cleanup (void); -static void iris_about (void); -static void iris_playback_start (void); -static void iris_playback_stop (void); -static void iris_render_freq (gint16 data[][256]); - -static float dps = 0; - -gint beat_before = -1; - -extern iris_config newconfig; - -VisPlugin iris_vp = { - NULL, - NULL, - 0, - NULL, /* Description */ - 0, - 1, - iris_init, /* init */ - iris_cleanup, /* cleanup */ - iris_about, /* about */ - iris_configure, /* configure */ - NULL, /* disable_plugin */ - iris_playback_start, /* playback_start */ - iris_playback_stop, /* playback_stop */ - NULL, /* render_pcm */ - iris_render_freq /* render_freq */ -}; - - -void -about_close_clicked (GtkWidget * w, GtkWidget ** window) -{ - gtk_widget_destroy (*window); - *window = NULL; -} - - -void -about_closed (GtkWidget * w, GdkEvent * e, GtkWidget ** window) -{ - about_close_clicked (w, window); -} - - -static void -iris_about (void) -{ - static GtkWidget *window_about = NULL; - GtkWidget *vbox, *button, *close, *label; - - if (window_about) - return; - - window_about = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window_about), "About IRIS plugin"); - gtk_window_set_policy (GTK_WINDOW (window_about), FALSE, FALSE, FALSE); - gtk_window_set_position (GTK_WINDOW (window_about), GTK_WIN_POS_MOUSE); - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_add (GTK_CONTAINER (window_about), vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); - gtk_widget_show (vbox); - - label = gtk_label_new ("\n\ -Iris XMMS Plugin.\n\ -Copyright (C) 2001-2003, Cédric Delfosse.\n\ -\n\ -Email: <cdelfosse@free.fr> \n\ -Homepage: <http://cdelfosse.free.fr/xmms-iris/>\n\ -Development: <http://savannah.gnu.org/projects/iris/>\n\ -\n\ -Authors:\n\ -Cédric Delfosse\n\ -Marinus Schraal\n\ -Ron Lockwood-Childs\n\ -Ported to Audacious by Arthur Taylor\n\ -\n\ -This program is free software; you can redistribute it and/or modify\n\ -it under the terms of the GNU General Public License as published by\n\ -the Free Software Foundation; either version 2 of the License, or\n\ -(at your option) any later version.\n\ -\n\ -This program is distributed in the hope that it will be useful,\n\ -but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ -GNU General Public License for more details.\n\ -\n\ -You should have received a copy of the GNU General Public License\n\ -along with this program; if not, write to the Free Software\n\ -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\n\ -USA"); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 8); - gtk_widget_show (label); - - button = gtk_hbutton_box_new (); - gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 8); - gtk_widget_show (button); - - close = gtk_button_new_with_label ("Close"); - GTK_WIDGET_SET_FLAGS (close, GTK_CAN_DEFAULT); - gtk_window_set_default (GTK_WINDOW (window_about), close); - gtk_hbutton_box_set_layout_default (GTK_BUTTONBOX_END); - gtk_box_pack_end (GTK_BOX (button), close, FALSE, FALSE, 8); - gtk_widget_show (close); - - gtk_signal_connect (GTK_OBJECT (close), "clicked", - GTK_SIGNAL_FUNC (about_close_clicked), &window_about); - gtk_signal_connect (GTK_OBJECT (window_about), "delete-event", - GTK_SIGNAL_FUNC (about_closed), &window_about); - - gtk_widget_show (window_about); -} - - -/* Creates an empty cursor icon for when hovering over our window content */ -void -hide_cursor () -{ - Cursor no_ptr; - Pixmap bm_no; - Colormap cmap; - XColor black, dummy; - - static unsigned char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - cmap = DefaultColormap (GLWin.dpy, DefaultScreen (GLWin.dpy)); - XAllocNamedColor (GLWin.dpy, cmap, "black", &black, &dummy); - bm_no = XCreateBitmapFromData (GLWin.dpy, GLWin.window, bm_no_data, 8, 8); - no_ptr = - XCreatePixmapCursor (GLWin.dpy, bm_no, bm_no, &black, &black, 0, 0); - XDefineCursor (GLWin.dpy, GLWin.window, no_ptr); -} - - -/* this function creates our window and sets it up properly */ -static Window -create_window (char *title) -{ - XVisualInfo *vi; - int i; - - /* get a connection */ - GLWin.dpy = XOpenDisplay (0); - if (GLWin.dpy == NULL) - g_log (NULL, G_LOG_LEVEL_CRITICAL, - __FILE__ ": XOpenDisplay returns NULL"); - GLWin.screen = DefaultScreen (GLWin.dpy); - - /* get an appropriate visual */ - vi = glXChooseVisual (GLWin.dpy, GLWin.screen, attrListDbl); - if (vi == NULL) - { - vi = glXChooseVisual (GLWin.dpy, GLWin.screen, attrListSgl); - GLWin.DoubleBuffered = 0; - } - else - GLWin.DoubleBuffered = 1; - - if (vi == NULL) - g_log (NULL, G_LOG_LEVEL_CRITICAL, - __FILE__ ": glXChooseVisual returns NULL"); - - glXQueryVersion (GLWin.dpy, &GLWin.glxMajorVersion, &GLWin.glxMinorVersion); - /* create a GLX context */ - GLWin.ctx = glXCreateContext (GLWin.dpy, vi, 0, GL_TRUE); - if (GLWin.ctx == NULL) - g_log (NULL, G_LOG_LEVEL_CRITICAL, - __FILE__ ": glXCreateContext can\'t create a rendering context"); - - /* create a color map */ - GLWin.attr.colormap = - XCreateColormap (GLWin.dpy, RootWindow (GLWin.dpy, vi->screen), - vi->visual, AllocNone); - GLWin.attr.border_pixel = 0; - - if ((config.fullscreen && firsttime) || GLWin.fs) - { - int bestMode = 0; - - GLWin.fs = True; - GLWin.fs_width = config.fs_width; - GLWin.fs_height = config.fs_height; - /* look for mode with requested resolution */ - for (i = 0; i < GLWin.modeNum; i++) - { - if ((GLWin.modes[i]->hdisplay == GLWin.fs_width) - && (GLWin.modes[i]->vdisplay == GLWin.fs_height)) - { - bestMode = i; - } - } - XF86VidModeSwitchToMode (GLWin.dpy, GLWin.screen, - GLWin.modes[bestMode]); - XF86VidModeSetViewPort (GLWin.dpy, GLWin.screen, 0, 0); - GLWin.fs_width = GLWin.modes[bestMode]->hdisplay; - GLWin.fs_height = GLWin.modes[bestMode]->vdisplay; - - /* create a fullscreen window */ - GLWin.attr.override_redirect = True; - GLWin.attr.event_mask = - ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; - GLWin.window = - XCreateWindow (GLWin.dpy, - RootWindow (GLWin.dpy, vi->screen), 0, - 0, GLWin.fs_width, GLWin.fs_height, 0, vi->depth, - InputOutput, vi->visual, - CWBorderPixel | CWColormap | - CWEventMask | CWOverrideRedirect, &GLWin.attr); - XWarpPointer (GLWin.dpy, None, GLWin.window, 0, 0, 0, 0, 0, 0); - XMapRaised (GLWin.dpy, GLWin.window); - XGrabKeyboard (GLWin.dpy, GLWin.window, True, GrabModeAsync, - GrabModeAsync, CurrentTime); - XGrabPointer (GLWin.dpy, GLWin.window, True, ButtonPressMask, - GrabModeAsync, GrabModeAsync, GLWin.window, - FALSE, CurrentTime); - } - else - { - XClassHint xclasshint={"xmms","visplugin"}; - GLWin.window_width = config.window_width; - GLWin.window_height = config.window_height; - /* needed if those aren't set yet - ideally need a way to get the default values for these */ - if (config.window_height == 0 || config.window_width == 0) - { - config.window_width = 640; - config.window_height = 480; - } - - /* create a window in window mode */ - GLWin.attr.event_mask = - ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; - GLWin.window = - XCreateWindow (GLWin.dpy, - RootWindow (GLWin.dpy, vi->screen), 0, - 0, GLWin.window_width, GLWin.window_height, 0, - vi->depth, InputOutput, vi->visual, - CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr); - XmbSetWMProperties(GLWin.dpy, GLWin.window, "iris","iris", NULL, 0, NULL, NULL, &xclasshint); - - /* only set window title and handle wm_delete_events if in windowed mode */ - wmDelete = XInternAtom (GLWin.dpy, "WM_DELETE_WINDOW", True); - XSetWMProtocols (GLWin.dpy, GLWin.window, &wmDelete, 1); - XSetStandardProperties (GLWin.dpy, GLWin.window, title, - title, None, NULL, 0, NULL); - XMapRaised (GLWin.dpy, GLWin.window); - } - /* connect the glx-context to the window */ - if (!glXMakeCurrent (GLWin.dpy, GLWin.window, GLWin.ctx)) - g_log (NULL, G_LOG_LEVEL_CRITICAL, - __FILE__ ": glXMakeCurrent returns an error"); - if (glXIsDirect (GLWin.dpy, GLWin.ctx)) - GLWin.DRI = 1; - - hide_cursor (); - - XFree (vi); - firsttime = FALSE; - return GLWin.window; -} - - -VisPlugin * -get_vplugin_info (void) -{ - iris_vp.description = g_strdup_printf ("iris 3D analyzer %s", VERSION); - return &iris_vp; -} - - -static int -detect_beat (gint32 loudness) -{ - static gint32 aged; /* smoothed out oudness */ - static gint32 lowest; /* quietest point in current beat */ - static int elapsed; /* frames since last beat */ - static int isquiet; /* was previous frame quiet */ - int detected_beat; - - /* Incorporate the current loudness into history */ - aged = (aged * 7 + loudness) >> 3; - elapsed++; - - /* If silent, then clobber the beat */ - if (aged < 2000 || elapsed > BEAT_MAX) - { - elapsed = 0; - lowest = aged; - } - else if (aged < lowest) - lowest = aged; - - /* Beats are detected by looking for a sudden loudness after a lull. - * They are also limited to occur no more than once every 15 frames, - * so the beat flashes don't get too annoying. - */ - detected_beat = (loudness * 4 > aged * 3 && aged * 2 > lowest * 3 - && elapsed > 15); - if (detected_beat) - lowest = aged, elapsed = 0; - - /* Silence is computed from the aged loudness. The quietref value is - * set to TRUE only at the start of silence, not throughout the silent - * period. Also, there is some hysteresis so that silence followed - * by a slight noise and more silence won't count as two silent - * periods -- that sort of thing happens during many fade edits, so - * we have to account for it. - */ - if (aged < (isquiet ? 1500 : 500)) - /* Quiet now -- is this the start of quiet? */ - isquiet = TRUE; - else - isquiet = FALSE; - - /* return the result */ - return detected_beat; -} - - -/* limit_rotation_speed keep rotation speed to at least dps_config - by second */ -static void -limit_rotation_speed (gboolean init) -{ - static struct timeval tv_past; - struct timezone tz; - struct timeval tv_now; - float dps_config = 15; - - if (!init) - { - long t; - - gettimeofday (&tv_now, &tz); - t = - (tv_now.tv_sec - tv_past.tv_sec) * 10000000 + (tv_now.tv_usec - - tv_past.tv_usec); - dps = y_speed * ((float) 1000000 / (float) t); - if (dps >= (float) dps_config) - y_speed -= 0.02; - else - y_speed += 0.02; - - memcpy (&tv_past, &tv_now, sizeof (struct timeval)); - } - else - gettimeofday (&tv_past, &tz); -} - - -/* limit_fps tries to keep the number of - frame per seconds to config.fps */ -static void -limit_fps (gboolean init) -{ - static float fps = 0; - static struct timeval tv_past; - struct timezone tz; - struct timeval tv_now; - static int usec = 0; - - if (init) - gettimeofday (&tv_past, &tz); - else - { - long t; - - gettimeofday (&tv_now, &tz); - t = - (tv_now.tv_sec - tv_past.tv_sec) * 10000000 + (tv_now.tv_usec - - tv_past.tv_usec); - fps = (float) 1000000 / (float) t; - - if (fps >= (float) config.fps) - usec += 100; - else - { - if (usec > 0) - usec -= 100; - } - xmms_usleep (usec); - memcpy (&tv_past, &tv_now, sizeof (struct timeval)); - } -} - -static void -init_general_draw_mode (int num) -{ - int transparency; - int wireframe; - - if (theme[num].config->global->transparency != -1) - transparency = theme[num].config->global->transparency; - else - transparency = (int) (2.0 * rand () / (RAND_MAX + 1.0)); - - if (theme[num].config->global->wireframe != -1) - wireframe = theme[num].config->global->wireframe; - else - wireframe = (int) (2.0 * rand () / (RAND_MAX + 1.0)); - - if (transparency) - { - if (!glIsEnabled (GL_BLEND)) - { - glBlendFunc (GL_SRC_ALPHA, GL_ONE); - glEnable (GL_BLEND); - } - glDisable (GL_DEPTH_TEST); - } - else - { - if (glIsEnabled (GL_BLEND)) - { - glDisable (GL_BLEND); - } - glEnable (GL_DEPTH_TEST); - } - - if (wireframe) - glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); - else - glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - - if (glIsEnabled(GL_TEXTURE_2D)) - glDisable(GL_TEXTURE_2D); -} - - -static int -compute_theme () -{ - gfloat f_rand, f; - gint i; - - for (i = 0, f_rand = 0.0; i < THEME_NUMBER; i++) - f_rand += theme[i].config->global->priority; - f_rand = f_rand * rand () / (RAND_MAX + 1.0); - - i = 0; - f = 0; - while (i < THEME_NUMBER) - { - gfloat f_theme; - f_theme = theme[i].config->global->priority; - if (f_theme) - { - f += f_theme; - if (f_rand < f) - break; - } - i++; - } - - if (!f) - return (int) ((gfloat) THEME_NUMBER * rand () / (RAND_MAX + 1.0)); - else - return i; -} - - -static int -choose_theme (gboolean init) -{ - static long sec_btw_theme = 10 * 10000000; - static struct timeval tv_past; - struct timezone tz; - struct timeval tv_now; - static int th, th_tmp; - - if (!init) - { - long t; - - gettimeofday (&tv_now, &tz); - t = - (tv_now.tv_sec - tv_past.tv_sec) * 10000000 + (tv_now.tv_usec - - tv_past.tv_usec); - if ((t > sec_btw_theme) || (beat && config.change_theme_on_beat)) - { - /* we come here if: - - time for the theme is expired - - a beat is detected and the change_theme_on_beat option is on - */ - if (config.transition) - { - if (transition_frames == 0) - { - th_tmp = compute_theme (); - if (th != th_tmp) - { - transition_frames = - (unsigned int) config.fps * config.trans_duration / - 10; - max_transition_frames = transition_frames; - memcpy (&tv_past, &tv_now, sizeof (struct timeval)); - init_theme_transition (transition_frames, - max_transition_frames); - } - } - } - else - { - th = compute_theme (); - init_general_draw_mode (th); - if (theme[th].init_draw_mode != NULL) - theme[th].init_draw_mode (); - memcpy (&tv_past, &tv_now, sizeof (struct timeval)); - x_angle_wanted = theme[th].get_x_angle (); - x_speed = copysign (0.08, x_angle_wanted - x_angle); - } - } - /* change theme after half of the set frames have passed */ - else if ((((int) max_transition_frames / 2) == transition_frames) - && config.transition && (transition_frames != 0)) - { - th = th_tmp; - init_general_draw_mode (th); - if (theme[th].init_draw_mode != NULL) - theme[th].init_draw_mode (); - x_angle_wanted = theme[th].get_x_angle (); - x_speed = copysign (0.08, x_angle_wanted - x_angle); - } - } - else - { - /* the first time choose_theme is called, - tv_past is initialized */ - gettimeofday (&tv_past, &tz); - th = compute_theme (); - init_general_draw_mode (th); - if (theme[th].init_draw_mode != NULL) - theme[th].init_draw_mode (); - } - - return (th); -} - - -static void -draw_iris (void) -{ - int th; - - limit_fps (FALSE); - th = choose_theme (FALSE); - - if ((config.color_beat) && (beat_before > 0)) - glClearColor (config.color_flash_red, config.color_flash_green, - config.color_flash_blue, 1); - else - glClearColor (config.bgc_red, config.bgc_green, config.bgc_blue, 1); - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix (); - glTranslatef (0.0, -0.5, -7.0); - glRotatef (x_angle, 1.0, 0.0, 0.0); - glRotatef (y_angle, 0.0, 1.0, 0.0); - glRotatef (z_angle, 0.0, 0.0, 1.0); - - if (transition_frames > 0 && config.transition) - { - theme_transition (); - transition_frames--; - } - - theme[th].draw_one_frame (beat); - - glEnd (); - glPopMatrix (); - - glXSwapBuffers (GLWin.dpy, GLWin.window); -} - - -static gint -disable_func (gpointer data) -{ - iris_vp.disable_plugin (&iris_vp); - return FALSE; -} - - -GLvoid -init_gl (GLvoid) -{ - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glFrustum (-1, 1, -1.5, 1, 1.5, 12); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); -} - - -GLvoid -kill_gl_window (GLvoid) -{ - if (GLWin.ctx) - { - glXMakeCurrent (GLWin.dpy, None, NULL); - glXDestroyContext (GLWin.dpy, GLWin.ctx); - GLWin.ctx = NULL; - } - /* switch back to original desktop resolution if we were in fs */ - if (GLWin.fs) - { - XF86VidModeSwitchToMode (GLWin.dpy, GLWin.screen, &GLWin.deskMode); - XF86VidModeSetViewPort (GLWin.dpy, GLWin.screen, 0, 0); - } -} - - -void * -draw_thread_func (void *arg) -{ - Bool configured = FALSE; - - g_log (NULL, G_LOG_LEVEL_DEBUG, __FILE__ ": draw_thread_func: Starting."); - - if ((GLWin.window = create_window ("Iris")) == 0) - { - g_log (NULL, G_LOG_LEVEL_CRITICAL, - __FILE__ ": unable to create window"); - pthread_exit (NULL); - } - - init_gl (); - choose_theme (TRUE); - - -#ifdef HAVE_SCHED_SETSCHEDULER - if (xmms_check_realtime_priority ()) - { - struct sched_param sparam; - sparam.sched_priority = sched_get_priority_max (SCHED_OTHER); - pthread_setschedparam (pthread_self (), SCHED_OTHER, &sparam); - } -#endif - - while (going) /* plugin enabled */ - { - while (XPending (GLWin.dpy)) - { - XEvent event; - KeySym keysym; - char buf[16]; - - XNextEvent (GLWin.dpy, &event); - switch (event.type) - { - case Expose: - if (event.xexpose.count != 0) - break; - configured = TRUE; - break; - case ConfigureNotify: - glViewport (0, 0, event.xconfigure.width, - event.xconfigure.height); - configured = TRUE; - break; - case KeyPress: - - XLookupString (&event.xkey, buf, 16, &keysym, NULL); - switch (keysym) - { - case XK_Escape: - - /* Ugly hack to get the disable_plugin call in the main thread. */ - GDK_THREADS_ENTER (); - gtk_idle_add (disable_func, NULL); - GDK_THREADS_LEAVE (); - break; - case XK_z: - xmms_remote_playlist_prev (iris_vp.xmms_session); - break; - case XK_x: - xmms_remote_play (iris_vp.xmms_session); - break; - case XK_c: - xmms_remote_pause (iris_vp.xmms_session); - break; - case XK_v: - xmms_remote_stop (iris_vp.xmms_session); - break; - case XK_b: - xmms_remote_playlist_next (iris_vp.xmms_session); - break; - case XK_Left: - y_speed -= 0.1; - if (y_speed < -3.0) - y_speed = -3.0; - break; - case XK_Right: - y_speed += 0.1; - if (y_speed > 3.0) - y_speed = 3.0; - break; - case XK_Return: - x_speed = 0.0; - y_speed = 0.3; - z_speed = 0.0; - x_angle = 70.0; - y_angle = 45.0; - z_angle = 0.0; - break; - case XK_Tab: - iris_configure (); - break; - case XK_f: - //iris_save_window_attributes (); - kill_gl_window (); - XCloseDisplay (GLWin.dpy); - GLWin.fs = !GLWin.fs; - create_window ("Iris"); - init_gl (); - choose_theme (TRUE); - break; - } - - break; - case ClientMessage: - if ((Atom) event.xclient.data.l[0] == wmDelete) - { - GDK_THREADS_ENTER (); - gtk_idle_add (disable_func, NULL); - GDK_THREADS_LEAVE (); - } - break; - } - } - if (configured) - { - limit_rotation_speed (FALSE); - - if ((x_angle > x_angle_wanted) && (x_speed > 0)) - x_angle = x_angle_wanted; - else if ((x_angle < x_angle_wanted) && (x_speed < 0)) - x_angle = x_angle_wanted; - - x_angle += x_speed; - if (x_angle > 85.0) - x_angle = 85.0; - else if (x_angle < 0.0) - x_angle = 0.0; - - y_angle += y_speed; - if (y_angle >= 360.0) - y_angle -= 360.0; - - z_angle += z_speed; - if (z_angle >= 360.0) - z_angle -= 360.0; - - draw_iris (); - } - } - - g_log (NULL, G_LOG_LEVEL_DEBUG, __FILE__ ": draw_thread_func: Exiting."); - pthread_exit (NULL); -} - - -static void -start_display (void) -{ - scale = 1.0 / log (256.0); - - x_speed = 0.0; - y_speed = 0.3; - z_speed = 0.0; - x_angle = 45.0; - y_angle = 45.0; - z_angle = 0.0; - - going = TRUE; - limit_fps (TRUE); - limit_rotation_speed (TRUE); - if (pthread_create (&draw_thread, NULL, draw_thread_func, NULL)) - g_log (NULL, G_LOG_LEVEL_CRITICAL, __FILE__ ": pthread_create: Can't create drawing thread."); - -} - - -static void -stop_display (void) -{ - if (going) - { - going = FALSE; - pthread_join (draw_thread, NULL); - } - - kill_gl_window (); - - if (GLWin.window) - { - if (grabbed_pointer) - { - XUngrabPointer (GLWin.dpy, CurrentTime); - grabbed_pointer = FALSE; - } - - XDestroyWindow (GLWin.dpy, GLWin.window); - GLWin.window = 0; - } - XCloseDisplay (GLWin.dpy); -} - - -static void -iris_init (void) -{ - int i; - - initialized = TRUE; - iris_first_init (); - datas.loudness = 0; - /* if the config window is open, we don't want to trash the config the user - * has done */ - if (!config_window) - iris_config_read (); - for (i = 0; i < THEME_NUMBER; i++) - if (theme[i].init != NULL) - theme[i].init (); - srand (666); - start_display (); -} - - -static void -iris_cleanup (void) -{ - int i; - - if(initialized) - { - stop_display (); - for (i = 0; i < THEME_NUMBER; i++) - if (theme[i].cleanup != NULL) - theme[i].cleanup (); - } -} - - -static void -iris_playback_start (void) -{ -} - - -static void -iris_playback_stop (void) -{ -} - - -static void -iris_render_freq (gint16 data[2][256]) -{ - GLfloat val; - static int angle = 0; - int i; - - for (i = 0; i < num_bands; i++) - { - int y, c; - gint xscale[] = - { 0, 1, 2, 3, 5, 7, 10, 14, 20, 28, 40, 54, 74, 101, 137, 156, - 255 - }; - gint xscale8[] = { 0, 2, 5, 10, 20, 40, 74, 137, 255 }; - - if (num_bands == 16) - for (c = xscale[i], y = 0; c < xscale[i + 1]; c++) - { - if (data[0][c] > y) - y = data[0][c]; - } - else - for (c = xscale8[i], y = 0; c < xscale8[i + 1]; c++) - { - if (data[0][c] > y) - y = data[0][c]; - } - - datas.loudness += - (y / (xscale[i + 1] - xscale[i] + 1)) * (abs (i - NUM_BANDS / 2) + - NUM_BANDS / 2) * (4 + i); - - y >>= 7; - if (y > 0) - val = (log (y) * scale); - else - val = 0; - datas.data360[angle][i] = val; - datas.data1[i] = val; - } - - datas.loudness /= (NUM_BANDS * 4); - - beat = detect_beat (datas.loudness); - if (beat) - { - beat_before = config.flash_speed; - if (dps <= 90.0) - y_speed += 0.7; - - if (config.bgc_random) - { - config.bgc_red = 1.0 * rand () / (RAND_MAX + 1.0); - config.bgc_green = 1.0 * rand () / (RAND_MAX + 1.0); - config.bgc_blue = 1.0 * rand () / (RAND_MAX + 1.0); - } - - if (config.color12_random) - { - config.color1_red = 1.0 * rand () / (RAND_MAX + 1.0); - config.color1_green = 1.0 * rand () / (RAND_MAX + 1.0); - config.color1_blue = 1.0 * rand () / (RAND_MAX + 1.0); - config.color2_red = 1.0 * rand () / (RAND_MAX + 1.0); - config.color2_green = 1.0 * rand () / (RAND_MAX + 1.0); - config.color2_blue = 1.0 * rand () / (RAND_MAX + 1.0); - } - - if (config.color_random) - { - config.color_red = 1.0 * rand () / (RAND_MAX + 1.0); - config.color_green = 1.0 * rand () / (RAND_MAX + 1.0); - config.color_blue = 1.0 * rand () / (RAND_MAX + 1.0); - } - } - - if (beat_before > 0) - beat_before--; - - angle++; - if (angle == 360) - angle = 0; -}
--- a/src/iris/iris.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#ifndef IRIS_H - -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <GL/gl.h> -#include <GL/glx.h> -#include <audacious/configdb.h> -#include <X11/Xlib.h> -#include <X11/extensions/xf86vmode.h> - -typedef struct -{ - - GLfloat bgc_red; - GLfloat bgc_green; - GLfloat bgc_blue; - - GLfloat color_red; - GLfloat color_green; - GLfloat color_blue; - - GLfloat color1_red; - GLfloat color1_green; - GLfloat color1_blue; - - GLfloat color2_red; - GLfloat color2_green; - GLfloat color2_blue; - - GLfloat color_flash_red; - GLfloat color_flash_green; - GLfloat color_flash_blue; - - unsigned int color_mode; - unsigned int flash_speed; - unsigned int fps; - - // in fullscreen, we are only interested in width and height - unsigned int fs_width; - unsigned int fs_height; - - unsigned int window_width; - unsigned int window_height; - - gboolean bgc_random; - gboolean color_random; - gboolean color12_random; - gboolean flash_random; - gboolean color_beat; - gboolean change_theme_on_beat; - - gboolean fullscreen; - gboolean wireframe; - - gboolean transition; - gfloat trans_duration; -} -iris_config; - -typedef struct -{ - gfloat priority; /* priority of the theme */ - int transparency; /* transparency can be off (0), on (1) or random (-1) */ - int wireframe; /* wireframe can be off (0), on (1) or random (-1) */ -} -config_global; /* options implemented by all the themes */ - -typedef struct -{ - config_global *global; - void *private; /* private config of the theme */ -} -config_theme; - -typedef struct -{ - char *name; /* the name of the theme */ - char *description; /* what the theme does */ - char *author; /* who did the theme */ - char *key; /* key used to get config items in ~/.xmms/config */ - config_theme *config; /* where the theme config is */ - config_theme *config_new; /* copy of the theme config used by the configuration widgets */ - int config_private_size; /* size of the private theme config structure (we can't get it dynamically) */ - void (*config_read) (ConfigDb * db, char *); /* read the private theme config and put it into the privateconfig */ - void (*config_write) (ConfigDb * db, char *); /* write the private config into ~/.xmms/config */ - void (*config_default) (void); /* put default values into private config */ - void (*config_create) (GtkWidget *); /* create the Gtk widget (into a vbox) to configure the theme */ - void (*init) (void); /* called once at iris init */ - void (*cleanup) (void); /* called once at iris cleanup */ - void (*init_draw_mode) (void); /* called once when iris switch to this theme */ - GLfloat (*get_x_angle) (void); /* called once when iris switch to this theme to get a camera position to move */ - void (*draw_one_frame) (gboolean beat); /* draw one frame of the theme */ -} -iris_theme; - -#define NUM_BANDS 16 -typedef struct { - GLfloat data360[360][NUM_BANDS]; - GLfloat data1[NUM_BANDS]; - GLfloat loudness; -} -datas_t; - -typedef struct -{ - GLfloat x; - GLfloat z; -} -xz; - -/* stuff about our window grouped together */ -typedef struct -{ - // X stuff - Display *dpy; - int screen; - Window window; - GLXContext ctx; - XSetWindowAttributes attr; - Bool fs; - XF86VidModeModeInfo deskMode; - unsigned int window_x, window_y; - unsigned int window_width, window_height; - unsigned int fs_width, fs_height; - - // rendering info - int glxMajorVersion; - int glxMinorVersion; - int vidModeMajorVersion; - int vidModeMinorVersion; - XF86VidModeModeInfo **modes; - int modeNum; - unsigned int depth; - gboolean DRI; - gboolean DoubleBuffered; - GList *glist; -} -GLWindow; - -/* config.c */ -extern GtkWidget *config_window; -extern iris_config config; -extern iris_config newconfig; -extern GLWindow GLWin; -extern datas_t datas; -extern void iris_first_init (void); -extern void iris_configure (void); -extern void iris_config_read (void); -extern void iris_config_write (iris_config *); -extern void iris_set_default_prefs (void); -extern void iris_save_window_attributes (void); -extern GLvoid init_gl (GLvoid); - -/* color.c */ -extern void get_color (GLfloat *, GLfloat *, GLfloat *, GLfloat *); - -/* 3Dstuff.c */ -extern void bar_top_or_bottom (GLfloat height, xz * xz1, xz * xz2, xz * xz3, - xz * xz4); -extern void bar_side (GLfloat height, xz * xz1, xz * xz2); -extern void bar_full (GLfloat height, xz * xz1, xz * xz2, xz * xz3, xz * xz4); - -/* theme.c */ -#define THEME_NUMBER 12 -extern void theme_register (void); -extern iris_theme theme[THEME_NUMBER]; -extern void theme_config_init (void); -extern void theme_config_global_default (int); -extern void theme_config_global_read (ConfigDb *, char *, int); -extern void theme_config_global_write (ConfigDb *, char *, int); -extern void theme_config_apply(int num); -extern void theme_config_global_widgets(GtkWidget *, int); -extern void theme_about(GtkWidget *, int); - -/* transition.c */ -extern void init_theme_transition (); -extern void theme_transition (); - -#endif
--- a/src/iris/particle.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* GIMP RGBA C-Source image dump (particle.h) */ - -static const struct -{ - guint width; - guint height; - guint bytes_per_pixel; /* 3:RGB, 4:RGBA */ - guint8 pixel_data[32 * 32 * 4 + 1]; -} particle_image = -{ -32, 32, 4, - "\0\0\0\377\3\3\3\377\2\2\2\377\5\5\5\377\7\7\7\377\6\6\6\377\6\6\6\377\12" - "\12\12\377\13\13\13\377\11\11\11\377\12\12\12\377\12\12\12\377\14\14\14\377" - "\14\14\14\377\14\14\14\377\16\16\16\377\15\15\15\377\14\14\14\377\12\12\12" - "\377\13\13\13\377\13\13\13\377\11\11\11\377\12\12\12\377\12\12\12\377\10" - "\10\10\377\7\7\7\377\6\6\6\377\6\6\6\377\5\5\5\377\2\2\2\377\0\0\0\377\0" - "\0\0\377\4\4\4\377\3\3\3\377\4\4\4\377\7\7\7\377\6\6\6\377\10\10\10\377\11" - "\11\11\377\11\11\11\377\14\14\14\377\14\14\14\377\15\15\15\377\16\16\16\377" - "\20\20\20\377\21\21\21\377\20\20\20\377\22\22\22\377\20\20\20\377\21\21\21" - "\377\17\17\17\377\20\20\20\377\17\17\17\377\13\13\13\377\13\13\13\377\13" - "\13\13\377\14\14\14\377\11\11\11\377\6\6\6\377\6\6\6\377\6\6\6\377\4\4\4" - "\377\1\1\1\377\0\0\0\377\5\5\5\377\4\4\4\377\6\6\6\377\6\6\6\377\12\12\12" - "\377\12\12\12\377\11\11\11\377\14\14\14\377\15\15\15\377\20\20\20\377\20" - "\20\20\377\24\24\24\377\24\24\24\377\23\23\23\377\23\23\23\377\26\26\26\377" - "\25\25\25\377\23\23\23\377\21\21\21\377\24\24\24\377\22\22\22\377\17\17\17" - "\377\17\17\17\377\15\15\15\377\15\15\15\377\11\11\11\377\11\11\11\377\7\7" - "\7\377\7\7\7\377\6\6\6\377\3\3\3\377\3\3\3\377\6\6\6\377\6\6\6\377\6\6\6" - "\377\12\12\12\377\13\13\13\377\13\13\13\377\13\13\13\377\17\17\17\377\22" - "\22\22\377\24\24\24\377\22\22\22\377\30\30\30\377\30\30\30\377\31\31\31\377" - "\31\31\31\377\33\33\33\377\31\31\31\377\30\30\30\377\30\30\30\377\30\30\30" - "\377\25\25\25\377\25\25\25\377\23\23\23\377\22\22\22\377\17\17\17\377\13" - "\13\13\377\12\12\12\377\11\11\11\377\7\7\7\377\6\6\6\377\5\5\5\377\4\4\4" - "\377\7\7\7\377\6\6\6\377\12\12\12\377\11\11\11\377\14\14\14\377\15\15\15" - "\377\20\20\20\377\22\22\22\377\25\25\25\377\30\30\30\377\32\32\32\377\35" - "\35\35\377\34\34\34\377\34\34\34\377\36\36\36\377\40\40\40\377\36\36\36\377" - "\34\34\34\377\34\34\34\377\34\34\34\377\32\32\32\377\31\31\31\377\26\26\26" - "\377\25\25\25\377\22\22\22\377\16\16\16\377\12\12\12\377\12\12\12\377\12" - "\12\12\377\10\10\10\377\6\6\6\377\4\4\4\377\10\10\10\377\11\11\11\377\12" - "\12\12\377\13\13\13\377\16\16\16\377\21\21\21\377\22\22\22\377\25\25\25\377" - "\30\30\30\377\34\34\34\377\37\37\37\377!!!\377\"\"\"\377###\377###\377&&" - "&\377&&&\377$$$\377###\377\40\40\40\377!!!\377\35\35\35\377\34\34\34\377" - "\25\25\25\377\24\24\24\377\21\21\21\377\15\15\15\377\14\14\14\377\14\14\14" - "\377\12\12\12\377\6\6\6\377\6\6\6\377\10\10\10\377\12\12\12\377\12\12\12" - "\377\16\16\16\377\22\22\22\377\24\24\24\377\26\26\26\377\30\30\30\377\34" - "\34\34\377\37\37\37\377###\377&&&\377,,,\377+++\377,,,\377---\377---\377" - ",,,\377+++\377&&&\377)))\377$$$\377\34\34\34\377\34\34\34\377\27\27\27\377" - "\24\24\24\377\23\23\23\377\17\17\17\377\15\15\15\377\12\12\12\377\7\7\7\377" - "\6\6\6\377\12\12\12\377\12\12\12\377\16\16\16\377\21\21\21\377\22\22\22\377" - "\27\27\27\377\31\31\31\377\36\36\36\377!!!\377%%%\377(((\377111\377222\377" - "555\377;;;\377<<<\377999\377888\377333\377111\377---\377'''\377\"\"\"\377" - "\34\34\34\377\36\36\36\377\32\32\32\377\25\25\25\377\21\21\21\377\15\15\15" - "\377\11\11\11\377\12\12\12\377\7\7\7\377\13\13\13\377\14\14\14\377\17\17" - "\17\377\21\21\21\377\31\31\31\377\31\31\31\377\35\35\35\377!!!\377'''\377" - "+++\377111\377===\377EEE\377HHH\377MMM\377MMM\377JJJ\377III\377AAA\377AA" - "A\377888\377,,,\377%%%\377$$$\377\"\"\"\377\34\34\34\377\24\24\24\377\22" - "\22\22\377\17\17\17\377\13\13\13\377\12\12\12\377\11\11\11\377\13\13\13\377" - "\14\14\14\377\20\20\20\377\23\23\23\377\27\27\27\377\35\35\35\377$$$\377" - "(((\377...\377666\377===\377HHH\377WWW\377YYY\377]]]\377aaa\377\\\\\\\377" - "\\\\\\\377UUU\377OOO\377???\377444\377---\377+++\377\40\40\40\377\32\32\32" - "\377\27\27\27\377\23\23\23\377\22\22\22\377\15\15\15\377\11\11\11\377\13" - "\13\13\377\12\12\12\377\15\15\15\377\21\21\21\377\25\25\25\377\30\30\30\377" - "\37\37\37\377$$$\377...\377999\377???\377NNN\377XXX\377hhh\377rrr\377www" - "\377|||\377xxx\377ppp\377kkk\377\\\\\\\377JJJ\377FFF\377999\377***\377$$" - "$\377\36\36\36\377\30\30\30\377\25\25\25\377\24\24\24\377\20\20\20\377\14" - "\14\14\377\12\12\12\377\15\15\15\377\17\17\17\377\22\22\22\377\27\27\27\377" - "\34\34\34\377\40\40\40\377%%%\377...\377<<<\377MMM\377[[[\377lll\377~~~\377" - "\227\227\227\377\230\230\230\377\234\234\234\377\233\233\233\377\226\226" - "\226\377\205\205\205\377iii\377bbb\377PPP\377999\377---\377(((\377!!!\377" - "\35\35\35\377\32\32\32\377\25\25\25\377\21\21\21\377\13\13\13\377\12\12\12" - "\377\15\15\15\377\21\21\21\377\23\23\23\377\31\31\31\377\37\37\37\377!!!" - "\377(((\377444\377@@@\377QQQ\377ggg\377\200\200\200\377\231\231\231\377\254" - "\254\254\377\275\275\275\377\310\310\310\377\304\304\304\377\264\264\264" - "\377\227\227\227\377\212\212\212\377fff\377QQQ\377BBB\377:::\377///\377&" - "&&\377\36\36\36\377\32\32\32\377\26\26\26\377\21\21\21\377\14\14\14\377\12" - "\12\12\377\17\17\17\377\22\22\22\377\24\24\24\377\31\31\31\377\40\40\40\377" - "&&&\377---\377:::\377HHH\377XXX\377kkk\377\220\220\220\377\252\252\252\377" - "\324\324\324\377\363\363\363\377\370\370\370\377\366\366\366\377\335\335" - "\335\377\263\263\263\377\221\221\221\377www\377bbb\377PPP\377>>>\377000\377" - "&&&\377\37\37\37\377\32\32\32\377\26\26\26\377\23\23\23\377\15\15\15\377" - "\11\11\11\377\16\16\16\377\21\21\21\377\27\27\27\377\33\33\33\377\"\"\"\377" - "(((\377///\377<<<\377NNN\377bbb\377zzz\377\231\231\231\377\275\275\275\377" - "\361\361\361\377\375\375\375\377\376\376\376\377\376\376\376\377\370\370" - "\370\377\316\316\316\377\240\240\240\377\205\205\205\377bbb\377LLL\377<<" - "<\377...\377&&&\377\40\40\40\377\33\33\33\377\26\26\26\377\22\22\22\377\15" - "\15\15\377\12\12\12\377\16\16\16\377\22\22\22\377\24\24\24\377\32\32\32\377" - "\40\40\40\377$$$\377,,,\377:::\377LLL\377```\377|||\377\231\231\231\377\310" - "\310\310\377\372\372\372\377\375\375\375\377\376\376\376\377\376\376\376" - "\377\375\375\375\377\332\332\332\377\241\241\241\377\207\207\207\377fff\377" - "RRR\377@@@\377333\377+++\377\"\"\"\377\35\35\35\377\30\30\30\377\24\24\24" - "\377\17\17\17\377\14\14\14\377\16\16\16\377\22\22\22\377\25\25\25\377\30" - "\30\30\377\40\40\40\377$$$\377,,,\377;;;\377NNN\377eee\377\206\206\206\377" - "\246\246\246\377\327\327\327\377\374\374\374\377\375\375\375\377\376\376" - "\376\377\376\376\376\377\374\374\374\377\331\331\331\377\243\243\243\377" - "\210\210\210\377bbb\377OOO\377>>>\377...\377&&&\377\40\40\40\377\33\33\33" - "\377\27\27\27\377\22\22\22\377\15\15\15\377\12\12\12\377\16\16\16\377\22" - "\22\22\377\23\23\23\377\32\32\32\377\40\40\40\377'''\377000\377???\377UU" - "U\377hhh\377\200\200\200\377\237\237\237\377\270\270\270\377\344\344\344" - "\377\372\372\372\377\375\375\375\377\376\376\376\377\354\354\354\377\275" - "\275\275\377\227\227\227\377\200\200\200\377eee\377QQQ\377>>>\377...\377" - "%%%\377\40\40\40\377\33\33\33\377\26\26\26\377\22\22\22\377\15\15\15\377" - "\11\11\11\377\17\17\17\377\22\22\22\377\25\25\25\377\31\31\31\377\"\"\"\377" - "***\377333\377===\377JJJ\377^^^\377ooo\377\211\211\211\377\235\235\235\377" - "\271\271\271\377\327\327\327\377\342\342\342\377\335\335\335\377\302\302" - "\302\377\240\240\240\377\216\216\216\377kkk\377XXX\377CCC\377999\377///\377" - "&&&\377\"\"\"\377\33\33\33\377\26\26\26\377\22\22\22\377\14\14\14\377\12" - "\12\12\377\15\15\15\377\22\22\22\377\31\31\31\377\35\35\35\377\37\37\37\377" - "$$$\377,,,\377777\377AAA\377QQQ\377[[[\377ppp\377\212\212\212\377\231\231" - "\231\377\242\242\242\377\253\253\253\377\251\251\251\377\236\236\236\377" - "\215\215\215\377uuu\377bbb\377OOO\377<<<\377111\377)))\377\"\"\"\377\34\34" - "\34\377\32\32\32\377\27\27\27\377\21\21\21\377\16\16\16\377\12\12\12\377" - "\17\17\17\377\21\21\21\377\20\20\20\377\27\27\27\377\37\37\37\377$$$\377" - "&&&\377,,,\377888\377BBB\377RRR\377___\377kkk\377~~~\377\207\207\207\377" - "\220\220\220\377\220\220\220\377\203\203\203\377qqq\377___\377VVV\377FFF" - "\377777\377,,,\377%%%\377!!!\377\31\31\31\377\25\25\25\377\22\22\22\377\17" - "\17\17\377\14\14\14\377\11\11\11\377\12\12\12\377\16\16\16\377\22\22\22\377" - "\27\27\27\377\33\33\33\377\35\35\35\377\"\"\"\377(((\377///\377999\377EE" - "E\377LLL\377^^^\377ddd\377eee\377kkk\377lll\377ddd\377aaa\377OOO\377CCC\377" - "===\377000\377)))\377$$$\377\35\35\35\377\30\30\30\377\25\25\25\377\22\22" - "\22\377\16\16\16\377\12\12\12\377\13\13\13\377\13\13\13\377\15\15\15\377" - "\20\20\20\377\21\21\21\377\31\31\31\377\33\33\33\377\35\35\35\377$$$\377" - ")))\377111\377666\377@@@\377JJJ\377NNN\377PPP\377SSS\377XXX\377PPP\377JJ" - "J\377EEE\377777\377,,,\377+++\377%%%\377\40\40\40\377\32\32\32\377\26\26" - "\26\377\21\21\21\377\21\21\21\377\14\14\14\377\11\11\11\377\12\12\12\377" - "\13\13\13\377\11\11\11\377\14\14\14\377\21\21\21\377\23\23\23\377\27\27\27" - "\377\33\33\33\377\37\37\37\377&&&\377(((\377***\377444\377999\377<<<\377" - "===\377CCC\377EEE\377???\377999\377:::\377...\377(((\377!!!\377!!!\377\35" - "\35\35\377\31\31\31\377\24\24\24\377\21\21\21\377\16\16\16\377\12\12\12\377" - "\11\11\11\377\10\10\10\377\10\10\10\377\11\11\11\377\13\13\13\377\16\16\16" - "\377\22\22\22\377\25\25\25\377\30\30\30\377\33\33\33\377\"\"\"\377!!!\377" - "%%%\377***\377---\377000\377///\377333\377222\377444\377---\377,,,\377**" - "*\377\"\"\"\377\37\37\37\377\32\32\32\377\33\33\33\377\27\27\27\377\21\21" - "\21\377\17\17\17\377\16\16\16\377\12\12\12\377\11\11\11\377\6\6\6\377\10" - "\10\10\377\12\12\12\377\11\11\11\377\15\15\15\377\20\20\20\377\22\22\22\377" - "\23\23\23\377\30\30\30\377\32\32\32\377\35\35\35\377\40\40\40\377!!!\377" - "%%%\377(((\377&&&\377)))\377(((\377+++\377$$$\377!!!\377###\377\36\36\36" - "\377\30\30\30\377\30\30\30\377\24\24\24\377\22\22\22\377\20\20\20\377\15" - "\15\15\377\11\11\11\377\12\12\12\377\6\6\6\377\6\6\6\377\7\7\7\377\7\7\7" - "\377\11\11\11\377\12\12\12\377\16\16\16\377\17\17\17\377\22\22\22\377\23" - "\23\23\377\26\26\26\377\31\31\31\377\33\33\33\377\34\34\34\377!!!\377\40" - "\40\40\377\"\"\"\377\"\"\"\377\"\"\"\377&&&\377\36\36\36\377\35\35\35\377" - "\35\35\35\377\34\34\34\377\26\26\26\377\24\24\24\377\23\23\23\377\20\20\20" - "\377\15\15\15\377\14\14\14\377\13\13\13\377\7\7\7\377\5\5\5\377\6\6\6\377" - "\7\7\7\377\6\6\6\377\11\11\11\377\12\12\12\377\11\11\11\377\15\15\15\377" - "\16\16\16\377\21\21\21\377\22\22\22\377\26\26\26\377\26\26\26\377\30\30\30" - "\377\33\33\33\377\32\32\32\377\34\34\34\377\33\33\33\377\32\32\32\377\37" - "\37\37\377\31\31\31\377\31\31\31\377\27\27\27\377\30\30\30\377\21\21\21\377" - "\22\22\22\377\17\17\17\377\14\14\14\377\11\11\11\377\11\11\11\377\12\12\12" - "\377\6\6\6\377\6\6\6\377\4\4\4\377\6\6\6\377\6\6\6\377\5\5\5\377\7\7\7\377" - "\13\13\13\377\11\11\11\377\12\12\12\377\16\16\16\377\21\21\21\377\21\21\21" - "\377\20\20\20\377\22\22\22\377\30\30\30\377\26\26\26\377\27\27\27\377\30" - "\30\30\377\27\27\27\377\30\30\30\377\26\26\26\377\23\23\23\377\22\22\22\377" - "\20\20\20\377\20\20\20\377\16\16\16\377\14\14\14\377\11\11\11\377\11\11\11" - "\377\10\10\10\377\6\6\6\377\6\6\6\377\4\4\4\377\3\3\3\377\4\4\4\377\4\4\4" - "\377\4\4\4\377\7\7\7\377\10\10\10\377\12\12\12\377\10\10\10\377\11\11\11" - "\377\15\15\15\377\16\16\16\377\16\16\16\377\20\20\20\377\23\23\23\377\21" - "\21\21\377\23\23\23\377\22\22\22\377\22\22\22\377\21\21\21\377\22\22\22\377" - "\22\22\22\377\20\20\20\377\16\16\16\377\15\15\15\377\12\12\12\377\11\11\11" - "\377\12\12\12\377\7\7\7\377\6\6\6\377\7\7\7\377\5\5\5\377\4\4\4\377\1\1\1" - "\377\1\1\1\377\3\3\3\377\3\3\3\377\6\6\6\377\7\7\7\377\6\6\6\377\10\10\10" - "\377\12\12\12\377\12\12\12\377\11\11\11\377\13\13\13\377\16\16\16\377\16" - "\16\16\377\16\16\16\377\17\17\17\377\16\16\16\377\16\16\16\377\17\17\17\377" - "\17\17\17\377\15\15\15\377\14\14\14\377\12\12\12\377\11\11\11\377\12\12\12" - "\377\12\12\12\377\7\7\7\377\6\6\6\377\6\6\6\377\6\6\6\377\3\3\3\377\1\1\1" - "\377\1\1\1\377\0\0\0\377\0\0\0\377\2\2\2\377\4\4\4\377\7\7\7\377\6\6\6\377" - "\6\6\6\377\7\7\7\377\13\13\13\377\13\13\13\377\10\10\10\377\11\11\11\377" - "\11\11\11\377\11\11\11\377\15\15\15\377\13\13\13\377\14\14\14\377\11\11\11" - "\377\13\13\13\377\11\11\11\377\12\12\12\377\13\13\13\377\11\11\11\377\11" - "\11\11\377\6\6\6\377\7\7\7\377\4\4\4\377\5\5\5\377\3\3\3\377\1\1\1\377\0" - "\0\0\377\0\0\0\377",};
--- a/src/iris/theme.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,308 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include "iris.h" - -/* declaration of all the themes start here */ -extern iris_theme theme_original; -extern iris_theme theme_spectrum; -extern iris_theme theme_spectrotoy; -extern iris_theme theme_squarefield; -extern iris_theme theme_waves; -extern iris_theme theme_pyramid; -extern iris_theme theme_knot; -extern iris_theme theme_pinwheel; -extern iris_theme theme_pipes; -extern iris_theme theme_float; -extern iris_theme theme_fountain; -extern iris_theme theme_flash; - -/* this is the array where all the themes are */ -iris_theme theme[THEME_NUMBER]; - - -/* this initialize the theme registry */ -void -theme_register (void) -{ - theme[0] = theme_original; - theme[1] = theme_spectrum; - theme[2] = theme_spectrotoy; - theme[3] = theme_squarefield; - theme[4] = theme_waves; - theme[5] = theme_pyramid; - theme[6] = theme_knot; - theme[7] = theme_pinwheel; - theme[8] = theme_pipes; - theme[9] = theme_float; - theme[10] = theme_fountain; - theme[11] = theme_flash;} - - -/* allocate memory for the config struct of the themes */ -void -theme_config_init (void) -{ - int i; - - for (i = 0; i < THEME_NUMBER; i++) - { - theme[i].config->global = g_malloc (sizeof (config_global)); - theme[i].config_new->global = g_malloc (sizeof (config_global)); - } -} - - -/* set the default global config of a theme */ -void -theme_config_global_default (int num) -{ - theme[num].config->global->priority = 1.0; /* priority set to max */ - theme[num].config->global->transparency = -1; /* transparency random */ - theme[num].config->global->wireframe = 0; /* wireframe off */ -} - - -/* read the global config of a theme - (priority, transparency, wireframe) */ -void -theme_config_global_read (ConfigDb * db, char *section_name, int num) -{ - char *string; - - string = g_strconcat (theme[num].key, "_", "priority", NULL); - bmp_cfg_db_get_float (db, section_name, string, &theme[num].config->global->priority); - g_free (string); - - string = g_strconcat (theme[num].key, "_", "transparency", NULL); - bmp_cfg_db_get_int (db, section_name, string, &theme[num].config->global->transparency); - g_free (string); - - string = g_strconcat (theme[num].key, "_", "wireframe", NULL); - bmp_cfg_db_get_int (db, section_name, string, &theme[num].config->global->wireframe); - g_free (string); -} - - -/* write the global config of a theme */ -void -theme_config_global_write (ConfigDb * db, char *section_name, int num) -{ - char *string; - - string = g_strconcat (theme[num].key, "_", "priority", NULL); - bmp_cfg_db_set_float (db, section_name, string, theme[num].config->global->priority); - g_free (string); - - string = g_strconcat (theme[num].key, "_", "transparency", NULL); - bmp_cfg_db_set_int (db, section_name, string, theme[num].config->global->transparency); - g_free (string); - - string = g_strconcat (theme[num].key, "_", "wireframe", NULL); - bmp_cfg_db_set_int (db, section_name, string, theme[num].config->global->wireframe); - g_free (string); -} - - -/* the following 6 functions are callbacks for the theme_config_global_widgets function */ -void -on_rb_transparency_random (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->transparency = -1; -} - - -void -on_rb_transparency_on (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->transparency = 1; -} - - -void -on_rb_transparency_off (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->transparency = 0; -} - - -void -on_rb_wireframe_random (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->wireframe = -1; -} - - -void -on_rb_wireframe_on (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->wireframe = 1; -} - - -void -on_rb_wireframe_off (GtkWidget * widget, gpointer data) -{ - theme[(int) data].config_new->global->wireframe = 0; -} - - -void -theme_config_apply (int num) -{ - memcpy (theme[num].config->private, theme[num].config_new->private, - theme[num].config_private_size); -} - - -/* create the config widgets of all the themes */ -void -theme_config_global_widgets (GtkWidget * vbox, int num) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *radio_button_on1; - GtkWidget *radio_button_off1; - GtkWidget *radio_button_random1; - GSList *group; - - memcpy (theme[num].config_new->global, theme[num].config->global, - sizeof (config_global)); - - /* transparency mode */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Transparency"); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - radio_button_random1 = gtk_radio_button_new_with_label (NULL, "Random"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_random1, FALSE, FALSE, 4); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button_random1)); - radio_button_on1 = gtk_radio_button_new_with_label (group, "On"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_on1, FALSE, FALSE, 4); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button_on1)); - radio_button_off1 = gtk_radio_button_new_with_label (group, "Off"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_off1, FALSE, FALSE, 4); - - switch (theme[num].config->global->transparency) - { - case -1: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_random1), TRUE); - break; - } - case 0: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_off1), TRUE); - break; - } - case 1: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_on1), TRUE); - } - } - - gtk_signal_connect (GTK_OBJECT (radio_button_random1), "toggled", - GTK_SIGNAL_FUNC (on_rb_transparency_random), - (gpointer) num); - gtk_signal_connect (GTK_OBJECT (radio_button_off1), "toggled", - GTK_SIGNAL_FUNC (on_rb_transparency_off), - (gpointer) num); - gtk_signal_connect (GTK_OBJECT (radio_button_on1), "toggled", - GTK_SIGNAL_FUNC (on_rb_transparency_on), - (gpointer) num); - - /* wireframe mode */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Wireframe"); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - radio_button_random1 = gtk_radio_button_new_with_label (NULL, "Random"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_random1, FALSE, FALSE, 4); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button_random1)); - radio_button_on1 = gtk_radio_button_new_with_label (group, "On"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_on1, FALSE, FALSE, 4); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button_on1)); - radio_button_off1 = gtk_radio_button_new_with_label (group, "Off"); - gtk_box_pack_start (GTK_BOX (hbox), radio_button_off1, FALSE, FALSE, 4); - - switch (theme[num].config->global->wireframe) - { - case -1: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_random1), TRUE); - break; - } - case 0: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_off1), TRUE); - break; - } - case 1: - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (radio_button_on1), TRUE); - } - } - - gtk_signal_connect (GTK_OBJECT (radio_button_random1), "toggled", - GTK_SIGNAL_FUNC (on_rb_wireframe_random), - (gpointer) num); - gtk_signal_connect (GTK_OBJECT (radio_button_off1), "toggled", - GTK_SIGNAL_FUNC (on_rb_wireframe_off), (gpointer) num); - gtk_signal_connect (GTK_OBJECT (radio_button_on1), "toggled", - GTK_SIGNAL_FUNC (on_rb_wireframe_on), (gpointer) num); - -} - - -/* create the theme about vbox */ -void -theme_about (GtkWidget * vbox_about, int num) -{ - GtkWidget *label; - GtkWidget *vbox; - - vbox = gtk_vbox_new (FALSE, 4); - label = gtk_label_new (g_strconcat ("Theme name: ", theme[num].name, NULL)); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - label = - gtk_label_new (g_strconcat ("Theme author: ", theme[num].author, NULL)); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - label = - gtk_label_new (g_strconcat - ("Theme description: ", theme[num].description, NULL)); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 4); - - gtk_box_pack_start (GTK_BOX (vbox_about), vbox, FALSE, FALSE, 4); -}
--- a/src/iris/theme_flash.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,486 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2004 Marc Pompl (marc.pompl@lynorics.de) - * - * 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. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" -#include "particle.h" - -static GLuint texture[1]; /* Storage For Our Particle Texture */ - -static gboolean flash_already_initialized = FALSE; - -static float flash_timer = 0; /* timer for flash */ - -static struct -{ - gboolean flash_on_beat; - int flash_timer; - GLfloat speed; - GLfloat r1, r2, r3; - GLfloat m,n,o; - GLfloat f,g,h; - GLfloat t; -} -conf_private, conf_private_new; - -static config_theme conf = { - (config_global *) NULL, - &conf_private -}; - -static config_theme conf_new = { - (config_global *) NULL, - &conf_private_new -}; - -static char flash_flash_on_beat[] = "flashlight_flash_on_beat"; -static char flash_flash_timer[] = "flashlight_flash_timer"; -static char flash_speed[] = "flashlight_speed"; - -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); -static void init_draw_mode (void); -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - -iris_theme theme_flash = { - "Flash light", - "flash lights moving by a lissajou figure\n", - "Marc Pompl (marc.pompl@lynorics.de)", - "flashlight", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - init_draw_mode, - get_x_angle, - draw_one_frame -}; - -/* Create our particle structure */ -typedef struct -{ - GLint active; /* Active (Yes/No) */ - GLfloat life; /* Particle Life */ - GLfloat fade; /* Fade Speed */ - - GLfloat r; /* Red Value */ - GLfloat g; /* Green Value */ - GLfloat b; /* Blue Value */ - - GLfloat fr; /* Red Flash Value */ - GLfloat fg; /* Green Flash Value */ - GLfloat fb; /* Blue Flash Value */ - - GLfloat x; /* X Position */ - GLfloat y; /* Y Position */ - GLfloat z; /* Z Position */ - - GLfloat xi; /* X Direction */ - GLfloat yi; /* Y Direction */ - GLfloat zi; /* Z Direction */ - - GLfloat xg; /* X Gravity */ - GLfloat yg; /* Y Gravity */ - GLfloat zg; /* Z Gravity */ -} particle; - -/* Rainbow of colors */ -static GLfloat flash_colors[16][3] = -{ - { 1.0f, 0.5f, 0.5f}, - { 1.0f, 0.75f, 0.5f}, - { 1.0f, 1.0f, 0.5f}, - - { 0.75f, 1.0f, 0.5f}, - - { 0.5f, 1.0f, 0.5f}, - { 0.5f, 1.0f, 0.75f}, - { 0.5f, 1.0f, 1.0f}, - - { 0.5f, 0.75f, 1.0f}, - { 0.5f, 0.5f, 1.0f}, - { 0.75f, 0.5f, 1.0f}, - - { 1.0f, 0.5f, 1.0f}, - { 1.0f, 0.5f, 0.75f}, - { 0.75f, 0.5f, 0.75f}, - - { 0.5f, 0.5f, 0.5f}, - { 0.75f, 0.75f, 0.75f}, - { 1.0f, 1.0f, 1.0f}, -}; - -/* Our beloved array of particles */ -static particle particles[NUM_BANDS]; - -void FlashColor( int num ) -{ - GLfloat dr; - GLfloat dg; - GLfloat db; - dr = 1-particles[num].r; - dg = 1-particles[num].g; - db = 1-particles[num].b; - particles[num].fr = 1-dr*dr; - particles[num].fg = 1-dg*dg; - particles[num].fb = 1-db*db; -} - -/* function to "load" a GL texture */ -void flash_loadTexture( ) -{ - /* Create The Texture */ - glGenTextures( 1, &texture[0] ); - - /* Typical Texture Generation Using Data From The Bitmap */ - glBindTexture( GL_TEXTURE_2D, texture[0] ); - - /* Generate The Texture */ - glTexImage2D( GL_TEXTURE_2D, 0, 3, particle_image.width, - particle_image.height, 0, GL_RGBA, - GL_UNSIGNED_BYTE, particle_image.pixel_data ); - - /* Linear Filtering */ - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); -} - -/* function to reset one particle to initial state */ -void ResetFlash( int num, GLfloat xDir, GLfloat yDir, GLfloat zDir ) -{ - /* Make the particels active */ - particles[num].active = TRUE; - /* Give the particles life */ - particles[num].life = 1.0f; - /* Random Fade Speed */ - particles[num].fade = ( GLfloat )( rand( ) *150 )/ (RAND_MAX + 1.0) / 1000.0f + 0.003f; - /* Select Red Rainbow Color */ - particles[num].r = flash_colors[num][0]; - /* Select Green Rainbow Color */ - particles[num].g = flash_colors[num][1]; - /* Select Blue Rainbow Color */ - particles[num].b = flash_colors[num][2]; - /* Set the position on the X axis */ - particles[num].x = 0.0f; - /* Set the position on the Y axis */ - particles[num].y = 0.0f; - /* Set the position on the Z axis */ - particles[num].z = 0.0f; - /* Random Speed On X Axis */ - particles[num].xi = xDir; - /* Random Speed On Y Axi */ - particles[num].yi = yDir; - /* Random Speed On Z Axis */ - particles[num].zi = zDir; - /* Set Horizontal Pull To Zero */ - particles[num].xg = 0.0f; - /* Set Vertical Pull Downward */ - particles[num].yg = -0.8f; - /* Set Pull On Z Axis To Zero */ - particles[num].zg = 0.0f; - FlashColor(num); -} - -static void initFlash ( int num, GLfloat value ) -{ - GLfloat xi, yi, zi; - xi = num; - yi = 0; - zi = 0; - ResetFlash( num, xi, yi, zi ); -} - -static void -init_draw_mode () -{ - int loop; - conf.global->transparency = TRUE; - //conf.global->wireframe = FALSE; - - flash_loadTexture(); - /* Enable smooth shading */ - glShadeModel( GL_SMOOTH ); - - /* Set the background black */ - //glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); - - /* Depth buffer setup */ - //glClearDepth( 1.0f ); - - /* Enables Depth Testing */ - glDisable( GL_DEPTH_TEST ); - - /* Enable Blending */ - glEnable( GL_BLEND ); - - glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - - /* Type Of Blending To Perform */ - glBlendFunc( GL_SRC_ALPHA, GL_ONE ); - - /* Really Nice Perspective Calculations */ - glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); - /* Really Nice Point Smoothing */ - glHint( GL_POINT_SMOOTH_HINT, GL_NICEST ); - - /* Enable Texture Mapping */ - glEnable( GL_TEXTURE_2D ); - /* Select Our Texture */ - glBindTexture( GL_TEXTURE_2D, texture[0] ); - if (!flash_already_initialized) - { - for (loop=0; loop<NUM_BANDS; loop++) - { - initFlash(loop,0); - } - conf_private.f = 1; - conf_private.g = 1; - conf_private.h = 2; - conf_private.m = conf_private.n = conf_private.o = 0; - conf_private.t = 0.0f; - } - flash_already_initialized = TRUE; -} - - -static GLfloat -get_x_angle () -{ - return (15.0 + (int) (40.0 * rand () / (RAND_MAX + 1.0))); -} - -static void -draw_one_frame (gboolean beat) -{ - int loop; - if (beat) - flash_timer = conf_private.flash_timer; - conf_private.t += conf_private.speed; - /* Modify each of the particles */ - for ( loop = 0; loop < NUM_BANDS; loop++ ) - { - GLfloat x; - GLfloat y; - GLfloat z; - /* compute the position by a lissajou */ - GLfloat t1 = (GLfloat)((conf_private.t+loop)/2); - conf_private.r1 = (GLfloat)(cos(t1)*sin(t1-loop)*5.0f); - conf_private.r2 = (GLfloat)(sin(t1)*cos(t1)*5.0f); - conf_private.r3 = (GLfloat)(cos(t1+conf_private.t)*sin(t1+loop)*5.0f); - x = (conf_private.r1*cos(conf_private.m*t1+conf_private.f)); - y = (conf_private.r2*sin(conf_private.n*t1+conf_private.g)); - z = (conf_private.r3*sin(conf_private.o*t1+conf_private.h)); - - if (particles[loop].active) - { - /* Draw The Particle Using Our RGB Values, - * Fade The Particle Based On It's Life - */ - if ((conf_private.flash_on_beat) && (flash_timer>0)) - glColor4f( particles[loop].fr, - particles[loop].fg, - particles[loop].fb, - 1.0f ); - else - { - glColor4f( particles[loop].r, - particles[loop].g, - particles[loop].b, - 1.0f ); - } - - /* Build Quad From A Triangle Strip */ - glBegin( GL_TRIANGLE_STRIP ); - /* Top Right */ - glTexCoord2d( 1, 1 ); - glVertex3f( x + datas.data1[loop], y + datas.data1[loop], z ); - /* Top Left */ - glTexCoord2d( 0, 1 ); - glVertex3f( x - datas.data1[loop], y + datas.data1[loop], z ); - /* Bottom Right */ - glTexCoord2d( 1, 0 ); - glVertex3f( x + datas.data1[loop], y - datas.data1[loop], z ); - /* Bottom Left */ - glTexCoord2d( 0, 0 ); - glVertex3f( x - datas.data1[loop], y - datas.data1[loop], z ); - glEnd( ); - - glBegin( GL_TRIANGLE_STRIP ); - /* Top Right */ - glTexCoord2d( 1, 1 ); - glVertex3f( x, y + datas.data1[loop], z+datas.data1[loop] ); - /* Top Left */ - glTexCoord2d( 0, 1 ); - glVertex3f( x, y + datas.data1[loop], z-datas.data1[loop] ); - /* Bottom Right */ - glTexCoord2d( 1, 0 ); - glVertex3f( x, y - datas.data1[loop], z+datas.data1[loop] ); - /* Bottom Left */ - glTexCoord2d( 0, 0 ); - glVertex3f( x, y - datas.data1[loop], z-datas.data1[loop] ); - glEnd( ); - - glBegin( GL_TRIANGLE_STRIP ); - /* Top Right */ - glTexCoord2d( 1, 1 ); - glVertex3f( x+datas.data1[loop], y, z+datas.data1[loop] ); - /* Top Left */ - glTexCoord2d( 0, 1 ); - glVertex3f( x+datas.data1[loop], y, z-datas.data1[loop] ); - /* Bottom Right */ - glTexCoord2d( 1, 0 ); - glVertex3f( x-datas.data1[loop], y, z+datas.data1[loop] ); - /* Bottom Left */ - glTexCoord2d( 0, 0 ); - glVertex3f( x-datas.data1[loop], y, z-datas.data1[loop] ); - glEnd( ); - } - } - - if (flash_timer>0) - flash_timer --; -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - config_default(); - bmp_cfg_db_get_bool (db, section_name, flash_flash_on_beat, &conf_private.flash_on_beat); - bmp_cfg_db_get_int (db, section_name, flash_flash_timer, &conf_private.flash_timer); - bmp_cfg_db_get_float (db, section_name, flash_speed, &conf_private.speed); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_bool (db, section_name, flash_flash_on_beat, conf_private.flash_on_beat); - bmp_cfg_db_set_int (db, section_name, flash_flash_timer, conf_private.flash_timer); - bmp_cfg_db_set_float (db, section_name, flash_speed, conf_private.speed); -} - - -static void -config_default () -{ - conf_private.flash_on_beat = TRUE; - conf_private.flash_timer = 8; - conf_private.speed = 0.01f; -} - -void -flash_flash_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.flash_on_beat = !conf_private_new.flash_on_beat; -} - -static void -flash_value_flash (GtkAdjustment * adj) -{ - conf_private_new.flash_timer = (int)adj->value; -} - -static void -value_speed (GtkAdjustment * adj) -{ - conf_private_new.speed = (GLfloat) (adj->value/1000); -} - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private_new)); - -/* flash on beat */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Flash on beats"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.flash_on_beat); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (flash_flash_toggled), NULL); - - /* number of frame for the flash to propagate */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Flash propagation timer (in frames)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.flash_timer, 1, 50, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (flash_value_flash), NULL); - - /* speed */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Speed"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.speed*1000, 1, 100, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_speed), NULL); -}
--- a/src/iris/theme_float.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,367 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -/* New Theme created by Ron Lockwood-Childs - * Looks best when alpha blending is OFF - */ - -/* $Id: theme_float.c,v 1.1 2002/10/27 19:21:06 cedric Exp $ */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <time.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - -#define HISTORY_SIZE 16 -#define HALF_BOX 0.15 -#define HALF_BOX_Y (HALF_BOX * 2) -#define FAR_LEFT -3.0 -#define FAR_BACK -3.0 -#define BOTTOM -2.6 - - -typedef struct -{ - GLfloat xc; - GLfloat yc; - GLfloat zc; -} triple; - -static struct -{ - int wave_speed; - gfloat num_blocks; -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); -static gfloat speed_to_phase(int speed); -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); - - -static char float_numblocks[] = "float_numblocks"; -static char float_wavespeed[] = "float_wavespeed"; - - -iris_theme theme_float = { - "Floaters", - "A spectrum of floating blocks (alpha blend off for best effect)", - "Ron Lockwood-Childs", - "float", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - -static GLfloat data2[NUM_BANDS][HISTORY_SIZE]; // previous freq band data -static GLfloat phase[HISTORY_SIZE]; // previous angle data - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - -static void -draw_one_frame (gboolean beat) -{ - int t1, t2; // loop vars - GLfloat red, green, blue; - GLfloat y_color = 0.0; - triple ulf, urf, llf, lrf, ulb, urb, llb, lrb; - GLfloat basis[NUM_BANDS]; - int box_height; - int i; - - /* shift all data when a new datarow arrives */ - for (t2 = (HISTORY_SIZE-1); t2 > 0; t2--) - { - for (t1 = 0; t1 < NUM_BANDS; t1++) - { - data2[t1][t2] = data2[t1][t2-1]; - } - phase[t2] = phase[t2-1]; - } - for (t1 = 0; t1 < NUM_BANDS; t1++) - { - data2[t1][0] = datas.data1[t1]; - phase[0] = phase[1] + speed_to_phase(conf_private.wave_speed); - } - - glBegin (GL_QUADS); - - for (t2 = (HISTORY_SIZE-1); t2 >= 0; t2--) - { - for (t1 = 0; t1 < NUM_BANDS; t1++) - { - basis[t1] = BOTTOM + sin( phase[t2] + (speed_to_phase(conf_private.wave_speed) * t1)); - box_height = (int)ceilf( data2[t1][t2] * conf_private.num_blocks ); - - for (i = 0; i < box_height; i++) - { - if (i < (box_height-1)) - { - y_color = (GLfloat)i * (1.0 / (GLfloat)conf_private.num_blocks); - } - else - { - y_color = data2[t1][t2]; - } - get_color (&red, &green, &blue, &y_color); // box color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - - ulf.xc = FAR_LEFT + (HALF_BOX * 3 * t1) - HALF_BOX; - ulf.yc = basis[t1] + (HALF_BOX_Y * 3 * i) + HALF_BOX_Y; - ulf.zc = (FAR_BACK + t2 * HALF_BOX * 3) - HALF_BOX; - - urf.xc = FAR_LEFT + (HALF_BOX * 3 * t1) + HALF_BOX; - urf.yc = basis[t1] + (HALF_BOX_Y * 3 * i) + HALF_BOX_Y; - urf.zc = (FAR_BACK + t2 * HALF_BOX * 3) - HALF_BOX; - - lrf.xc = FAR_LEFT + (HALF_BOX * 3 * t1) + HALF_BOX; - lrf.yc = basis[t1] + (HALF_BOX_Y * 3 * i) - HALF_BOX_Y; - lrf.zc = (FAR_BACK + t2 * HALF_BOX * 3) - HALF_BOX; - - llf.xc = FAR_LEFT + (HALF_BOX * 3 * t1) - HALF_BOX; - llf.yc = basis[t1] + (HALF_BOX_Y * 3 * i) - HALF_BOX_Y; - llf.zc = (FAR_BACK + t2 * HALF_BOX * 3) - HALF_BOX; - - ulb.xc = FAR_LEFT + (HALF_BOX * 3 * t1) - HALF_BOX; - ulb.yc = basis[t1] + (HALF_BOX_Y * 3 * i) + HALF_BOX_Y; - ulb.zc = (FAR_BACK + t2 * HALF_BOX * 3) + HALF_BOX; - - urb.xc = FAR_LEFT + (HALF_BOX * 3 * t1) + HALF_BOX; - urb.yc = basis[t1] + (HALF_BOX_Y * 3 * i) + HALF_BOX_Y; - urb.zc = (FAR_BACK + t2 * HALF_BOX * 3) + HALF_BOX; - - lrb.xc = FAR_LEFT + (HALF_BOX * 3 * t1) + HALF_BOX; - lrb.yc = basis[t1] + (HALF_BOX_Y * 3 * i) - HALF_BOX_Y; - lrb.zc = (FAR_BACK + t2 * HALF_BOX * 3) + HALF_BOX; - - llb.xc = FAR_LEFT + (HALF_BOX * 3 * t1) - HALF_BOX; - llb.yc = basis[t1] + (HALF_BOX_Y * 3 * i) - HALF_BOX_Y; - llb.zc = (FAR_BACK + t2 * HALF_BOX * 3) + HALF_BOX; - - // now start drawin' - // start with the front, then left, back, right, finally the top - - // "front" - glVertex3f (ulf.xc, ulf.yc, ulf.zc); // "top-left" - - glVertex3f (urf.xc, urf.yc, urf.zc); // "top-right" - - glVertex3f (lrf.xc, lrf.yc, lrf.zc); // "bottom-right" - - glVertex3f (llf.xc, llf.yc, llf.zc); // "bottom-left" - - // "back" - glVertex3f (ulb.xc, ulb.yc, ulb.zc); // "top-left" - - glVertex3f (urb.xc, urb.yc, urb.zc); // "top-right" - - glVertex3f (lrb.xc, lrb.yc, lrb.zc); // "bottom-right" - - glVertex3f (llb.xc, llb.yc, llb.zc); // "bottom-left" - - // "left" - glVertex3f( llb.xc, llb.yc, llb.zc); // "bottom-in" - - glVertex3f( llf.xc, llf.yc, llf.zc); // "bottom-out" - - glVertex3f( ulf.xc, ulf.yc, ulf.zc); // "top-out" - - glVertex3f( ulb.xc, ulb.yc, ulb.zc); // "top-in" - - // "top" - glVertex3f( ulb.xc, ulb.yc, ulb.zc); // "left-in" - - glVertex3f( ulf.xc, ulf.yc, ulf.zc); // "left-out" - - glVertex3f( urf.xc, urf.yc, urf.zc); // "right-out" - - glVertex3f( urb.xc, urb.yc, urb.zc); // "right-in" - - // "right" - glVertex3f( urb.xc, urb.yc, urb.zc); // "top-in" - - glVertex3f( urf.xc, urf.yc, urf.zc); // "top-out" - - glVertex3f( lrf.xc, lrf.yc, lrf.zc); // "bottom-out" - - glVertex3f( lrb.xc, lrb.yc, lrb.zc); // "bottom-in" - - // "bottom" - glVertex3f( lrb.xc, lrb.yc, lrb.zc); // "right-in" - - glVertex3f( lrf.xc, lrf.yc, lrf.zc); // "right-out" - - glVertex3f( llf.xc, llf.yc, llf.zc); // "left-out" - - glVertex3f( llb.xc, llb.yc, llb.zc); // "left-in" - } - } - } - - glEnd (); - -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_float (db, section_name, float_numblocks, &conf_private.num_blocks); - bmp_cfg_db_get_int (db, section_name, float_wavespeed, &conf_private.wave_speed); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_float (db, section_name, float_numblocks, conf_private.num_blocks); - bmp_cfg_db_set_int (db, section_name, float_wavespeed, conf_private.wave_speed); -} - - -static void -config_default () -{ - conf_private.num_blocks = 8.0; - conf_private.wave_speed = 4; -} - - -static void -blocks_changed (GtkAdjustment * adj) -{ - conf_private_new.num_blocks = (int) adj->value; -} - - -// speeds: pi/8, pi/12, pi/16, pi/20, pi/24, pi/28, pi/32,0 -static gfloat speed_to_phase(int speed) -{ - gfloat phase; - - if (speed == 0) - { - phase = 0; - } - else - { - phase = M_PI_4/(9-speed); - } - - return phase; -} - -static void -speed_changed (GtkWidget *menuitem, gpointer data) -{ - conf_private_new.wave_speed = GPOINTER_TO_INT(data); -} - - - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - GtkWidget *menu; - GtkWidget *menuitem; - GtkWidget *optionmenu; - gchar *speeds[8] = {"0","1","2","3","4","5","6","7"}; - int i; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private)); - - /* number blocks */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Max number blocks per stack"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.num_blocks, 4, 8, 1, 2, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (blocks_changed), NULL); - - /* set wave speed */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Wave speed"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - menu = gtk_menu_new (); - for (i=0; i<8; i++) - { - menuitem = gtk_menu_item_new_with_label(speeds[i]); - gtk_menu_append(GTK_MENU(menu), menuitem); - gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (speed_changed), GINT_TO_POINTER(i)); - } - optionmenu = gtk_option_menu_new(); - gtk_menu_set_active(GTK_MENU(menu), conf_private.wave_speed); - gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu); - gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 4); - gtk_widget_show (optionmenu); - -}
--- a/src/iris/theme_fountain.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,789 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2004 Marc Pompl (marc.pompl@lynorics.de) - * - * 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. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" -#include "particle.h" - -/* Max number of particles */ -#define MAX_PARTICLES 10000 - -static GLuint texture[1]; /* Storage For Our Particle Texture */ - -static int draw_mode = 0; // the drawing mode - -static GLuint col = 0; /* Current Color Selection */ - -static gboolean fountain_already_initialized = FALSE; - -static float flash_timer = 0; /* timer for flash */ - -static struct -{ - int draw_mode; - gboolean flash_on_beat; - int flash_timer; - - gboolean rainbow; /* Toggle rainbow effect */ - - GLfloat slowdown; /* Slow Down Particles (1.0 - 4.0) */ - GLfloat xspeed; /* Base X Speed */ - GLfloat yspeed; /* Base Y Speed */ - GLfloat up; /* Particles firing upways (0.0 - 1.0) */ - GLfloat side; /* Particles firing sideways (0.0 - 1.0) */ - GLfloat strength; /* Strength of particle blast (0.0 - 1.0) */ - gboolean hide_inactive; /* Disable inactive ("just falling") particles? */ - GLfloat size; /* Size of particles */ - int particles; /* number of particles */ -} -conf_private, conf_private_new; - -static config_theme conf = { - (config_global *) NULL, - &conf_private -}; - -static config_theme conf_new = { - (config_global *) NULL, - &conf_private_new -}; - -static char fountain_flash_on_beat[] = "fountain_flash_on_beat"; -static char fountain_flash_timer[] = "fountain_flash_timer"; -static char fountain_rainbow[] = "fountain_rainbow"; -static char fountain_slowdown[] = "fountain_slowdown"; -static char fountain_xspeed[] = "fountain_xspeed"; -static char fountain_yspeed[] = "fountain_yspeed"; -static char fountain_up[] = "fountain_up"; -static char fountain_side[] = "fountain_side"; -static char fountain_strength[] = "fountain_strength"; -static char fountain_hide_inactive[] = "fountain_hide_inactive"; -static char fountain_size[] = "fountain_size"; -static char fountain_particles[] = "fountain_particles"; - -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); -static void init_draw_mode (void); -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - -iris_theme theme_fountain = { - "fountain", - "an atmospheric particle fountain\nno support for wireframe or solid surfaces\nbased upon NeHe tutorial #19", - "Marc Pompl (marc.pompl@lynorics.de)", - "fountain", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - init_draw_mode, - get_x_angle, - draw_one_frame -}; - -/* Create our particle structure */ -typedef struct -{ - GLint active; /* Active (Yes/No) */ - GLfloat life; /* Particle Life */ - GLfloat fade; /* Fade Speed */ - - GLfloat r; /* Red Value */ - GLfloat g; /* Green Value */ - GLfloat b; /* Blue Value */ - - GLfloat fr; /* Red Flash Value */ - GLfloat fg; /* Green Flash Value */ - GLfloat fb; /* Blue Flash Value */ - - GLfloat x; /* X Position */ - GLfloat y; /* Y Position */ - GLfloat z; /* Z Position */ - - GLfloat xi; /* X Direction */ - GLfloat yi; /* Y Direction */ - GLfloat zi; /* Z Direction */ - - GLfloat xg; /* X Gravity */ - GLfloat yg; /* Y Gravity */ - GLfloat zg; /* Z Gravity */ -} particle; - -/* Rainbow of colors */ -static GLfloat fountain_colors[16][3] = { - {1.0f, 0.5f, 0.5f}, - {1.0f, 0.75f, 0.5f}, - {1.0f, 1.0f, 0.5f}, - - {0.75f, 1.0f, 0.5f}, - - {0.5f, 1.0f, 0.5f}, - {0.5f, 1.0f, 0.75f}, - {0.5f, 1.0f, 1.0f}, - - {0.5f, 0.75f, 1.0f}, - {0.5f, 0.5f, 1.0f}, - {0.75f, 0.5f, 1.0f}, - - {1.0f, 0.5f, 1.0f}, - {1.0f, 0.5f, 0.75f}, - {0.75f, 0.5f, 0.75f}, - - {0.5f, 0.5f, 0.5f}, - {0.75f, 0.75f, 0.75f}, - {1.0f, 1.0f, 1.0f}, -}; - -/* Our beloved array of particles */ -static particle particles[MAX_PARTICLES]; - -void -flashParticleColor (int num) -{ - GLfloat dr; - GLfloat dg; - GLfloat db; - dr = 1 - particles[num].r; - dg = 1 - particles[num].g; - db = 1 - particles[num].b; - particles[num].fr = 1 - dr * dr; - particles[num].fg = 1 - dg * dg; - particles[num].fb = 1 - db * db; -} - -/* function to "load" a GL texture */ -void -loadTexture () -{ - /* Create The Texture */ - glGenTextures (1, &texture[0]); - - /* Typical Texture Generation Using Data From The Bitmap */ - glBindTexture (GL_TEXTURE_2D, texture[0]); - - /* Generate The Texture */ - glTexImage2D (GL_TEXTURE_2D, 0, 3, particle_image.width, - particle_image.height, 0, GL_RGBA, - GL_UNSIGNED_BYTE, particle_image.pixel_data); - - /* Linear Filtering */ - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -} - -/* function to reset one particle to initial state */ -void -ResetParticle (int num, GLint color, GLfloat xDir, GLfloat yDir, GLfloat zDir) -{ - /* Make the particels active */ - particles[num].active = TRUE; - /* Give the particles life */ - particles[num].life = 1.0f; - /* Random Fade Speed */ - particles[num].fade = - (GLfloat) (rand () * 150) / (RAND_MAX + 1.0) / 1000.0f + 0.003f; - /* Select Red Rainbow Color */ - particles[num].r = fountain_colors[color][0]; - /* Select Green Rainbow Color */ - particles[num].g = fountain_colors[color][1]; - /* Select Blue Rainbow Color */ - particles[num].b = fountain_colors[color][2]; - /* Set the position on the X axis */ - particles[num].x = 0.0f; - /* Set the position on the Y axis */ - particles[num].y = 0.0f; - /* Set the position on the Z axis */ - particles[num].z = 0.0f; - /* Random Speed On X Axis */ - particles[num].xi = xDir; - /* Random Speed On Y Axi */ - particles[num].yi = yDir; - /* Random Speed On Z Axis */ - particles[num].zi = zDir; - /* Set Horizontal Pull To Zero */ - particles[num].xg = 0.0f; - /* Set Vertical Pull Downward */ - particles[num].yg = -0.8f; - /* Set Pull On Z Axis To Zero */ - particles[num].zg = 0.0f; - flashParticleColor (num); -} - -static void -initParticle (int num, GLint color, GLfloat value) -{ - GLfloat xi, yi, zi; - xi = conf_private.xspeed + - (GLfloat) ((rand () * 60 - 30.0f) / (RAND_MAX + - 1.0) * 500 * conf_private.side * - (value + conf_private.strength)); - yi = - conf_private.yspeed + - (GLfloat) ((rand () * 100) / (RAND_MAX + 1.0) * 500 * conf_private.up * - (value + conf_private.strength)); - zi = - (GLfloat) ((rand () * 60 - 30.0f) / (RAND_MAX + - 1.0) * 500 * conf_private.side * - (value + conf_private.strength)); - ResetParticle (num, color, xi, yi, zi); -} - -static void -init_draw_mode () -{ - GLfloat ratio; - int loop; - - conf.global->transparency = TRUE; - conf.global->wireframe = FALSE; - - draw_mode = 1 + (int) (3.0 * rand () / (RAND_MAX + 1.0)); - - ratio = (GLfloat) GLWin.window_width / (GLfloat) GLWin.window_height; - - loadTexture (); - /* Enable smooth shading */ - glShadeModel (GL_SMOOTH); - - /* Set the background black */ - glClearColor (0.0f, 0.0f, 0.0f, 0.0f); - - /* Depth buffer setup */ - glClearDepth (1.0f); - - /* Enables Depth Testing */ - glDisable (GL_DEPTH_TEST); - - /* Enable Blending */ - glEnable (GL_BLEND); - - glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - - /* Type Of Blending To Perform */ - glBlendFunc (GL_SRC_ALPHA, GL_ONE); - - /* Really Nice Perspective Calculations */ - glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - /* Really Nice Point Smoothing */ - glHint (GL_POINT_SMOOTH_HINT, GL_NICEST); - - /* Enable Texture Mapping */ - glEnable (GL_TEXTURE_2D); - /* Select Our Texture */ - glBindTexture (GL_TEXTURE_2D, texture[0]); - - /* Reset all the particles */ - if (!fountain_already_initialized) - { - for (loop = 0; loop < MAX_PARTICLES; loop++) - { - GLint color = (loop + 1) / (MAX_PARTICLES / 16); - initParticle (loop, color, (rand () * 0.5f) / (RAND_MAX + 1.0)); - } - } - fountain_already_initialized = TRUE; -} - - -static GLfloat -get_x_angle () -{ - return (5.0 + (int) (30.0 * rand () / (RAND_MAX + 1.0))); -} - -static void -draw_one_frame (gboolean beat) -{ - int loop; - if ((beat) && (conf_private.flash_on_beat)) - flash_timer = conf_private.flash_timer; - - /* If rainbow coloring is turned on, cycle the colors */ - if (conf_private.rainbow) // && ( delay > 25 ) ) - { - col++; - col = col % 16; - } - - /* Modify each of the particles */ - for (loop = 0; loop < MAX_PARTICLES; loop++) - { - /* Grab Our Particle X Position */ - GLfloat x = particles[loop].x; - /* Grab Our Particle Y Position */ - GLfloat y = particles[loop].y; - /* Particle Z Position + Zoom */ - GLfloat z = particles[loop].z; - - if ((loop < conf_private.particles) && (particles[loop].active)) - { - /* Draw The Particle Using Our RGB Values, - * Fade The Particle Based On It's Life - */ - if ((conf_private.flash_on_beat) && (flash_timer > 0)) - glColor4f (particles[loop].fr, - particles[loop].fg, - particles[loop].fb, particles[loop].life); - else if (conf_private.rainbow) - glColor4f (particles[loop].r, - particles[loop].g, - particles[loop].b, particles[loop].life); - else - { - GLfloat r, g, b; - get_color (&r, &g, &b, &datas.data1[loop % NUM_BANDS]); - glColor4f (r, g, b, particles[loop].life); - } - - /* Build Quad From A Triangle Strip */ - glBegin (GL_TRIANGLE_STRIP); - /* Top Right */ - glTexCoord2d (1, 1); - glVertex3f (x + conf_private.size, y + conf_private.size, z); - /* Top Left */ - glTexCoord2d (0, 1); - glVertex3f (x - conf_private.size, y + conf_private.size, z); - /* Bottom Right */ - glTexCoord2d (1, 0); - glVertex3f (x + conf_private.size, y - conf_private.size, z); - /* Bottom Left */ - glTexCoord2d (0, 0); - glVertex3f (x - conf_private.size, y - conf_private.size, z); - glEnd (); - - glBegin (GL_TRIANGLE_STRIP); - /* Top Right */ - glTexCoord2d (1, 1); - glVertex3f (x, y + conf_private.size, z + conf_private.size); - /* Top Left */ - glTexCoord2d (0, 1); - glVertex3f (x, y + conf_private.size, z - conf_private.size); - /* Bottom Right */ - glTexCoord2d (1, 0); - glVertex3f (x, y - conf_private.size, z + conf_private.size); - /* Bottom Left */ - glTexCoord2d (0, 0); - glVertex3f (x, y - conf_private.size, z - conf_private.size); - glEnd (); - - glBegin (GL_TRIANGLE_STRIP); - /* Top Right */ - glTexCoord2d (1, 1); - glVertex3f (x + conf_private.size, y, z + conf_private.size); - /* Top Left */ - glTexCoord2d (0, 1); - glVertex3f (x + conf_private.size, y, z - conf_private.size); - /* Bottom Right */ - glTexCoord2d (1, 0); - glVertex3f (x - conf_private.size, y, z + conf_private.size); - /* Bottom Left */ - glTexCoord2d (0, 0); - glVertex3f (x - conf_private.size, y, z - conf_private.size); - glEnd (); - } - - if (flash_timer > 0) - { - /* Move On The X Axis By X Speed */ - particles[loop].x += particles[loop].xi / - (conf_private.slowdown * 2000); - /* Move On The Y Axis By Y Speed */ - particles[loop].y += particles[loop].yi / - (conf_private.slowdown * 2000); - /* Move On The Z Axis By Z Speed */ - particles[loop].z += particles[loop].zi / - (conf_private.slowdown * 2000); - } - else - { - /* Move On The X Axis By X Speed */ - particles[loop].x += particles[loop].xi / - (conf_private.slowdown * 1000); - /* Move On The Y Axis By Y Speed */ - particles[loop].y += particles[loop].yi / - (conf_private.slowdown * 1000); - /* Move On The Z Axis By Z Speed */ - particles[loop].z += particles[loop].zi / - (conf_private.slowdown * 1000); - } - /* Take Pull On X Axis Into Account */ - particles[loop].xi += particles[loop].xg; - /* Take Pull On Y Axis Into Account */ - particles[loop].yi += particles[loop].yg; - /* Take Pull On Z Axis Into Account */ - particles[loop].zi += particles[loop].zg; - /* If the particle dies, revive it */ - /* Reduce Particles Life By 'Fade' */ - particles[loop].life -= particles[loop].fade; - - if (particles[loop].life < 0.0f) - { - if (conf_private.rainbow) - initParticle (loop, col, datas.data1[col]); - else - initParticle (loop, col, - datas. - data1[(int) - ((rand () * NUM_BANDS) / (RAND_MAX + 1.0))]); - if ((conf_private.hide_inactive) && (datas.data1[col] == 0.0f)) - particles[loop].active = FALSE; - - } - } - if (flash_timer > 0) - flash_timer--; -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_bool (db, section_name, fountain_flash_on_beat, &conf_private.flash_on_beat); - bmp_cfg_db_get_int (db, section_name, fountain_flash_timer, &conf_private.flash_timer); - bmp_cfg_db_get_bool (db, section_name, fountain_rainbow, &conf_private.rainbow); - bmp_cfg_db_get_float (db, section_name, fountain_slowdown, &conf_private.slowdown); - bmp_cfg_db_get_float (db, section_name, fountain_xspeed, &conf_private.xspeed); - bmp_cfg_db_get_float (db, section_name, fountain_yspeed, &conf_private.yspeed); - bmp_cfg_db_get_float (db, section_name, fountain_up, &conf_private.up); - bmp_cfg_db_get_float (db, section_name, fountain_side, &conf_private.side); - bmp_cfg_db_get_float (db, section_name, fountain_strength, &conf_private.strength); - bmp_cfg_db_get_bool (db, section_name, fountain_hide_inactive, &conf_private.hide_inactive); - bmp_cfg_db_get_float (db, section_name, fountain_size, &conf_private.size); - bmp_cfg_db_get_int (db, section_name, fountain_particles, &conf_private.particles); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_bool (db, section_name, fountain_flash_on_beat, conf_private.flash_on_beat); - bmp_cfg_db_set_int (db, section_name, fountain_flash_timer, conf_private.flash_timer); - bmp_cfg_db_set_bool (db, section_name, fountain_rainbow, conf_private.rainbow); - bmp_cfg_db_set_float (db, section_name, fountain_slowdown, conf_private.slowdown); - bmp_cfg_db_set_float (db, section_name, fountain_xspeed, conf_private.xspeed); - bmp_cfg_db_set_float (db, section_name, fountain_yspeed, conf_private.yspeed); - bmp_cfg_db_set_float (db, section_name, fountain_up, conf_private.up); - bmp_cfg_db_set_float (db, section_name, fountain_side, conf_private.side); - bmp_cfg_db_set_float (db, section_name, fountain_strength, conf_private.strength); - bmp_cfg_db_set_bool (db, section_name, fountain_hide_inactive, conf_private.hide_inactive); - bmp_cfg_db_set_float (db, section_name, fountain_size, conf_private.size); - bmp_cfg_db_set_int (db, section_name, fountain_particles, conf_private.particles); -} - - -static void -config_default () -{ - conf_private.flash_on_beat = TRUE; - conf_private.flash_timer = 8; - - conf_private.rainbow = TRUE; - conf_private.slowdown = 2.0f; - conf_private.xspeed = 0.0f; - conf_private.yspeed = 1.0f; - conf_private.up = 0.8f; - conf_private.side = 0.2f; - conf_private.strength = 0.1f; - conf_private.hide_inactive = TRUE; - conf_private.size = 0.16f; - conf_private.particles = 1000; -} - -void -flash_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.flash_on_beat = !conf_private_new.flash_on_beat; -} - -static void -value_flash (GtkAdjustment * adj) -{ - conf_private_new.flash_timer = (float) adj->value; -} - -void -hide_inactive_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.hide_inactive = !conf_private_new.hide_inactive; -} - -void -rainbow_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.rainbow = !conf_private_new.rainbow; -} - -static void -value_slowdown (GtkAdjustment * adj) -{ - conf_private_new.slowdown = (float) adj->value / 100; -} - -static void -value_up (GtkAdjustment * adj) -{ - conf_private_new.up = (float) adj->value / 100; -} - -static void -value_side (GtkAdjustment * adj) -{ - conf_private_new.side = (float) adj->value / 100; -} - -static void -value_strength (GtkAdjustment * adj) -{ - conf_private_new.strength = (float) adj->value / 100; -} - -static void -value_size (GtkAdjustment * adj) -{ - conf_private_new.size = (float) adj->value / 100; -} - -static void -value_particles (GtkAdjustment * adj) -{ - conf_private_new.particles = (float) adj->value; -} -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private_new)); - - /* Number of particles */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Number of particles"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.particles, 1, MAX_PARTICLES, 1, 10, - 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_particles), NULL); - - /* wave on beat */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Flash on beats"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.flash_on_beat); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (flash_toggled), NULL); - - /* number of frame for the wave to propagate */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Flash propagation timer (in frames)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.flash_timer, 1, 50, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_flash), NULL); - - /* strength for up firing */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Slowdown"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.slowdown * 100, 100, 400, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_slowdown), NULL); - - /* strength for up firing */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Strength of up firing"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.up * 100, 1, 100, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_up), NULL); - - /* strength for side firing */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Strength of side firing"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.side * 100, 1, 100, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_side), NULL); - - /* overall strength */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Strength"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.strength * 100, 1, 100, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_strength), NULL); - - /* Toggle inactive particles */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Hide inactive particles"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.hide_inactive); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (hide_inactive_toggled), NULL); - - /* Toggle rainbow */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Rainbow colors"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.rainbow); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (rainbow_toggled), NULL); - - /* size of particles */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Size of particles"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.size * 100, 1, 100, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_size), NULL); - -}
--- a/src/iris/theme_knot.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,415 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - - -static struct -{ -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static void init (void); -static void cleanup (void); -static void init_draw_mode (void); -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_knot = { - "Knot", - "Dancing knot", - "Pascal Brochart for Nebulus, adapted for Iris by foser", - "knot", - &conf, - &conf_new, - sizeof (conf_private), - NULL, - NULL, - NULL, - NULL, - init, - cleanup, - init_draw_mode, - get_x_angle, - draw_one_frame, -}; - - -gboolean reverse = FALSE; -GLfloat knot_time; - -typedef struct -{ - GLfloat x, y, z; -} -glcoord; - -typedef struct -{ - GLfloat r, g, b; -} -glcolors; - -typedef struct -{ - int numfaces, numverts, numsides; - GLuint faces[16 * 64 * 4 * 4]; - glcoord vertices[16 * 64]; - glcolors Colors[16 * 64]; -} -tknotobject; - -tknotobject *knotobject; - - -void -createknot (int scaling_factor1, int scaling_factor2, GLfloat radius1, - GLfloat radius2, GLfloat radius3) -{ - int count1, count2; - GLfloat alpha, beta, distance, mindistance, rotation; - GLfloat x, y, z, dx, dy, dz; - GLfloat value, modulus, dist; - int index1, index2; - - knotobject->numsides = 4; - - knotobject->numverts = 0; - alpha = 0; - for (count2 = 0; count2 < scaling_factor2; count2++) - { - alpha = alpha + 2 * M_PI / scaling_factor2; - x = radius2 * cos (2 * alpha) + radius1 * sin (alpha); - y = radius2 * sin (2 * alpha) + radius1 * cos (alpha); - z = radius2 * cos (3 * alpha); - dx = -2 * radius2 * sin (2 * alpha) + radius1 * cos (alpha); - dy = 2 * radius2 * cos (2 * alpha) - radius1 * sin (alpha); - dz = -3 * radius2 * sin (3 * alpha); - value = sqrt (dx * dx + dz * dz); - modulus = sqrt (dx * dx + dy * dy + dz * dz); - - beta = 0; - for (count1 = 0; count1 < scaling_factor1; count1++) - { - beta = beta + 2 * M_PI / scaling_factor1; - - knotobject->vertices[knotobject->numverts].x = - x - radius3 * (cos (beta) * dz - - sin (beta) * dx * dy / modulus) / value; - knotobject->vertices[knotobject->numverts].y = - y - radius3 * sin (beta) * value / modulus; - knotobject->vertices[knotobject->numverts].z = - z + radius3 * (cos (beta) * dx + - sin (beta) * dy * dz / modulus) / value; - - - dist = - sqrt (knotobject->vertices[knotobject->numverts].x * - knotobject->vertices[knotobject->numverts].x + - knotobject->vertices[knotobject->numverts].y * - knotobject->vertices[knotobject->numverts].y + - knotobject->vertices[knotobject->numverts].z * - knotobject->vertices[knotobject->numverts].z); - - knotobject->Colors[knotobject->numverts].r = - ((2 / dist) + (0.5 * sin (beta) + 0.4)) / 2.0; - knotobject->Colors[knotobject->numverts].g = - ((2 / dist) + (0.5 * sin (beta) + 0.4)) / 2.0; - knotobject->Colors[knotobject->numverts].b = - ((2 / dist) + (0.5 * sin (beta) + 0.4)) / 2.0; - - knotobject->numverts++; - } - } - - for (count1 = 0; count1 < scaling_factor2; count1++) - { - index1 = count1 * scaling_factor1; - index2 = index1 + scaling_factor1; - index2 = index2 % knotobject->numverts; - rotation = 0; - mindistance = - (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) * (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) + - (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) * (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) + - (knotobject->vertices[index1].z - - knotobject->vertices[index2].z) * (knotobject->vertices[index1].z - - knotobject->vertices[index2].z); - for (count2 = 1; count2 < scaling_factor1; count2++) - { - index2 = count2 + index1 + scaling_factor1; - if (count1 == scaling_factor2 - 1) - index2 = count2; - distance = - (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) * (knotobject->vertices[index1].x - - knotobject->vertices[index2]. - x) + - (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) * (knotobject->vertices[index1].y - - knotobject->vertices[index2]. - y) + - (knotobject->vertices[index1].z - - knotobject->vertices[index2].z) * (knotobject->vertices[index1].z - - knotobject->vertices[index2].z); - if (distance < mindistance) - { - mindistance = distance; - rotation = count2; - } - } - - for (count2 = 0; count2 < scaling_factor1; count2++) - { - knotobject->faces[4 * (index1 + count2) + 0] = index1 + count2; - - index2 = count2 + 1; - index2 = index2 % scaling_factor1; - knotobject->faces[4 * (index1 + count2) + 1] = index1 + index2; - - index2 = (count2 + rotation + 1); - index2 = index2 % scaling_factor1; - knotobject->faces[4 * (index1 + count2) + 2] = - (index1 + index2 + scaling_factor1) % knotobject->numverts; - - index2 = (count2 + rotation); - index2 = index2 % scaling_factor1; - - knotobject->faces[4 * (index1 + count2) + 3] = - (index1 + index2 + scaling_factor1) % knotobject->numverts; - knotobject->numfaces++; - } - } -} - - -static void -init () -{ - knotobject = (tknotobject *)malloc(sizeof(tknotobject)); - createknot (16, 64, 2, 2.0, 1.0); -} - - -static void -cleanup() -{ - free(knotobject); -} - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -init_draw_mode () -{ - //don't think all of this really is needed here.. - glDepthFunc (GL_LESS); - glDisable (GL_NORMALIZE); - glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - - glDisable (GL_BLEND); - glEnable (GL_DEPTH_TEST); -} - - -void -recalculateknot (int scaling_factor1, int scaling_factor2, GLfloat radius1, - GLfloat radius2, GLfloat radius3) -{ - int count1, count2; - GLfloat alpha, beta; - GLfloat x, y, z, dx, dy, dz; - GLfloat value, modulus; - int index1, index2; - GLfloat distance, Mindistance, rotation; - - knotobject->numverts = 0; - alpha = 0; - for (count2 = 0; count2 < scaling_factor2; count2++) - { - alpha = alpha + 2 * M_PI / scaling_factor2; - x = radius2 * cos (2 * alpha) + radius1 * sin (alpha); - y = radius2 * sin (2 * alpha) + radius1 * cos (alpha); - z = radius2 * cos (3 * alpha); - dx = -2 * radius2 * sin (2 * alpha) + radius1 * cos (alpha); - dy = 2 * radius2 * cos (2 * alpha) - radius1 * sin (alpha); - dz = -3 * radius2 * sin (3 * alpha); - value = sqrt (dx * dx + dz * dz); - modulus = sqrt (dx * dx + dy * dy + dz * dz); - - beta = 0; - for (count1 = 0; count1 < scaling_factor1; count1++) - { - beta = beta + 2 * M_PI / scaling_factor1; - - knotobject->vertices[knotobject->numverts].x = - x - radius3 * (cos (beta) * dz - - sin (beta) * dx * dy / modulus) / value; - knotobject->vertices[knotobject->numverts].y = - y - radius3 * sin (beta) * value / modulus; - knotobject->vertices[knotobject->numverts].z = - z + radius3 * (cos (beta) * dx + - sin (beta) * dy * dz / modulus) / value; - - knotobject->numverts++; - } - } - - knotobject->numfaces = 0; - for (count1 = 0; count1 < scaling_factor2; count1++) - { - index1 = count1 * scaling_factor1; - index2 = index1 + scaling_factor1; - index2 = index2 % knotobject->numverts; - rotation = 0; - Mindistance = - (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) * (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) + - (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) * (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) + - (knotobject->vertices[index1].z - - knotobject->vertices[index2].z) * (knotobject->vertices[index1].z - - knotobject->vertices[index2].z); - for (count2 = 1; count2 < scaling_factor1; count2++) - { - index2 = count2 + index1 + scaling_factor1; - if (count1 == scaling_factor2 - 1) - index2 = count2; - distance = - (knotobject->vertices[index1].x - - knotobject->vertices[index2].x) * (knotobject->vertices[index1].x - - knotobject->vertices[index2]. - x) + - (knotobject->vertices[index1].y - - knotobject->vertices[index2].y) * (knotobject->vertices[index1].y - - knotobject->vertices[index2]. - y) + - (knotobject->vertices[index1].z - - knotobject->vertices[index2].z) * (knotobject->vertices[index1].z - - knotobject->vertices[index2].z); - if (distance < Mindistance) - { - Mindistance = distance; - rotation = count2; - } - } - - for (count2 = 0; count2 < scaling_factor1; count2++) - { - knotobject->faces[4 * (index1 + count2) + 0] = index1 + count2; - - //removes draw artifacts - //if (point_general->hide_glue) - index2 = index2 % scaling_factor1; - - knotobject->faces[4 * (index1 + count2) + 2] = - (index1 + index2 + scaling_factor1) % knotobject->numverts; - - index2 = count2 + rotation; - index2 = index2 % scaling_factor1; - - knotobject->faces[4 * (index1 + count2) + 3] = - (index1 + index2 + scaling_factor1) % knotobject->numverts; - knotobject->numfaces++; - } - } -} - - -void -draw_the_knot (void) -{ - int i, j, num; - float red, green, blue, peak; - - glBegin (GL_QUADS); - j = knotobject->numfaces * 4; - for (i = 0; i < j; i++) - { - num = knotobject->faces[i]; - - //adapted to use Iris colors - get_color (&red, &green, &blue, &peak); - glColor3f (knotobject->Colors[num].r * red, - knotobject->Colors[num].g * green, knotobject->Colors[num].b); - glVertex3f (knotobject->vertices[num].x, knotobject->vertices[num].y, - knotobject->vertices[num].z); - } - glEnd (); -} - - -void -createknotpolygons (void) -{ - if (datas.loudness > 12000) - if (reverse) - knot_time -= 12000.0f / (16.0f * config.fps); - else - knot_time += 12000.0f / (16.0f * config.fps); - else if (reverse) - knot_time -= datas.loudness / (16.0f * config.fps); - else - knot_time += datas.loudness / (16.0f * config.fps); - - recalculateknot (16, 64, 3 * sin (0.015 * knot_time) + 0.8, - 3 * cos (0.008 * knot_time) + 0.8, 1.1); - - glTranslatef (0.0f, 0.0f, 0.0f); - draw_the_knot (); -} - - -static void -draw_one_frame (gboolean beat) -{ - if (beat) - reverse = !reverse; - glPushMatrix (); - /* scale it all down to Iris sizes */ - glScalef (0.5, 0.5, 0.5); - createknotpolygons (); - glPopMatrix (); -}
--- a/src/iris/theme_original.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,366 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - -GLfloat jump[16] = - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0 -}; - -xz xz1, xz2, xz3, xz4; - -static int draw_mode = 0; // the drawing mode - -static struct -{ - int draw_mode; - int angle_step; - gboolean wave_on_beat; - GLfloat wave_height; - int wave_timer; - GLfloat radius; - GLfloat interband; - GLfloat linelength; -} -conf_private, conf_private_new; - -static config_theme conf = { - (config_global *) NULL, - &conf_private -}; - -static config_theme conf_new = { - (config_global *) NULL, - &conf_private_new -}; - -static char original_draw_mode[] = "original_draw_mode"; -static char original_angle_step[] = "original_angle_step"; -static char original_wave_on_beat[] = "original_wave_on_beat"; -static char original_wave_height[] = "original_wave_height"; -static char original_wave_timer[] = "original_wave_timer"; -static char original_radius[] = "original_radius"; -static char original_interband[] = "original_interband"; -static char original_linelength[] = "original_linelength"; - -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); -static void init_draw_mode (void); -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - -iris_theme theme_original = { - "Original", - "A 360 degrees spectrum analyzer", - "Cédric Delfosse (cdelfosse@free.fr)", - "original", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - init_draw_mode, - get_x_angle, - draw_one_frame -}; - - -static void -shift_jump () -{ - int i; - - for (i = 15; i > 0; i--) - jump[i] = jump[i - 1]; - jump[0] = 0.0; -} - - -static void -init_draw_mode () -{ - draw_mode = 1 + (int) (3.0 * rand () / (RAND_MAX + 1.0)); -} - - -static GLfloat -get_x_angle () -{ - if (draw_mode == 3) - return (45.0 + (int) (30.0 * rand () / (RAND_MAX + 1.0))); - else - return (55.0 + (int) (35.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - static unsigned int cpt = 0; - static float a = 1.0; - static float b = 1.0; - int d = 0; - float step; - float rad = (float) ((2 * M_PI * d) / 360); - float cosv = a * (float) cos (rad); - float sinv = b * (float) sin (rad); - - if ((conf_private.wave_on_beat) && (beat)) - jump[0] = conf_private.wave_height; - - - glBegin (GL_QUADS); - for (d = 0, step = 0; d < 360; d = d + conf_private.angle_step) - { - int l; - float rad2 = (float) ((2 * M_PI * (d + conf_private.angle_step)) / 360); - float cosv2 = a * (float) cos (rad2); - float sinv2 = b * (float) sin (rad2); - - for (l = 0; l < 16; l++) - { - int i; - GLfloat red, green, blue; - xz xz1, xz2, xz3, xz4; - - GLfloat y; - GLfloat u = (float) (l * conf_private.interband * cosv); - GLfloat v = (float) (l * conf_private.interband * sinv); - GLfloat u2 = (float) (l * conf_private.interband * cosv2); - GLfloat v2 = (float) (l * conf_private.interband * sinv2); - - xz1.x = u + (conf_private.radius + conf_private.linelength) * cosv; - xz1.z = v + (conf_private.radius + conf_private.linelength) * sinv; - xz2.x = u + conf_private.radius * cosv; - xz2.z = v + conf_private.radius * sinv; - xz3.x = - u2 + (conf_private.radius + conf_private.linelength) * cosv2; - xz3.z = - v2 + (conf_private.radius + conf_private.linelength) * sinv2; - xz4.x = u2 + conf_private.radius * cosv2; - xz4.z = v2 + conf_private.radius * sinv2; - - // calculate the height of the bar - // this makes a fade with the past drawn values - for (i = 0, y = 0; i < conf_private.angle_step; i++) - y += datas.data360[d + i][l]; - y /= (float) conf_private.angle_step; - - // get the color associated with the height of the bar - if (y != 0.0) - get_color (&red, &green, &blue, &y); - else - break; // we draw nothing if the signal is null - - y *= 4; // should be in the config ? - - if (conf_private.wave_on_beat) - y += jump[l]; - - switch (draw_mode) - { - case 1: - // draw a bar - { - glColor4f (red / 2, green / 2, blue / 2, 0.3); - bar_side (y, &xz1, &xz2); - bar_side (y, &xz3, &xz4); - bar_side (y, &xz1, &xz3); - bar_side (y, &xz2, &xz4); - if (jump[l]) - glColor4f (config.color_flash_red, config.color_flash_green, - config.color_flash_blue, 0.3); - else - glColor4f (red, green, blue, 0.3); - bar_top_or_bottom (y, &xz1, &xz2, &xz3, &xz4); - - break; - } - case 2: - // draw only the top of a bar - { - if (jump[l]) - glColor4f (config.color_flash_red, config.color_flash_green, - config.color_flash_blue, 0.3); - else - glColor4f (red, green, blue, 0.3); - bar_top_or_bottom (y, &xz1, &xz2, &xz3, &xz4); - - break; - } - case 3: - // draw only a side of a bar - { - if (jump[l]) - glColor4f (config.color_flash_red, config.color_flash_green, - config.color_flash_blue, 0.3); - else - glColor4f (red, green, blue, 0.3); - bar_side (y, &xz3, &xz4); - - break; - } - case 4: - //draw only another side of a bar - { - if (jump[l]) - glColor4f (config.color_flash_red, config.color_flash_green, - config.color_flash_blue, 0.3); - else - glColor4f (red, green, blue, 0.3); - bar_side (y, &xz1, &xz3); - - break; - } - - } // switch - - } // for(l=0 - - rad = rad2; - cosv = cosv2; - sinv = sinv2; - - } // for(d=0 - - if (!cpt) - { - shift_jump (); - cpt = conf_private.wave_timer; - } - cpt--; - - glEnd (); - -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_int (db, section_name, original_draw_mode, &conf_private.draw_mode); - bmp_cfg_db_get_int (db, section_name, original_angle_step, &conf_private.angle_step); - bmp_cfg_db_get_bool (db, section_name, original_wave_on_beat, &conf_private.wave_on_beat); - bmp_cfg_db_get_float (db, section_name, original_wave_height, &conf_private.wave_height); - bmp_cfg_db_get_int (db, section_name, original_wave_timer, &conf_private.wave_timer); - bmp_cfg_db_get_float (db, section_name, original_radius, &conf_private.radius); - bmp_cfg_db_get_float (db, section_name, original_interband, &conf_private.interband); - bmp_cfg_db_get_float (db, section_name, original_linelength, &conf_private.linelength); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_int (db, section_name, original_draw_mode, conf_private.draw_mode); - bmp_cfg_db_set_int (db, section_name, original_angle_step, conf_private.angle_step); - bmp_cfg_db_set_bool (db, section_name, original_wave_on_beat, conf_private.wave_on_beat); - bmp_cfg_db_set_float (db, section_name, original_wave_height, conf_private.wave_height); - bmp_cfg_db_set_int (db, section_name, original_wave_timer, conf_private.wave_timer); - bmp_cfg_db_set_float (db, section_name, original_radius, conf_private.radius); - bmp_cfg_db_set_float (db, section_name, original_interband, conf_private.interband); - bmp_cfg_db_set_float (db, section_name, original_linelength, conf_private.linelength); -} - - -static void -config_default () -{ - conf_private.draw_mode = 2; - conf_private.angle_step = 8; - conf_private.wave_on_beat = TRUE; - conf_private.wave_height = 0.5; - conf_private.wave_timer = 5; - conf_private.radius = 0.4; - conf_private.interband = 0.25; - conf_private.linelength = 0.11; -} - - -void -jumpbeat_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.wave_on_beat = !conf_private_new.wave_on_beat; -} - - -static void -value_jump_speed (GtkAdjustment * adj) -{ - conf_private_new.wave_timer = (int) adj->value; -} - - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private_new)); - - /* wave on beat */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Wave on beats"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.wave_on_beat); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (jumpbeat_toggled), NULL); - - /* number of frame for the wave to propagate */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Wave propagation timer (in frames)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.wave_timer, 1, 50, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (value_jump_speed), NULL); -}
--- a/src/iris/theme_pinwheel.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,407 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -/* New Theme created by Ron Lockwood-Childs - * Looks best when alpha blending is on - */ - -/* $Id: theme_pinwheel.c,v 1.5 2002/05/16 20:38:17 cedric Exp $ */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <time.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - -#define NUM_PER_RING 8 -#define GAP (M_PI_4) - -#define RANDOM_HEIGHT_COUNTDOWN 60 - - -static struct -{ - gboolean height_random; - gfloat height_set; - gfloat height; - gfloat num_sections; -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); - - -static char pinwheel_numsec[] = "pinwheel_numsec"; -static char pinwheel_hrandom[] = "pinwheel_hrandom"; -static char pinwheel_hset[] = "pinwheel_hset"; - - -iris_theme theme_pinwheel = { - "PinWheel", - "A spectrum of pinwheels", - "Ron Lockwood-Childs", - "pinwheel", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -static time_t time_random = 0; // timer for random height mode - -static GLfloat data2[NUM_BANDS]; // previous freq band data -static GLfloat angle[NUM_BANDS]; // previous angle data -static GLfloat radii[NUM_BANDS + 2] = - { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, - 4.0f, 4.5f, 5.0f, 5.5f, 6.0f, 6.5f, 7.0f, 7.5f, - 8.0f -}; - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -set_height (void) -{ - time_t cur_time = time (NULL); // current time - - if (conf_private.height_random) - { - /* we are in random height mode, see if it time to change height */ - if (cur_time - time_random > RANDOM_HEIGHT_COUNTDOWN) - { - /* generate float 1 <= x <= 3 */ - conf_private.height = ((gfloat) rand () * 2.0 / RAND_MAX) + 1.0; - - /* reset timer for when to generate new random height */ - time_random = time (NULL); - } - } - else - { - conf_private.height = conf_private.height_set; - } -} - - -static void -draw_one_frame (gboolean beat) -{ - int t1, t2; // loop vars - GLfloat red, green, blue; - GLfloat z = 0.0; - GLfloat scaler = 2.0f; // scales the whole field - lower is bigger - GLfloat scaleh; // height of the bar - lower is smaller - GLfloat xin_up, zin_up, xin_dn, zin_dn, xot_up, zot_up, xot_dn, zot_dn; - GLfloat rin, rot; // radius of inner and outer edges of p-gram - GLfloat angle_up, angle_dn; // angles of top and bottom of p-gram - GLfloat differ; // holds the angle increment - GLfloat maxdropoff = 0.05; // smooth changes in heights - GLfloat angle_step; - - /* update bar height (could be changing randomly over time) */ - set_height (); - scaleh = conf_private.height; - - /* internal routine to shift all data when a new datarow arrives */ - for (t1 = 0; t1 < 16; t1++) - { - differ = data2[t1] - datas.data1[t1]; - // Rotate counter c.w. if differ positive, c.w. if negative - angle[t1] += (differ * M_PI_4 / 3.0f); // max angle change = +/- PI/12 - if (angle[t1] > (2.0f * M_PI)) - { // cap angle at 360 - angle[t1] -= (2.0f * M_PI); - } - else if (angle[t1] < 0) - { // keep angle positive - angle[t1] += (2.0f * M_PI); - } - - // smooth bar height changes - if (datas.data1[t1] > data2[t1]) - { - if ((datas.data1[t1] - data2[t1]) > maxdropoff) - data2[t1] += maxdropoff; - else - data2[t1] += datas.data1[t1]; - } - else if (datas.data1[t1] < data2[t1]) - { - if ((data2[t1] - datas.data1[t1]) > maxdropoff) - data2[t1] -= maxdropoff; - else - data2[t1] -= datas.data1[t1]; - } - } - - glBegin (GL_QUADS); - - for (t1 = 0; t1 < 16; t1++) - { // iterate thru rings - - // calculate inner and outer radius for this ring of p-grams - rin = (radii[t1 + 1] - ((radii[1] - radii[0]) / 2.0f)) / scaler; - rot = (radii[t1 + 1] + ((radii[1] - radii[0]) / 2.0f)) / scaler; - for (t2 = 0; t2 < conf_private.num_sections; t2++) - { // iterate thru bars in a single ring - - angle_step = - angle[t1] + (t2 * 2 * M_PI / conf_private.num_sections); - if (angle_step > (M_PI * 2)) - angle_step -= (M_PI * 2); - else if (angle_step < 0) - angle_step += (M_PI * 2); - // calculate upper and lower angles for this p-gram - angle_up = angle_step + (M_PI_2 / 9.0f); - angle_dn = angle_step - (M_PI_2 / 9.0f); - // now figure out all the p-gram vertices - xin_dn = cos (angle_dn) * rin; - zin_dn = sin (angle_dn) * rin; - xin_up = cos (angle_up) * rin; - zin_up = sin (angle_up) * rin; - xot_dn = cos (angle_dn) * rot; - zot_dn = sin (angle_dn) * rot; - xot_up = cos (angle_up) * rot; - zot_up = sin (angle_up) * rot; - - // now start drawin' - // start with the front, then left, back, right, finally the top - - // "front" - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_dn, data2[t1] * scaleh, zot_dn); // "top-right" - - get_color (&red, &green, &blue, &z); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_dn, z, zot_dn); // "bottom-right" - glVertex3f (xin_dn, z, zin_dn); // "bottom-left" - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_dn, data2[t1] * scaleh, zin_dn); // "top-left" - - // "left" - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_dn, data2[t1] * scaleh, zin_dn); // "top-out" - - get_color (&red, &green, &blue, &z); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_dn, z, zin_dn); // "bottom-out" - glVertex3f (xin_up, z, zin_up); // "bottom-in" - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_up, data2[t1] * scaleh, zin_up); // "top-in" - - // "back" - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_up, data2[t1] * scaleh, zin_up); // "top-left" - - get_color (&red, &green, &blue, &z); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xin_up, z, zin_up); // "bottom-left" - glVertex3f (xot_up, z, zot_up); // "bottom-right" - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_up, data2[t1] * scaleh, zot_up); // "top-right" - - // "right" - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_up, data2[t1] * scaleh, zot_up); // "top-in" - - get_color (&red, &green, &blue, &z); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_up, z, zot_up); // "bottom-in" - glVertex3f (xot_dn, z, zot_dn); // "bottom-out" - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_dn, data2[t1] * scaleh, zot_dn); // "top-out" - - // "top" - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - glVertex3f (xot_dn, data2[t1] * scaleh, zot_dn); // "out-right" - glVertex3f (xin_dn, data2[t1] * scaleh, zin_dn); // "out-left" - glVertex3f (xin_up, data2[t1] * scaleh, zin_up); // "in-left" - glVertex3f (xot_up, data2[t1] * scaleh, zot_up); // "in-right" - - } - } - - glEnd (); - -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_float (db, section_name, pinwheel_numsec, &conf_private.num_sections); - bmp_cfg_db_get_bool (db, section_name, pinwheel_hrandom, &conf_private.height_random); - bmp_cfg_db_get_float (db, section_name, pinwheel_hset, &conf_private.height_set); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_float (db, section_name, pinwheel_numsec, conf_private.num_sections); - bmp_cfg_db_set_bool (db, section_name, pinwheel_hrandom, conf_private.height_random); - bmp_cfg_db_set_float (db, section_name, pinwheel_hset, conf_private.height_set); -} - - -static void -config_default () -{ - conf_private.num_sections = 8.0; - conf_private.height_random = FALSE; - conf_private.height_set = 2.0; - conf_private.height = 2.0; -} - - -static void -sections_changed (GtkAdjustment * adj) -{ - conf_private_new.num_sections = (int) adj->value; -} - - -static void -height_changed (GtkAdjustment * adj) -{ - conf_private_new.height_set = (int) adj->value; -} - - -static void -height_toggled (GtkWidget * widget, GtkScale * height_scale) -{ - conf_private_new.height_random = !conf_private_new.height_random; - gtk_widget_set_sensitive (GTK_WIDGET (height_scale), - !conf_private_new.height_random); -} - - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private)); - - /* number sections per ring */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Number sections per ring"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.num_sections, 4, 20, 1, 5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (sections_changed), NULL); - - /* random max height */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Random height"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.height_random); - - /* explicitly set max height */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Maximum height"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.height_set, 1, 3, 0.1, 1, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 1); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_set_sensitive (GTK_WIDGET (hscale), - !conf_private_new.height_random); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (height_changed), NULL); - - /* slider gets enabled/disabled according to random setting */ - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (height_toggled), GTK_SCALE (hscale)); -}
--- a/src/iris/theme_pipes.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,368 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -/* New Theme created by Ron Lockwood-Childs - * Looks best when alpha blending is on - */ - -/* $Id: theme_pipes.c,v 1.5 2002/05/16 20:38:17 cedric Exp $ */ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include <stdio.h> -#include "iris.h" - -#define NUM_BANDS 16 -#define REPEAT 5 -#define CIRCLE_POINTS 12 -#define PIPE_DIAMETER 0.25f -#define PIPE_THICKNESS 0.10f -#define PIPE_ANGLE (45.0f / (float)NUM_BANDS) -#define PIPE_RING_ANGLE (300.0f / (float)NUM_BANDS) -#define PIPE_RING_RADIUS(side) (side / (2.0f * sin( PIPE_RING_ANGLE / 2.0f ))) - - -static struct -{ - gfloat slope; - gfloat length; -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); - - -static char pipes_slope[] = "pipes_slope"; -static char pipes_length[] = "pipes_length"; - - -iris_theme theme_pipes = { - "Pipes", - "Coral spectrum", - "Ron Lockwood-Childs", - "pipes", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -typedef struct -{ - GLfloat x_n; - GLfloat z_n; -} -rectangular; - - -GLfloat data2[NUM_BANDS]; // previous freq band data - - -static GLfloat -get_x_angle () -{ - return (55.0 + (int) (35.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - int t1, t2, t3; // loop vars - GLfloat red, green, blue; - GLfloat y = 0.0; -// GLfloat circumference; // loop var around cylinder - // store each set of points around the center of the cylinder - rectangular outer_cylinder[CIRCLE_POINTS]; // each y, z around outer circle - rectangular inner_cylinder[CIRCLE_POINTS]; // each y, z around inner circle - rectangular ring_of_pipes[NUM_BANDS]; // for wrapping pipes in a circle - GLfloat differ; // holds the angle increment - GLfloat maxdropoff = 0.05; // smooth changes in heights - GLfloat angle_step; -// GLfloat adj_x; // bar height adjustment - GLfloat repeat_index_adj; // adj for repeating NUM_BANDS bars around spiral - int next_point; - static int first_time = 0; - - for (t1 = 0, angle_step = 0; - t1 < CIRCLE_POINTS; - t1++, angle_step += ((M_PI * 2) / (float) CIRCLE_POINTS)) - { // get each point of each "circle" (more like a polygon) - outer_cylinder[t1].x_n = cos (angle_step) * (PIPE_DIAMETER / 2.0f); - outer_cylinder[t1].z_n = sin (angle_step) * (PIPE_DIAMETER / 2.0f); - inner_cylinder[t1].x_n = cos (angle_step) * - ((PIPE_DIAMETER - PIPE_THICKNESS) / 2.0f); - inner_cylinder[t1].z_n = sin (angle_step) * - ((PIPE_DIAMETER - PIPE_THICKNESS) / 2.0f); - } - for (t1 = 0; t1 < NUM_BANDS; t1++) - { - // smooth out the pipe length changes - differ = datas.data1[t1] - data2[t1]; // calculate change in amplitude - if (fabs (differ) > maxdropoff) - { - if (differ > 0) - data2[t1] += maxdropoff; - else if (differ < 0) - data2[t1] -= maxdropoff; - } - else - { - data2[t1] += differ; - } - // work out the pipe placement - ring_of_pipes[t1].x_n = cos (t1 * PIPE_RING_ANGLE) * 2; - ring_of_pipes[t1].z_n = sin (t1 * PIPE_RING_ANGLE) * 2; - } - - for (t3 = 0; t3 < REPEAT; t3++) - { - for (t1 = 0; t1 < NUM_BANDS; t1++) - { // iterate thru each pipe - - glPushMatrix (); - repeat_index_adj = t1 + (t3 * NUM_BANDS); - // now alter the model view matrix to put the pipe in the right position - glRotatef (PIPE_RING_ANGLE * repeat_index_adj, 0.0f, 0.5f, 0.0f); - glTranslatef (0.5f + (0.05f * repeat_index_adj), - (conf_private.slope * repeat_index_adj), 0); - glRotatef (-1 * PIPE_ANGLE * repeat_index_adj, 0.0f, 0.0f, 1.0f); - - glBegin (GL_QUADS); - // draw each cylinder segment, from one end of the pipe to the other - for (t2 = 0; t2 < CIRCLE_POINTS; t2++) - { - if (t2 >= (CIRCLE_POINTS - 1)) - next_point = 0; - else - next_point = t2 + 1; - // current angle to angle + PI / # of points - // can draw both inner and outer cylinder segments per angle - // also: split pipe height so we can do - // color 2 -> color 1 -> color 2 along its height - - // top half of outer pipe segment - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "top-left" - glVertex3f (outer_cylinder[t2].x_n, - data2[t1] * conf_private.length, - outer_cylinder[t2].z_n); - - get_color (&red, &green, &blue, &y); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "middle-left" - glVertex3f (outer_cylinder[t2].x_n, - 0.0f, outer_cylinder[t2].z_n); - // "middle-right" - glVertex3f (outer_cylinder[next_point].x_n, - 0.0f, outer_cylinder[next_point].z_n); - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "top-right" - glVertex3f (outer_cylinder[next_point].x_n, - data2[t1] * conf_private.length, - outer_cylinder[next_point].z_n); - - // top half of inner pipe segment - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "top-left" - glVertex3f (inner_cylinder[t2].x_n, - data2[t1] * conf_private.length, - inner_cylinder[t2].z_n); - - get_color (&red, &green, &blue, &y); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "middle-left" - glVertex3f (inner_cylinder[t2].x_n, - 0.0f, inner_cylinder[t2].z_n); - // "middle-right" - glVertex3f (inner_cylinder[next_point].x_n, - 0.0f, inner_cylinder[next_point].z_n); - - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "top-right" - glVertex3f (inner_cylinder[next_point].x_n, - data2[t1] * conf_private.length, - inner_cylinder[next_point].z_n); - - // now "cap" the ends of the pipe - - // cap "top" of pipe - get_color (&red, &green, &blue, &data2[t1]); // top color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "outer-bottom" - glVertex3f (outer_cylinder[t2].x_n, - data2[t1] * conf_private.length, - outer_cylinder[t2].z_n); - // "inner-bottom" - glVertex3f (inner_cylinder[t2].x_n, - data2[t1] * conf_private.length, - inner_cylinder[t2].z_n); - // "inner-top" - glVertex3f (inner_cylinder[next_point].x_n, - data2[t1] * conf_private.length, - inner_cylinder[next_point].z_n); - // "outer-top" - glVertex3f (outer_cylinder[next_point].x_n, - data2[t1] * conf_private.length, - outer_cylinder[next_point].z_n); - - // cap "bottom" of pipe - get_color (&red, &green, &blue, &y); // bottom color - glColor4f (red / 2.0f, green / 2.0f, blue / 2.0f, 0.5f); - // "outer-bottom" - glVertex3f (outer_cylinder[t2].x_n, - 0.0f, outer_cylinder[t2].z_n); - // "inner-bottom" - glVertex3f (inner_cylinder[t2].x_n, - 0.0f, inner_cylinder[t2].z_n); - // "inner-top" - glVertex3f (inner_cylinder[next_point].x_n, - 0.0f, inner_cylinder[next_point].z_n); - // "outer-top" - glVertex3f (outer_cylinder[next_point].x_n, - 0.0f, outer_cylinder[next_point].z_n); - } - glEnd (); // specify each pipe separately - glPopMatrix (); - } - } - - - first_time++; -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_float (db, section_name, pipes_slope, &conf_private.slope); - bmp_cfg_db_get_float (db, section_name, pipes_length, &conf_private.length); -} - - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_float (db, section_name, pipes_slope, conf_private.slope); - bmp_cfg_db_set_float (db, section_name, pipes_length, conf_private.length); -} - - -static void -config_default () -{ - conf_private.slope = -0.05; - conf_private.length = 1.5; -} - - -static void -slope_changed (GtkAdjustment * adj) -{ - conf_private_new.slope = (float) adj->value; -} - - -static void -length_changed (GtkAdjustment * adj) -{ - conf_private_new.length = (float) adj->value; -} - - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *hscale; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private)); - - /* slope in vertical direction */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Rate of descent/ascent (vertical slope)"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.slope, -0.05, 0.05, 0.001, 0.01, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 2); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (slope_changed), NULL); - - /* length of each pipe */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - label = gtk_label_new ("Pipe length"); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); - - adjustment = - gtk_adjustment_new (conf_private_new.length, 0.5, 3.5, 0.1, 0.5, 0); - hscale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - gtk_scale_set_digits (GTK_SCALE (hscale), 1); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 25); - gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE, 4); - gtk_widget_show (hscale); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (length_changed), NULL); -}
--- a/src/iris/theme_pyramid.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - - -static struct -{ -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_pyramid = { - "Pyramid", - "Pyramid shaped spectrum", - "Marinus Schraal (foser@sesmar.eu.org)", - "pyramid", - &conf, - &conf_new, - sizeof (conf_private), - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (30.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - GLfloat scale = 2.0; // scales the whole squares, higher is bigger - GLfloat x, height = -4, oldheight; - GLfloat red, green, blue; - static GLfloat data[16]; // where the spectrum values are stored - int l; - - for (l = 0; l < 16; l++) - { - if (datas.data1[l] > data[l]) - data[l] = datas.data1[l]; - else - data[l] -= 0.015; - if (data[l] < 0.0) - data[l] = 0.0; - } - - glBegin (GL_QUADS); - for (l = 0; l < 16; l++) - { - x = data[l] * scale; - oldheight = height; - height = height + 0.4; - - if (data[l] > 0.0) - { - get_color (&red, &green, &blue, &data[l]); - glColor4f (red, green, blue, 0.75); - - /* sides */ - //top right - glVertex3f (x, height, x); // top right (front) - glVertex3f (x, oldheight, x); //bottom right - glVertex3f (x, oldheight, -x); //bottom left - glVertex3f (x, height, -x); // top left - //top left - glVertex3f (x, height, -x); // top right (front) - glVertex3f (x, oldheight, -x); //bottom right - glVertex3f (-x, oldheight, -x); //bottom left - glVertex3f (-x, height, -x); // top left - //bottom left - glVertex3f (-x, height, -x); // top right (front) - glVertex3f (-x, oldheight, -x); //bottom right - glVertex3f (-x, oldheight, x); //bottom left - glVertex3f (-x, height, x); // top left - - //bottom right - glVertex3f (-x, height, x); // top right (front) - glVertex3f (-x, oldheight, x); //bottom right - glVertex3f (x, oldheight, x); //bottom left - glVertex3f (x, height, x); // top left - - get_color (&red, &green, &blue, &data[l]); - glColor4f (red, green, blue, 0.5); - /* top */ - glVertex3f (x, height, x); // Top Right Of The Quad (Bottom) - glVertex3f (x, height, -x); // Top Left Of The Quad (Bottom) - glVertex3f (-x, height, -x); // Bottom Left Of The Quad (Bottom) - glVertex3f (-x, height, x); // Bottom Right Of The Quad (Bottom) - - } - } - - glEnd (); - -}
--- a/src/iris/theme_spectrotoy.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - -static struct -{ -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_spectrotoy = { - "Spectrotoy", - "Seashell shaped spectrum", - "Cédric Delfosse (cdelfosse@free.fr)", - "spectrotoy", - &conf, - &conf_new, - sizeof (conf_private), - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -static GLfloat -get_x_angle () -{ - return (65.0 + (int) (25.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - unsigned int step; - GLfloat x1, x2, y1, y2, x3, y3, x4, y4; - GLfloat y; - GLfloat red, green, blue; - static GLfloat data[16]; // where the spectrum values are stored - - for (step = 0; step < 16; step++) - { - if (datas.data1[step] > data[step]) - data[step] = datas.data1[step]; - else - data[step] -= 0.02; - if (data[step] < 0.0) - data[step] = 0.0; - } - data[16] = data[0]; - - glBegin (GL_TRIANGLES); - - x1 = 0.5 * cos (0); - y1 = 0.5 * sin (0); - - x2 = (0.5 + data[0] * 3) * cos (0); - y2 = (0.5 + data[0] * 3) * sin (0); - - for (step = 0; step < 17; step++) - { - y = data[step] * 3; - - x3 = 0.5 * cos (step * 2 * M_PI / 16); - y3 = 0.5 * sin (step * 2 * M_PI / 16); - - x4 = (0.5 + y) * cos (step * 2 * M_PI / 16); - y4 = (0.5 + y) * sin (step * 2 * M_PI / 16); - - get_color (&red, &green, &blue, &data[step]); - - /* a side */ - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, 0, y1); - glVertex3f (x2, 0, y2); - glVertex3f (x2, y, y2); - glVertex3f (x2, y, y2); - glVertex3f (x1, y, y1); - glVertex3f (x1, 0, y1); - - /* another side */ - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x3, 0, y3); - glVertex3f (x4, 0, y4); - glVertex3f (x4, y, y4); - glVertex3f (x4, y, y4); - glVertex3f (x3, y, y3); - glVertex3f (x3, 0, y3); - - /* side in */ - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, 0, y1); - glVertex3f (x3, 0, y3); - glVertex3f (x3, y, y3); - glVertex3f (x3, y, y3); - glVertex3f (x1, y, y1); - glVertex3f (x1, 0, y1); - - /* side out */ - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x4, 0, y4); - glVertex3f (x2, 0, y2); - glVertex3f (x2, y, y2); - glVertex3f (x2, y, y2); - glVertex3f (x4, y, y4); - glVertex3f (x4, 0, y4); - - /* top */ - glColor4f (red, green, blue, 0.5); - glVertex3f (x1, y, y1); - glVertex3f (x2, y, y2); - glVertex3f (x3, y, y3); - glVertex3f (x3, y, y3); - glVertex3f (x2, y, y2); - glVertex3f (x4, y, y4); - - x1 = x3; - y1 = y3; - x2 = x4; - y2 = y4; - } - - glEnd (); - -}
--- a/src/iris/theme_spectrum.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,278 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - - -static char spectrum_proportional[] = "spectrum_proportional"; - -static GLfloat peak[16]; // where the peak values are stored - -static struct -{ - gboolean proportional; -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static void config_read (ConfigDb *, char *); -static void config_write (ConfigDb *, char *); -static void config_default (void); -static void config_create (GtkWidget *); -static void init_draw_mode (void); -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_spectrum = { - "Spectrum", - "A simple spectrum", - "Cédric Delfosse (cdelfosse@free.fr)", - "spectrum", - &conf, - &conf_new, - sizeof (conf_private), - config_read, - config_write, - config_default, - config_create, - NULL, - NULL, - init_draw_mode, - get_x_angle, - draw_one_frame, -}; - - -static void -init_draw_mode () -{ - memset (peak, 0x00, 16); -} - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - GLfloat x1, x2; - GLfloat bar_length = 0.30; - GLfloat bar_distance = 0.1; - GLfloat bar_deep = 1.5; - GLfloat y, y2; - GLfloat red, green, blue; - GLfloat z = 0.0; - static GLfloat data[16]; // where the spectrum values are stored - int l; - - for (l = 0; l < 16; l++) - { - if (datas.data1[l] > data[l]) - data[l] = datas.data1[l]; - else - data[l] -= 0.015; - if (data[l] < 0.0) - data[l] = 0.0; - } - - glBegin (GL_TRIANGLES); - - x1 = -(bar_length * 16.0 + bar_distance * 15.0) / 2.0; - x2 = x1 + bar_length; - - for (l = 0; l < 16; l++) - { - GLfloat width; - y = data[l] * 4; - - if (peak[l] < data[l]) - { - peak[l] = data[l]; - if (beat) - peak[l] += 0.2; - } - else - peak[l] -= 0.007; - if (conf_private.proportional) - width = peak[l]; - else - width = bar_deep / 2; - if (peak[l] < 0.0) - peak[l] = 0.0; - else - { - y2 = peak[l] * 4 + 0.1; - get_color (&red, &green, &blue, &peak[l]); - glColor4f (red * 1.5, green * 1.5, blue * 1.5, 0.8); - glVertex3f (x1, y2, -width); - glVertex3f (x2, y2, -width); - glVertex3f (x2, y2, +width); - glVertex3f (x2, y2, +width); - glVertex3f (x1, y2, -width); - glVertex3f (x1, y2, +width); - } - - if (y > 0.0) - { - /* one side */ - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, y, -width); - glVertex3f (x2, y, -width); - - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, 0, -width); - glVertex3f (x1, 0, -width); - glVertex3f (x2, 0, -width); - - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x2, y, -width); - - /* top */ - glColor4f (red, green, blue, 0.5); - glVertex3f (x1, y, -width); - glVertex3f (x2, y, -width); - glVertex3f (x2, y, +width); - glVertex3f (x2, y, +width); - glVertex3f (x1, y, -width); - glVertex3f (x1, y, +width); - - /* other side */ - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, y, width); - glVertex3f (x2, y, width); - - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, 0, width); - glVertex3f (x1, 0, width); - glVertex3f (x2, 0, width); - - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x2, y, width); - - /**/ glVertex3f (x1, y, +width); - glVertex3f (x1, y, -width); - - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, 0, -width); - - glVertex3f (x1, 0, -width); - glVertex3f (x1, 0, +width); - - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1, y, +width); - - /**/ glVertex3f (x2, y, +width); - glVertex3f (x2, y, -width); - - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x2, 0, -width); - - glVertex3f (x2, 0, -width); - glVertex3f (x2, 0, +width); - - get_color (&red, &green, &blue, &data[l]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x2, y, +width); - } - - x1 += bar_length + bar_distance; - x2 += bar_length + bar_distance; - - } - - glEnd (); - -} - - -static void -config_read (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_get_bool (db, section_name, spectrum_proportional, &conf_private.proportional); -} - -static void -config_write (ConfigDb * db, char *section_name) -{ - bmp_cfg_db_set_bool (db, section_name, spectrum_proportional, conf_private.proportional); -} - -static void -config_default () -{ - conf_private.proportional = TRUE; -} - - -static void -proportional_toggled (GtkWidget * widget, gpointer data) -{ - conf_private_new.proportional = !conf_private_new.proportional; -} - - -static void -config_create (GtkWidget * vbox) -{ - GtkWidget *hbox; - GtkWidget *button; - - memcpy (&conf_private_new, &conf_private, sizeof (conf_private_new)); - - /* proportional mode */ - hbox = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); - - button = gtk_check_button_new_with_label ("Proportional mode"); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), - conf_private_new.proportional); - gtk_signal_connect (GTK_OBJECT (button), "toggled", - GTK_SIGNAL_FUNC (proportional_toggled), NULL); -}
--- a/src/iris/theme_squarefield.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - - -static struct -{ -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_squarefield = { - "SquareField", - "Waving square field", - "Marinus Schraal (foser@sesmar.eu.org)", - "squarefield", - &conf, - &conf_new, - sizeof (conf_private), - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -GLfloat dataSquare[NUM_BANDS][NUM_BANDS]; // internal sounddata structure - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - int t1, t2; // loop vars - GLfloat x1, y1; - GLfloat red, green, blue; - GLfloat z = 0.0; - GLfloat scale = 4.5; // scales the whole field - lower is bigger - GLfloat scaleh = 3; // scales height of the bar - lower is smaller - GLfloat maxfalloff = 0.05; - - /* internal routine to shift all data when a new datarow arrives */ - for (t1 = 15; t1 > 0; t1--) - { - for (t2 = 0; t2 < 16; t2++) - { - dataSquare[t1][t2] = dataSquare[t1 - 1][t2]; - } - } - for (t2 = 0; t2 < 16; t2++) - { - if (dataSquare[0][t2] > datas.data1[t2] - && ((dataSquare[0][t2] - datas.data1[t2]) > maxfalloff)) - { - dataSquare[0][t2] = dataSquare[0][t2] - maxfalloff; - } - else - { - dataSquare[0][t2] = datas.data1[t2]; - } - } - - /* some kinda random base i started out on - turned out to be too big thats why i added scaling vars - */ - x1 = 11.75f; - y1 = 11.75f; - - glBegin (GL_QUADS); - - for (t1 = 0; t1 < 16; t1++) - { - x1 = 11.75f; - for (t2 = 0; t2 < 16; t2++) - { - /* bottom : turned off */ - -/* get_color (&red, &green, &blue, &z); - glColor4f (red/2 , green/2 , blue/2 , 0.5); - glVertex3f( (x1-1)/scale , 0, (y1-1)/scale); // Top Right Of The Quad (Bottom) - glVertex3f( x1/scale, 0, (y1-1)/scale); // Top Left Of The Quad (Bottom) - glVertex3f( x1/scale, 0, y1/scale); // Bottom Left Of The Quad (Bottom) - glVertex3f( (x1-1)/scale, 0, y1/scale); // Bottom Right Of The Quad (Bottom) -*/ - - /* sides */ - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // top right (front) - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, 0, (y1 - 1) / scale); //bottom right - glVertex3f (x1 / scale, 0, (y1 - 1) / scale); //bottom left - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // top left - - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // top fron (left) - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1 / scale, 0, (y1 - 1) / scale); // bottom fron (left) - glVertex3f (x1 / scale, 0, y1 / scale); // back bottom (left) - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // top back (left) - - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // top front (right) - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, 0, (y1 - 1) / scale); // bottom front (right) - glVertex3f ((x1 - 1) / scale, 0, y1 / scale); // bottom back (right) - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // top back(right) - - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // right top (back) - get_color (&red, &green, &blue, &z); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f ((x1 - 1) / scale, 0, y1 / scale); // right bottom (back) - glVertex3f (x1 / scale, 0, y1 / scale); // left bottom (back) - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red / 2, green / 2, blue / 2, 0.5); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // left top (back) - - /* top */ - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red, green, blue, 0.5); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // Top Right Of The Quad (Bottom) - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, (y1 - 1) / scale); // Top Left Of The Quad (Bottom) - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // Bottom Left Of The Quad (Bottom) - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // Bottom Right Of The Quad (Bottom) - - x1 -= 1.5; - } - y1 -= 1.5; - } - - glEnd (); - -}
--- a/src/iris/theme_waves.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <GL/gl.h> -#include <audacious/configdb.h> -#include "iris.h" - - -static struct -{ - gboolean proportional; -} -conf_private, conf_private_new; - -static config_theme conf = { - NULL, - &conf_private -}; - -static config_theme conf_new = { - NULL, - &conf_private_new -}; - - -static GLfloat get_x_angle (void); -static void draw_one_frame (gboolean); - - -iris_theme theme_waves = { - "Waves", - "Pulsating waves", - "Marinus Schraal (foser@sesmar.eu.org)", - "waves", - &conf, - &conf_new, - sizeof (conf_private), - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_x_angle, - draw_one_frame, -}; - - -GLfloat dataSquare[NUM_BANDS][NUM_BANDS]; // internal sounddata structure - - -static GLfloat -get_x_angle () -{ - return (10.0 + (int) (80.0 * rand () / (RAND_MAX + 1.0))); -} - - -static void -draw_one_frame (gboolean beat) -{ - int t1, t2; // loop vars - GLfloat x1, y1; - GLfloat red, green, blue; - GLfloat scale = 3; // scales the whole field - lower is bigger - GLfloat scaleh = 2.5; // scales height of the bar - lower is smaller - GLfloat maxfalloff = 0.05; - GLfloat intensity = 0.5; - - /* internal routine to shift all data when a new datarow arrives */ - for (t1 = 15; t1 > 0; t1--) - { - for (t2 = 0; t2 < 16; t2++) - { - dataSquare[t1][t2] = dataSquare[t1 - 1][t2]; - } - } - for (t2 = 0; t2 < 16; t2++) - { - if (dataSquare[0][t2] > datas.data1[t2] - && ((dataSquare[0][t2] - datas.data1[t2]) > maxfalloff)) - { - dataSquare[0][t2] = dataSquare[0][t2] - maxfalloff; - } - else - { - dataSquare[0][t2] = datas.data1[t2]; - } - } - - /* some kinda random base i started out on - * turned out to be too big thats why i added scaling vars - */ - x1 = 7.5f; - y1 = 7.5f; - - for (t1 = 0; t1 < 15; t1++) - { - x1 = 7.5f; - for (t2 = 0; t2 < 15; t2++) - { - - glBegin (GL_TRIANGLES); - intensity = 0.75; - - /* triangle 1 */ - get_color (&red, &green, &blue, &dataSquare[t1 + 1][t2 + 1]); - glColor4f (red, green, blue, intensity); - glVertex3f ((x1 - 1) / scale, dataSquare[t1 + 1][t2 + 1] * scaleh, (y1 - 1) / scale); // Top Right Of The Quad (Bottom) - - get_color (&red, &green, &blue, &dataSquare[t1 + 1][t2]); - glColor4f (red, green, blue, intensity); - glVertex3f (x1 / scale, dataSquare[t1 + 1][t2] * scaleh, (y1 - 1) / scale); // Top Left Of The Quad (Bottom) - - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red, green, blue, intensity); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // Bottom Left Of The Quad (Bottom) - - /* triangle 2 */ - get_color (&red, &green, &blue, &dataSquare[t1 + 1][t2 + 1]); - glColor4f (red, green, blue, intensity); - glVertex3f ((x1 - 1) / scale, dataSquare[t1 + 1][t2 + 1] * scaleh, (y1 - 1) / scale); // Top Right Of The Quad (Bottom) - - get_color (&red, &green, &blue, &dataSquare[t1][t2 + 1]); - glColor4f (red, green, blue, intensity); - glVertex3f ((x1 - 1) / scale, dataSquare[t1][t2 + 1] * scaleh, y1 / scale); // Bottom Right Of The Quad (Bottom) - - get_color (&red, &green, &blue, &dataSquare[t1][t2]); - glColor4f (red, green, blue, intensity); - glVertex3f (x1 / scale, dataSquare[t1][t2] * scaleh, y1 / scale); // Bottom Left Of The Quad (Bottom) - - glEnd (); - - x1 -= 1; - } - y1 -= 1; - } - - glEnd (); - -}
--- a/src/iris/transition.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* Iris - visualization plugin for XMMS - * Copyright (C) 2000-2002 Cédric DELFOSSE (cdelfosse@free.fr) - * - * 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. - */ - -/* Transitions on theme change - * TODO : transitions on song change - * new transitions are easy to add - */ - -#include <stdlib.h> -#include "iris.h" - -extern GLfloat y_angle; -extern GLfloat x_angle; -extern int max_transition_frames; -extern int transition_frames; -int transition = 0; - -void -trans_zoom_out (gboolean init) -{ - static GLfloat x, y, z; - //only init when starting transition - if (init) - { - x = 1.0; - y = 1.0; - z = 1.0; - return; - } - - if (max_transition_frames / 2 < transition_frames) - { - x -= 1.0 / (max_transition_frames / 2); - y -= 1.0 / (max_transition_frames / 2); - z -= 1.0 / (max_transition_frames / 2); - } - else - { - x += 1.0 / (max_transition_frames / 2); - y += 1.0 / (max_transition_frames / 2); - z += 1.0 / (max_transition_frames / 2); - } - - glScalef (x, y, z); -} - -void -trans_zoom_in (gboolean init) -{ - static GLfloat x, y, z; - //only init when starting transition - if (init) - { - x = 1.0; - y = 1.0; - z = 1.0; - return; - } - - if (max_transition_frames / 2 < transition_frames) - { - x += 5.0 / (max_transition_frames / 2); - y += 5.0 / (max_transition_frames / 2); - z += 5.0 / (max_transition_frames / 2); - } - else - { - x -= 5.0 / (max_transition_frames / 2); - y -= 5.0 / (max_transition_frames / 2); - z -= 5.0 / (max_transition_frames / 2); - } - - glScalef (x, y, z); -} - -/* move up to top down look */ -void -trans_vertical_view (gboolean init) -{ - static GLfloat x_angle_tmp; - if (init) - { - x_angle_tmp = x_angle; - } - if (max_transition_frames / 2 < transition_frames) - { - x_angle += (90.0 - x_angle_tmp) / (max_transition_frames / 2); - } - else - { - x_angle -= (90.0 - x_angle_tmp) / (max_transition_frames / 2); - } - -} - -void -trans_spin_half_and_back (gboolean cc) -{ - if (max_transition_frames / 2 < transition_frames) - { - if (cc) - y_angle -= 180.0 / (max_transition_frames / 2); - else - y_angle += 180.0 / (max_transition_frames / 2); - } - else - { - if (cc) - y_angle += 180.0 / (max_transition_frames / 2); - else - y_angle -= 180.0 / (max_transition_frames / 2); - } -} - -void -trans_spin_full (gboolean cc) -{ - if (cc) - y_angle -= 360.0 / max_transition_frames; - else - y_angle += 360.0 / max_transition_frames; -} - -/* called on themeswitch */ -void -init_theme_transition (void) -{ - /* don't forget to update after adding new transitions */ - transition = (int) ((gfloat) 6 * rand () / (RAND_MAX + 1.0)); - - /* init/reset transitions that need it */ - trans_zoom_in (TRUE); - trans_zoom_out (TRUE); - trans_vertical_view (TRUE); -} - -/* called every frame of a transition */ -void -theme_transition () -{ - switch (transition) - { - case 0: - trans_zoom_out (FALSE); - break; - case 1: - trans_zoom_out (FALSE); - trans_spin_half_and_back ((int) - ((gfloat) 1 * rand () / (RAND_MAX + 1.0))); - break; - case 2: - trans_zoom_in (FALSE); - break; - case 3: - trans_zoom_in (FALSE); - trans_spin_half_and_back ((int) - ((gfloat) 1 * rand () / (RAND_MAX + 1.0))); - break; - case 4: - trans_vertical_view (FALSE); - trans_zoom_in (FALSE); - break; - case 5: - trans_vertical_view (FALSE); - trans_zoom_in (FALSE); - trans_spin_full ((int) ((gfloat) 1 * rand () / (RAND_MAX + 1.0))); - break; - } -}
--- a/src/mplayer/AUTHORS Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -Nandan Dixit <nandan@cse.iitb.ac.in> -Aaron Sheldon <asheldon@engineering.uiuc.edu>
--- a/src/mplayer/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -OBJECTIVE_LIBS = libmplayer$(SHARED_SUFFIX) - -LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR) - -LIBADD += $(GTK_LIBS) - -SOURCES = xmmsmplayer.c common.c interface.c - -CFLAGS += $(GTK_CFLAGS) $(PICFLAGS) -I../../intl -I../.. -CXXFLAGS += $(GTK_CFLAGS) $(PICFLAGS) -I../../intl -I../.. - -OBJECTS = ${SOURCES:.c=.o} - -include ../../mk/objective.mk
--- a/src/mplayer/README Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -XmmsMPlayer ------------ - -This an xmms plugin that allows you to use xmms as a front-end for -MPlayer. You'll need MPlayer properly installed and in the PATH. - -For more info, see http://www.cse.iitb.ac.in/nandan/xmmsmplayer/ - -
--- a/src/mplayer/README.audacious Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -This is a terrible port from XMMS to Audacious. - -It's a horrible hack, and the ./configure scripts do more damage than -good. Hopefully it will work for most, though patches for ./configure -are more than welcome! - -In fact, patches of any kind are welcome since it's a total hack and -magic that it works as-is. - -- Aaron Sheldon
--- a/src/mplayer/common.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#include <audacious/configdb.h> -#include <stdlib.h> -#include "xmmsmplayer.h" - -struct mplayer_cfg *mplayer_read_cfg(){ - ConfigDb *cfg; - struct mplayer_cfg *new_cfg; - new_cfg=(struct mplayer_cfg *)malloc(sizeof(struct mplayer_cfg)); - memset(new_cfg,0,sizeof(struct mplayer_cfg)); - cfg = bmp_cfg_db_open(); - bmp_cfg_db_get_int(cfg,"xmms-mplayer","vo",&(new_cfg->vo)); - bmp_cfg_db_get_int(cfg,"xmms-mplayer","ao",&(new_cfg->ao)); - bmp_cfg_db_get_bool(cfg,"xmms-mplayer","zoom",&(new_cfg->zoom)); - bmp_cfg_db_get_bool(cfg,"xmms-mplayer","framedrop",&(new_cfg->framedrop)); - bmp_cfg_db_get_bool(cfg,"xmms-mplayer","idx",&(new_cfg->idx)); - bmp_cfg_db_get_bool(cfg,"xmms-mplayer","onewin",&(new_cfg->onewin)); - bmp_cfg_db_get_bool(cfg,"xmms-mplayer","xmmsaudio",&(new_cfg->xmmsaudio)); - bmp_cfg_db_get_string(cfg,"xmms-mplayer","extra",&(new_cfg->extra)); - bmp_cfg_db_close(cfg); - return new_cfg; -}
--- a/src/mplayer/interface.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,497 +0,0 @@ - - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <audacious/plugin.h> -#include <audacious/beepctrl.h> -#include <audacious/configdb.h> -#include <audacious/util.h> - -#include "xmmsmplayer.h" - -static GtkWidget *vo_none; -static GtkWidget *vo_xv; -static GtkWidget *vo_x11; -static GtkWidget *vo_gl; -static GtkWidget *vo_sdl; -static GtkWidget *opt_zoom; -static GtkWidget *opt_framedrop; -static GtkWidget *opt_idx; -static GtkWidget *opt_onewin; -static GtkWidget *opt_xmmsaudio; -static GtkWidget *ao_none; -static GtkWidget *ao_oss; -static GtkWidget *ao_arts; -static GtkWidget *ao_esd; -static GtkWidget *ao_alsa; -static GtkWidget *ao_sdl; -static GtkWidget *entry_extra_opts; - -static GtkWidget *mplayer_configure_win = NULL; - -void mplayer_destroyed_conf_win(GtkWidget *widget, gpointer data) { - mplayer_configure_win = NULL; -} - - -void on_btn_cancel_clicked(GtkButton *button, gpointer user_data){ - gtk_widget_destroy(mplayer_configure_win); - mplayer_configure_win=NULL; -} - - -void on_btn_ok_clicked (GtkButton *button, gpointer user_data){ - ConfigDb *cfg; - struct mplayer_cfg new_cfg; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_none))) - new_cfg.vo=MPLAYER_VO_NONE; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_xv))) - new_cfg.vo=MPLAYER_VO_XV; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_x11))) - new_cfg.vo=MPLAYER_VO_X11; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_gl))) - new_cfg.vo=MPLAYER_VO_GL; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_sdl))) - new_cfg.vo=MPLAYER_VO_SDL; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_none))) - new_cfg.ao=MPLAYER_AO_NONE; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_oss))) - new_cfg.ao=MPLAYER_AO_OSS; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_arts))) - new_cfg.ao=MPLAYER_AO_ARTS; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_esd))) - new_cfg.ao=MPLAYER_AO_ESD; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_alsa))) - new_cfg.ao=MPLAYER_AO_ALSA; - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_sdl))) - new_cfg.ao=MPLAYER_AO_SDL; - new_cfg.zoom=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_zoom)); - new_cfg.framedrop= - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_framedrop)); - new_cfg.idx=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_idx)); - new_cfg.onewin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_onewin)); - new_cfg.xmmsaudio=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_xmmsaudio)); - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_xmmsaudio))) - new_cfg.ao=MPLAYER_AO_XMMS; - new_cfg.extra=(gchar*)gtk_entry_get_text(GTK_ENTRY(entry_extra_opts)); - - cfg = bmp_cfg_db_open(); - bmp_cfg_db_set_int(cfg,"xmms-mplayer","vo",new_cfg.vo); - bmp_cfg_db_set_int(cfg,"xmms-mplayer","ao",new_cfg.ao); - bmp_cfg_db_set_bool(cfg,"xmms-mplayer","zoom",new_cfg.zoom); - bmp_cfg_db_set_bool(cfg,"xmms-mplayer","framedrop",new_cfg.framedrop); - bmp_cfg_db_set_bool(cfg,"xmms-mplayer","idx",new_cfg.idx); - bmp_cfg_db_set_bool(cfg,"xmms-mplayer","onewin",new_cfg.onewin); - bmp_cfg_db_set_bool(cfg,"xmms-mplayer","xmmsaudio",new_cfg.xmmsaudio); - bmp_cfg_db_set_string(cfg,"xmms-mplayer","extra",new_cfg.extra); - bmp_cfg_db_close(cfg); - - gtk_widget_destroy(mplayer_configure_win); - mplayer_configure_win=NULL; -} - - -GtkWidget* -mplayer_create_configure_win (void) -{ - GtkWidget *window1; - GtkWidget *scrolledwindow1; - GtkWidget *layout1; - GtkWidget *notebook1; - GtkWidget *scrolledwindow2; - GtkWidget *layout2; - GSList *layout2_group = NULL; - GtkWidget *label_vo; - GtkWidget *scrolledwindow3; - GtkWidget *layout3; - GSList *layout3_group = NULL; - GtkWidget *label_ao; - GtkWidget *scrolledwindow4; - GtkWidget *layout4; - GtkWidget *label_other; - GtkWidget *scrolledwindow5; - GtkWidget *layout5; - GtkWidget *label_extra_des; - GtkWidget *label_extra; - GtkWidget *btn_ok; - GtkWidget *btn_cancel; - - window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_object_set_data (GTK_OBJECT (window1), "window1", window1); - gtk_window_set_title (GTK_WINDOW (window1), "MPlayer"); - gtk_widget_set_usize (window1, 550, 430); - - - scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow1); - gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow1", scrolledwindow1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow1); - gtk_container_add (GTK_CONTAINER (window1), scrolledwindow1); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - layout1 = gtk_layout_new (NULL, NULL); - gtk_widget_ref (layout1); - gtk_object_set_data_full (GTK_OBJECT (window1), "layout1", layout1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (layout1); - gtk_container_add (GTK_CONTAINER (scrolledwindow1), layout1); - gtk_layout_set_size (GTK_LAYOUT (layout1), 336, 235); - GTK_ADJUSTMENT (GTK_LAYOUT (layout1)->hadjustment)->step_increment = 10; - GTK_ADJUSTMENT (GTK_LAYOUT (layout1)->vadjustment)->step_increment = 10; - - notebook1 = gtk_notebook_new (); - gtk_widget_ref (notebook1); - gtk_object_set_data_full (GTK_OBJECT (window1), "notebook1", notebook1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (notebook1); - gtk_layout_put (GTK_LAYOUT (layout1), notebook1, 24, 24); - gtk_widget_set_usize (notebook1, 496, 336); - - scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow2); - gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow2", scrolledwindow2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow2); - gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow2); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - layout2 = gtk_layout_new (NULL, NULL); - gtk_widget_ref (layout2); - gtk_object_set_data_full (GTK_OBJECT (window1), "layout2", layout2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (layout2); - gtk_container_add (GTK_CONTAINER (scrolledwindow2), layout2); - gtk_layout_set_size (GTK_LAYOUT (layout2), 384, 296); - GTK_ADJUSTMENT (GTK_LAYOUT (layout2)->hadjustment)->step_increment = 10; - GTK_ADJUSTMENT (GTK_LAYOUT (layout2)->vadjustment)->step_increment = 10; - - vo_none = gtk_radio_button_new_with_label (layout2_group, "Automatic (MPlayer Chooses)"); - layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_none)); - gtk_widget_ref (vo_none); - gtk_object_set_data_full (GTK_OBJECT (window1), "vo_none", vo_none, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vo_none); - gtk_layout_put (GTK_LAYOUT (layout2), vo_none, 24, 32); - gtk_widget_set_usize (vo_none, 336, 24); - - vo_xv = gtk_radio_button_new_with_label (layout2_group, "Xvideo"); - layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_xv)); - gtk_widget_ref (vo_xv); - gtk_object_set_data_full (GTK_OBJECT (window1), "vo_xv", vo_xv, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vo_xv); - gtk_layout_put (GTK_LAYOUT (layout2), vo_xv, 24, 64); - gtk_widget_set_usize (vo_xv, 96, 24); - - vo_x11 = gtk_radio_button_new_with_label (layout2_group, "X11"); - layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_x11)); - gtk_widget_ref (vo_x11); - gtk_object_set_data_full (GTK_OBJECT (window1), "vo_x11", vo_x11, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vo_x11); - gtk_layout_put (GTK_LAYOUT (layout2), vo_x11, 24, 104); - gtk_widget_set_usize (vo_x11, 96, 24); - - vo_gl = gtk_radio_button_new_with_label (layout2_group, "GL"); - layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_gl)); - gtk_widget_ref (vo_gl); - gtk_object_set_data_full (GTK_OBJECT (window1), "vo_gl", vo_gl, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vo_gl); - gtk_layout_put (GTK_LAYOUT (layout2), vo_gl, 24, 144); - gtk_widget_set_usize (vo_gl, 96, 24); - - vo_sdl = gtk_radio_button_new_with_label (layout2_group, "SDL"); - layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_sdl)); - gtk_widget_ref (vo_sdl); - gtk_object_set_data_full (GTK_OBJECT (window1), "vo_sdl", vo_sdl, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vo_sdl); - gtk_layout_put (GTK_LAYOUT (layout2), vo_sdl, 24, 184); - gtk_widget_set_usize (vo_sdl, 96, 24); - - label_vo = gtk_label_new ("Video Out"); - gtk_widget_ref (label_vo); - gtk_object_set_data_full (GTK_OBJECT (window1), "label_vo", label_vo, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_vo); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label_vo); - - scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow3); - gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow3", scrolledwindow3, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow3); - gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow3); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - layout3 = gtk_layout_new (NULL, NULL); - gtk_widget_ref (layout3); - gtk_object_set_data_full (GTK_OBJECT (window1), "layout3", layout3, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (layout3); - gtk_container_add (GTK_CONTAINER (scrolledwindow3), layout3); - gtk_layout_set_size (GTK_LAYOUT (layout3), 382, 295); - GTK_ADJUSTMENT (GTK_LAYOUT (layout3)->hadjustment)->step_increment = 10; - GTK_ADJUSTMENT (GTK_LAYOUT (layout3)->vadjustment)->step_increment = 10; - - ao_none = gtk_radio_button_new_with_label (layout3_group, "Automatic (MPlayer Chooses)"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_none)); - gtk_widget_ref (ao_none); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_none", ao_none, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_none); - gtk_layout_put (GTK_LAYOUT (layout3), ao_none, 24, 32); - gtk_widget_set_usize (ao_none, 272, 24); - - ao_oss = gtk_radio_button_new_with_label (layout3_group, "OSS"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_oss)); - gtk_widget_ref (ao_oss); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_oss", ao_oss, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_oss); - gtk_layout_put (GTK_LAYOUT (layout3), ao_oss, 24, 64); - gtk_widget_set_usize (ao_oss, 96, 24); - - ao_arts = gtk_radio_button_new_with_label (layout3_group, "ARTS"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_arts)); - gtk_widget_ref (ao_arts); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_arts", ao_arts, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_arts); - gtk_layout_put (GTK_LAYOUT (layout3), ao_arts, 24, 96); - gtk_widget_set_usize (ao_arts, 96, 24); - - ao_esd = gtk_radio_button_new_with_label (layout3_group, "ESD"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_esd)); - gtk_widget_ref (ao_esd); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_esd", ao_esd, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_esd); - gtk_layout_put (GTK_LAYOUT (layout3), ao_esd, 24, 128); - gtk_widget_set_usize (ao_esd, 96, 24); - - ao_alsa = gtk_radio_button_new_with_label (layout3_group, "ALSA"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_alsa)); - gtk_widget_ref (ao_alsa); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_alsa", ao_alsa, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_alsa); - gtk_layout_put (GTK_LAYOUT (layout3), ao_alsa, 24, 160); - gtk_widget_set_usize (ao_alsa, 103, 24); - - ao_sdl = gtk_radio_button_new_with_label (layout3_group, "SDL"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_sdl)); - gtk_widget_ref (ao_sdl); - gtk_object_set_data_full (GTK_OBJECT (window1), "ao_sdl", ao_sdl, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ao_sdl); - gtk_layout_put (GTK_LAYOUT (layout3), ao_sdl, 24, 192); - gtk_widget_set_usize (ao_sdl, 103, 24); - - opt_xmmsaudio = gtk_radio_button_new_with_label (layout3_group, "XMMS Output Plugin (Experimental)"); - layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (opt_xmmsaudio)); - gtk_widget_ref (opt_xmmsaudio); - gtk_object_set_data_full (GTK_OBJECT (window1), "opt_xmmsaudio", opt_xmmsaudio, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opt_xmmsaudio); - gtk_layout_put (GTK_LAYOUT (layout3), opt_xmmsaudio, 24, 224); - gtk_widget_set_usize (opt_xmmsaudio, 272, 24); - - label_ao = gtk_label_new ("Audio Out"); - gtk_widget_ref (label_ao); - gtk_object_set_data_full (GTK_OBJECT (window1), "label_ao", label_ao, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_ao); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label_ao); - - scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow4); - gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow4", scrolledwindow4, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow4); - gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow4); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - layout4 = gtk_layout_new (NULL, NULL); - gtk_widget_ref (layout4); - gtk_object_set_data_full (GTK_OBJECT (window1), "layout4", layout4, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (layout4); - gtk_container_add (GTK_CONTAINER (scrolledwindow4), layout4); - gtk_layout_set_size (GTK_LAYOUT (layout4), 377, 272); - GTK_ADJUSTMENT (GTK_LAYOUT (layout4)->hadjustment)->step_increment = 10; - GTK_ADJUSTMENT (GTK_LAYOUT (layout4)->vadjustment)->step_increment = 10; - - opt_zoom = gtk_check_button_new_with_label ("Software Zoom"); - gtk_widget_ref (opt_zoom); - gtk_object_set_data_full (GTK_OBJECT (window1), "opt_zoom", opt_zoom, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opt_zoom); - gtk_layout_put (GTK_LAYOUT (layout4), opt_zoom, 24, 32); - gtk_widget_set_usize (opt_zoom, 168, 24); - - opt_framedrop = gtk_check_button_new_with_label ("Frame Dropping"); - gtk_widget_ref (opt_framedrop); - gtk_object_set_data_full (GTK_OBJECT (window1), "opt_framedrop", opt_framedrop, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opt_framedrop); - gtk_layout_put (GTK_LAYOUT (layout4), opt_framedrop, 24, 72); - gtk_widget_set_usize (opt_framedrop, 136, 24); - - opt_idx = gtk_check_button_new_with_label ("Build Index"); - gtk_widget_ref (opt_idx); - gtk_object_set_data_full (GTK_OBJECT (window1), "opt_idx", opt_idx, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opt_idx); - gtk_layout_put (GTK_LAYOUT (layout4), opt_idx, 24, 112); - gtk_widget_set_usize (opt_idx, 102, 24); - - opt_onewin = gtk_check_button_new_with_label ("One Window (Experimental)"); - gtk_widget_ref (opt_onewin); - gtk_object_set_data_full (GTK_OBJECT (window1), "opt_onewin", opt_onewin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (opt_onewin); - gtk_layout_put (GTK_LAYOUT (layout4), opt_onewin, 24, 152); - gtk_widget_set_usize (opt_onewin, 240, 24); - - label_other = gtk_label_new ("Other"); - gtk_widget_ref (label_other); - gtk_object_set_data_full (GTK_OBJECT (window1), "label_other", label_other, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_other); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label_other); - - scrolledwindow5 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow5); - gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow5", scrolledwindow5, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow5); - gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow5); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow5), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - layout5 = gtk_layout_new (NULL, NULL); - gtk_widget_ref (layout5); - gtk_object_set_data_full (GTK_OBJECT (window1), "layout5", layout5, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (layout5); - gtk_container_add (GTK_CONTAINER (scrolledwindow5), layout5); - gtk_layout_set_size (GTK_LAYOUT (layout5), 346, 267); - GTK_ADJUSTMENT (GTK_LAYOUT (layout5)->hadjustment)->step_increment = 10; - GTK_ADJUSTMENT (GTK_LAYOUT (layout5)->vadjustment)->step_increment = 10; - - entry_extra_opts = gtk_entry_new (); - gtk_widget_ref (entry_extra_opts); - gtk_object_set_data_full (GTK_OBJECT (window1), "entry_extra_opts", entry_extra_opts, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (entry_extra_opts); - gtk_layout_put (GTK_LAYOUT (layout5), entry_extra_opts, 40, 192); - gtk_widget_set_usize (entry_extra_opts, 392, 24); - - label_extra_des = gtk_label_new ("Extra options for mplayer can be added here.\nParsing is done based on spaces.\nQuotes and escapes are not recognised yet."); - gtk_widget_ref (label_extra_des); - gtk_object_set_data_full (GTK_OBJECT (window1), "label_extra_des", label_extra_des, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_extra_des); - gtk_layout_put (GTK_LAYOUT (layout5), label_extra_des, 40, 48); - gtk_widget_set_usize (label_extra_des, 392, 128); - gtk_label_set_justify (GTK_LABEL (label_extra_des), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (label_extra_des), 0.18, 1); - - label_extra = gtk_label_new ("Extra"); - gtk_widget_ref (label_extra); - gtk_object_set_data_full (GTK_OBJECT (window1), "label_extra", label_extra, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_extra); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label_extra); - - btn_ok = gtk_button_new_with_label ("OK"); - gtk_widget_ref (btn_ok); - gtk_object_set_data_full (GTK_OBJECT (window1), "btn_ok", btn_ok, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (btn_ok); - gtk_layout_put (GTK_LAYOUT (layout1), btn_ok, 432, 376); - gtk_widget_set_usize (btn_ok, 88, 32); - - btn_cancel = gtk_button_new_with_label ("Cancel"); - gtk_widget_ref (btn_cancel); - gtk_object_set_data_full (GTK_OBJECT (window1), "btn_cancel", btn_cancel, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (btn_cancel); - gtk_layout_put (GTK_LAYOUT (layout1), btn_cancel, 24, 376); - gtk_widget_set_usize (btn_cancel, 88, 30); - - gtk_signal_connect(GTK_OBJECT(window1), - "destroy", - GTK_SIGNAL_FUNC(mplayer_destroyed_conf_win), - NULL); - - gtk_signal_connect (GTK_OBJECT (btn_ok), "clicked", - GTK_SIGNAL_FUNC (on_btn_ok_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (btn_cancel), "clicked", - GTK_SIGNAL_FUNC (on_btn_cancel_clicked), - NULL); - return window1; -} - -void mplayer_configure(){ - struct mplayer_cfg *cfg; - if (mplayer_configure_win) - return; - mplayer_configure_win=mplayer_create_configure_win(); - gtk_widget_show(mplayer_configure_win); - cfg=mplayer_read_cfg(); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_zoom),cfg->zoom); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_framedrop),cfg->framedrop); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_idx),cfg->idx); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_onewin),cfg->onewin); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_xmmsaudio),cfg->xmmsaudio); - - switch(cfg->vo){ - case MPLAYER_VO_NONE: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_none), TRUE); - break; - case MPLAYER_VO_XV: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_xv), TRUE); - break; - case MPLAYER_VO_X11: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_x11), TRUE); - break; - case MPLAYER_VO_GL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_gl), TRUE); - break; - case MPLAYER_VO_SDL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_sdl), TRUE); - break; - } - switch(cfg->ao){ - case MPLAYER_AO_NONE: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_none), TRUE); - break; - case MPLAYER_AO_OSS: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_oss), TRUE); - break; - case MPLAYER_AO_ARTS: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_arts), TRUE); - break; - case MPLAYER_AO_ESD: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_esd), TRUE); - break; - case MPLAYER_AO_SDL: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_sdl), TRUE); - break; - case MPLAYER_AO_ALSA: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_alsa), TRUE); - break; - } - gtk_entry_set_text(GTK_ENTRY(entry_extra_opts),cfg->extra); -}
--- a/src/mplayer/xmmsmplayer.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,591 +0,0 @@ -#include <gtk/gtk.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <glib.h> - -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <pthread.h> -#include <audacious/plugin.h> -#include <audacious/beepctrl.h> -#include <audacious/rcfile.h> -#include <audacious/util.h> -#include <unistd.h> - -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/types.h> - -#include <stdio.h> -#include <sys/wait.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xos.h> -#include <X11/Xatom.h> -#include <X11/keysym.h> -#include <assert.h> - -#include <X11/Xmd.h> - - -#include "xmmsmplayer.h" -static Atom XA_WIN_LAYER; -static Atom XA_NET_WM_STATE; -static Atom XA_NET_WM_STATE_FULLSCREEN; -static Atom XA_NET_WM_STATE_ABOVE; -static Atom XA_NET_WM_STATE_STAYS_ON_TOP; -static Atom XA_NET_WM_STATE_BELOW; - -static Window mplayer_video = 0; -static gchar mplayer_wid[16]; - -static int mplayer_pipe[2]; /* Control mplayer thru this pipe */ -static pthread_t mplayer_tid; /* Thread id */ -static gchar *mplayer_file=NULL; /* filename */ -static struct mplayer_info *mplayer_current_info=NULL; -static gint mplayer_current_time=0; /* to be returned to xmms */ - -static char *mplayer_fifoname=NULL; -static InputPlugin *mplayer_ip=NULL; /* Information to be returned to xmms */ -static gint mplayer_playing=0; -static struct mplayer_cfg *mplayer_current_cfg=NULL; -static Display *dis = NULL; - -InputPlugin *get_iplugin_info(void){ - if(!mplayer_ip){ - mplayer_ip=(InputPlugin *) malloc(sizeof (InputPlugin)); - memset(mplayer_ip,0,sizeof (InputPlugin)); - mplayer_ip->description = strdup("Embedded MPlayer"); - mplayer_ip->init = mplayer_init; - mplayer_ip->is_our_file = mplayer_is_our_file; - mplayer_ip->play_file = mplayer_play_file; - mplayer_ip->stop = mplayer_stop; - mplayer_ip->pause = mplayer_pause; - mplayer_ip->seek = mplayer_seek; - mplayer_ip->get_time = mplayer_get_time; - mplayer_ip->get_song_info = mplayer_get_song_info; - mplayer_ip->set_info = NULL; - mplayer_ip->cleanup = mplayer_cleanup; - mplayer_ip->about = mplayer_about; - mplayer_ip->configure = mplayer_configure; - - } - return mplayer_ip; -} - -void mplayer_init(){ - /*Add read configure!! */ - - /*mplayer_playing=0;*/ -} -int mplayer_is_our_file(char *filename){ - gchar *ext; - ext = strrchr(filename, '.'); - if (ext){ - if((!strcasecmp(ext, ".mpg")) || - (!strcasecmp(ext, ".mpeg")) || - (!strcasecmp(ext, ".divx")) || - (!strcasecmp(ext, ".qt")) || - (!strcasecmp(ext, ".mov")) || - (!strcasecmp(ext, ".mp2")) || - (!strcasecmp(ext, ".mpa")) || - (!strcasecmp(ext, ".dat")) || - (!strcasecmp(ext, ".rm")) || - (!strcasecmp(ext, ".swf")) || - (!strcasecmp(ext, ".wma")) || - (!strcasecmp(ext, ".wmv")) || - (!strcasecmp(ext, ".wmp")) || - (!strcasecmp(ext, ".asf")) || - (!strcasecmp(ext, ".avi")) - ) return TRUE; - } - return FALSE; -} -void mplayer_play_file(char *filename){ - pthread_attr_t tattr; - void *arg; - int ret,pipe_ret; - gchar temp[10]; - gchar *username; - - mplayer_debugf("debug-play-in\n"); - mplayer_file=filename; - pipe_ret=pipe(mplayer_pipe); - - if(mplayer_current_info)g_free(mplayer_current_info); - mplayer_current_info = mplayer_read_file_info(filename); - mplayer_debugf("Setting info:\n%sTerm\n%i\n%i\n%i\n%i\n\n", - mplayer_current_info->caption, - mplayer_current_info->length * 1000, - mplayer_current_info->abr, - mplayer_current_info->rate, - mplayer_current_info->nch); - mplayer_debugf("debug-play-fileinfo-done\n"); - /* usleep(100000);*/ - mplayer_ip->set_info(mplayer_current_info->caption, - mplayer_current_info->length * 1000, - mplayer_current_info->abr, - mplayer_current_info->rate, - mplayer_current_info->nch); - mplayer_debugf("debug-play-sent-info\n"); - mplayer_debugf("debug- reading configfile\n"); - if (mplayer_current_cfg){ - g_free(mplayer_current_cfg->extra); - g_free(mplayer_current_cfg); - } - mplayer_current_cfg=mplayer_read_cfg(); - if(mplayer_current_cfg->onewin &&(!mplayer_video)){ -/* mplayer_video=gtk_window_new(GTK_WINDOW_DIALOG); - gtk_widget_set_usize(GTK_WIDGET(mplayer_video), 320, 240); - gtk_window_set_title(GTK_WINDOW(mplayer_video), "Audacious - MPlayer"); - gtk_signal_connect(GTK_OBJECT(mplayer_video), - "destroy", - GTK_SIGNAL_FUNC(mplayer_quitting_video), - NULL); - gtk_widget_show(mplayer_video); - sprintf(mplayer_wid,"%i",GDK_WINDOW_XWINDOW(mplayer_video->window)); -*/ - if(!dis) dis = XOpenDisplay(NULL); - assert(dis); - XEvent report; - int blackColor = BlackPixel(dis, DefaultScreen(dis)); - int whiteColor = WhitePixel(dis, DefaultScreen(dis)); - mplayer_video = XCreateSimpleWindow(dis, DefaultRootWindow(dis), 0, 0, - 320, 240, 0, blackColor, blackColor); - XMapWindow(dis,mplayer_video); - XFlush(dis); - XSelectInput (dis, mplayer_video, KeyPressMask); - sprintf(mplayer_wid,"%i",mplayer_video); - } - if((!mplayer_current_cfg->onewin) &&(mplayer_video)){ - XDestroyWindow(dis,mplayer_video); - mplayer_video=0; - mplayer_wid[0]='\0'; - } - if(mplayer_current_cfg->xmmsaudio){ - if(!mplayer_fifoname){ - username = getenv("LOGNAME"); - if(!username)username = getenv("USERNAME"); - if(!username)username = getenv("USER"); - sprintf(temp,"%i",getpid()); - if (!username)mplayer_fifoname=g_strconcat("/tmp/xmmsmplayer-",temp,(char*)0); - else mplayer_fifoname=g_strconcat("/tmp/xmmsmplayer-",username,"-",temp,(char*)0); - mkfifo(mplayer_fifoname,0600); - } - mplayer_ip->output->open_audio(FMT_S16_LE, - mplayer_current_info->rate, - mplayer_current_info->nch); - } - mplayer_debugf("debug- read configfile\n"); - if (mplayer_playing==1) mplayer_debugf("Duplicate call!! -- Panic \n"); - else mplayer_playing=1; - mplayer_debugf("debug-play-creating-thread\n"); - ret = pthread_create(&mplayer_tid, NULL, mplayer_play_loop, arg); - mplayer_debugf("debug-play-out\n\n"); -} - -void mplayer_stop(){ - int ret; - if (mplayer_playing==0) mplayer_debugf("Confusion: Restopped!\n"); - else { - mplayer_playing=0; - if(mplayer_current_cfg->xmmsaudio)mplayer_ip->output->close_audio(); - if (write(mplayer_pipe[1],"quit\n",5)==5){ - mplayer_debugf("debug-stop-if\n"); - }; - mplayer_debugf("debug-stop\n"); - ret = pthread_join(mplayer_tid, NULL); - mplayer_debugf("debug-stop\n\n"); - } -} - -void mplayer_cleanup(){ - if (mplayer_playing) mplayer_stop(); - if (mplayer_fifoname){ - remove(mplayer_fifoname); - g_free(mplayer_fifoname); - mplayer_fifoname=NULL; - } - -} - -void mplayer_pause(short p){ - write(mplayer_pipe[1],"pause\n",6); -} - -void mplayer_seek(int t){ - char buff[16]; - if(mplayer_playing){ - sprintf(buff,"seek %i\n",(t - mplayer_current_time)); - write(mplayer_pipe[1],buff,strlen(buff)); - } -} - -gint mplayer_get_time(){ - return (mplayer_current_time*1000) ; -} -void mplayer_get_song_info(char * filename, char ** title, int * length){ - struct mplayer_info *info; - char *temp,*name; - info = mplayer_read_file_info(filename); - *title = g_strdup(info->caption); - *length = (info->length * 1000); - g_free(info); -} - -void *mplayer_play_loop(void *arg){ - char buff[35]; - int mplayer_slave_pid; - int i,read_length,playtime,one_read; - int mplayer_status_pipe[2]; - int mplayer_error_stream; - int mplayer_fifo_fd; - int pipe_ret; - char **params; - char audio_buff[MPLAYER_AUDIO_SIZE]; - int audio_buff_read; - gboolean audio_flag, status_flag; - struct timespec nanotime; - nanotime.tv_sec=0; - nanotime.tv_nsec=1; - - - pipe_ret=pipe(mplayer_status_pipe); - - if ((mplayer_slave_pid=vfork())==0){ - //close(mplayer_pipe[1]); - mplayer_debugf("debug Pre-exec!\n"); - mplayer_error_stream=open("/dev/null",0); - mplayer_debugf("debug Making vector\n"); - params=mplayer_make_vector(); - mplayer_debugf("debug Made vector\n"); - close(0); - close(1); - close(2); - if(dup2(mplayer_pipe[0],0)!=0) mplayer_debugf("duplication error\n"); - if(dup2(mplayer_status_pipe[1],1)!=0) mplayer_debugf("duplication error\n"); - if(dup2(mplayer_error_stream,2)!=0) mplayer_debugf("duplication error\n"); - /*i=execlp("mplayer","mplayer","-vo","x11","-zoom","-sws","2","-framedrop","-slave","-wid",mplayer_wid,mplayer_file,(char *)0);*/ - i=execvp("mplayer",params); - mplayer_debugf("Fatal Error: Couldnt start MPlayer! exec returned %i\n",i); - _exit(-1); - } - else{ - close(mplayer_status_pipe[1]); /* EXTREMELY IMPORTANT, a little tricky! */ - close(mplayer_pipe[0]); - if(mplayer_current_cfg->xmmsaudio){ - mplayer_debugf("debug - Opening fifo...\n"); - mplayer_fifo_fd=open(mplayer_fifoname,O_RDONLY); - mplayer_debugf("debug - Opened fifo\n"); - fcntl(mplayer_status_pipe[0],F_SETFL,O_NDELAY); - } - audio_buff_read=-1; - read_length=-1; - one_read=-1; - while((wait3((union wait *)0,WNOHANG,(struct rusage *)0)!=mplayer_slave_pid)&&(mplayer_playing==1)){ - audio_flag=FALSE; - status_flag=FALSE; - /* Window event code here */ - if(mplayer_current_cfg->xmmsaudio){ - // do{ - - /* mplayer_debugf("debug - reading fifo...\n");*/ - audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); - if (audio_buff_read==0) break; - if (audio_buff_read>0){ - mplayer_ip->output->write_audio(audio_buff,audio_buff_read); - /*mplayer_ip->add_vis_pcm();*/ - audio_flag=TRUE; - mplayer_debugf(" %i ",audio_buff_read); - } - //} - //while(audio_buff_read>0); - } - do{ - if(mplayer_current_cfg->onewin ){ - XEvent report; - if(XCheckWindowEvent(dis,mplayer_video,KeyPressMask, &report)){ - if (XLookupKeysym(&report.xkey, 0) == XK_f){ - fprintf (stdout, "The f was pressed.\n"); - XMoveResizeWindow(dis,mplayer_video,0,0,1280,1024); - XMapRaised(dis,mplayer_video); - XRaiseWindow(dis,mplayer_video); - XSetTransientForHint(dis,mplayer_video, RootWindow(dis,0)); - - XClientMessageEvent xev; - char *state; - - memset( &xev,0,sizeof( xev ) ); - xev.type=ClientMessage; - xev.message_type=XA_WIN_LAYER; - xev.display=dis; - xev.window=mplayer_video; - xev.format=32; - xev.data.l[0]=10; - xev.data.l[1]=CurrentTime; - XSendEvent( dis,RootWindow( dis,0),False,SubstructureRedirectMask,(XEvent*)&xev ); - - -fprintf(stdout,"Cleared 1\n"); -XSetWindowAttributes attr; - attr.override_redirect = True; - XChangeWindowAttributes(dis,mplayer_video, CWOverrideRedirect, &attr); - - XFlush(dis); - - } - } - } - one_read= read(mplayer_status_pipe[0],buff+read_length,1); - if (one_read==0) break; - if (one_read > 0) { - status_flag=TRUE; - if ((buff[read_length]==(char)13)||(buff[read_length]==(char)10)) read_length=0; - if (read_length < 32 ) read_length++; - if (read_length >= 16){ - sscanf(buff+3,"%i",&playtime); - mplayer_current_time=playtime; - } - } - } - while (one_read>0); - - /* - audio_buff_read=0; - if(mplayer_current_cfg->xmmsaudio){ - mplayer_debugf("debug - reading fifo...\n"); - - audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); - if (audio_buff_read>0)mplayer_ip->output->write_audio(audio_buff,audio_buff_read); - } - read_length=read(mplayer_status_pipe[0],buff,1); - if(read_length>0){ - if ((buff[0]==(char)13)||(buff[0]==(char)10) ) { - one_read=1; - read_length=0; - while((read_length<16)&&(one_read>0)) { - audio_buff_read=0; - if(mplayer_current_cfg->xmmsaudio){ - mplayer_debugf("debug - readin fifo...\n"); - audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); - mplayer_debugf("debug - read fifo...%i\n", audio_buff_read); - if (audio_buff_read>0)mplayer_ip->output->write_audio(audio_buff,audio_buff_read); - } - mplayer_debugf("debug - readin status...\n"); - one_read= read(mplayer_status_pipe[0],buff+read_length,16-read_length); - read_length += one_read; - if ((audio_buff_read <= 0)&&(one_read <= 0)) usleep(5); - } - sscanf(buff+3,"%i",&playtime); - mplayer_current_time=playtime;} - - } - else if ((audio_buff_read <= 0)&&(read_length <= 0)) usleep(5); - */ - - //else if (read_length == -1) break; - } - if (mplayer_playing==1){ - if(mplayer_current_cfg->xmmsaudio)mplayer_ip->output->close_audio(); - mplayer_playing=0; - xmms_remote_playlist_next(ctrlsocket_get_session_id()); - } - // if (mplayer_dont_spawn) mplayer_dont_spawn=0; - // else xmms_remote_playlist_next(ctrlsocket_get_session_id()); - pthread_exit(NULL); - } -} - - -struct mplayer_info *mplayer_read_file_info(char *filename){ - struct mplayer_info *info; - int datalength,done=0; - FILE *inquiry, *size_query; - char mplayer_command[256]; - char buff[4096]; - char *temp; - info=(struct mplayer_info *)malloc(sizeof(struct mplayer_info)); - memset((char *)info,0,sizeof(struct mplayer_info)); - sprintf(mplayer_command,"mplayer -slave -identify -vo null -ao null -frames 0 \"%s\" 2> /dev/null",filename); - inquiry=popen(mplayer_command,"r"); - done=0; - while((!feof(inquiry)) && (done <4000) ){ - fscanf(inquiry,"%c",(buff+done)); - done++; - } - buff[done]=(char)0; - pclose(inquiry); - mplayer_debugf("debug-id\n"); - temp=strstr(buff,"Name:"); - if (temp) mplayer_read_to_eol(info->title,temp+5); - mplayer_debugf("debug-id\n"); - temp=strstr(buff,"Artist:"); - if (temp) mplayer_read_to_eol(info->artist,temp+7); - mplayer_debugf("debug-id\n"); - temp=strstr(buff,"ID_VIDEO_BITRATE="); - if (temp) sscanf(temp+strlen("ID_VIDEO_BITRATE=") ,"%i",&(info->vbr)); - temp=strstr(buff,"ID_VIDEO_WIDTH="); - if (temp) sscanf(temp+strlen("ID_VIDEO_WIDTH=") ,"%i",&(info->x)); - temp=strstr(buff,"ID_VIDEO_HEIGHT="); - if (temp) sscanf(temp+strlen("ID_VIDEO_HEIGHT=") ,"%i",&(info->y)); - temp=strstr(buff,"ID_AUDIO_BITRATE="); - if (temp) sscanf(temp+strlen("ID_AUDIO_BITRATE="),"%i",&(info->abr)); - info->br = info->abr + info->vbr; - temp=strstr(buff,"ID_AUDIO_RATE="); - if (temp) sscanf(temp+strlen("ID_AUDIO_RATE="),"%i",&(info->rate)); - temp=strstr(buff,"ID_AUDIO_NCH="); - if (temp) sscanf(temp+strlen("ID_AUDIO_NCH="),"%i",&(info->nch)); - temp=strstr(buff,"ID_LENGTH="); - if (temp) sscanf(temp+strlen("ID_LENGTH="),"%i",&(info->length)); - else{ - sprintf(mplayer_command,"du -b \"%s\" ",filename); - size_query=popen(mplayer_command,"r"); - fscanf(size_query,"%i",&(info->filesize)); - pclose(size_query); - if (info->br > 0) info->length=((info->filesize * 8)/(info->br));} - mplayer_debugf("debug-id\n"); - info->filename=filename; - if((strlen(info->artist)+strlen(info->title)>0)){ - sprintf(info->caption,"%s - %s",info->artist,info->title);} - else{ - temp = g_strdup(g_basename(filename)); - strcpy(info->caption,temp); - free(temp); - if ((temp = strrchr(info->caption, '.')) != NULL) - *temp = '\0'; - } - mplayer_debugf("debug-id\n\n"); - return info; -} - -char **mplayer_make_vector(){ /*To be passed to exec*/ - char** vector; - char** temp; - int i=0; - vector =(char **)malloc(sizeof(char*)*MPLAYER_MAX_VECTOR); - memset(vector,0,sizeof(char*)*MPLAYER_MAX_VECTOR); - mplayer_vector_append(vector,"mplayer"); - mplayer_vector_append(vector,"-slave"); - if(mplayer_current_cfg->vo){ - mplayer_vector_append(vector,"-vo"); - switch(mplayer_current_cfg->vo){ - case MPLAYER_VO_XV: - mplayer_vector_append(vector,"xv"); - break; - case MPLAYER_VO_X11: - mplayer_vector_append(vector,"x11"); - break; - case MPLAYER_VO_GL: - mplayer_vector_append(vector,"gl"); - break; - case MPLAYER_VO_SDL: - mplayer_vector_append(vector,"sdl"); - break; - } - } - if(mplayer_current_cfg->ao){ - mplayer_vector_append(vector,"-ao"); - switch( mplayer_current_cfg->ao){ - case MPLAYER_AO_OSS: - mplayer_vector_append(vector,"oss"); - break; - case MPLAYER_AO_ARTS: - mplayer_vector_append(vector,"arts"); - break; - case MPLAYER_AO_ESD: - mplayer_vector_append(vector,"esd"); - break; - case MPLAYER_AO_ALSA: - mplayer_vector_append(vector,"alsa"); - break; - case MPLAYER_AO_SDL: - mplayer_vector_append(vector,"sdl"); - break; - } - } - if(mplayer_current_cfg->zoom) mplayer_vector_append(vector,"-zoom"); - if(mplayer_current_cfg->framedrop)mplayer_vector_append(vector,"-framedrop"); - if(mplayer_current_cfg->idx) mplayer_vector_append(vector,"-idx"); - if(mplayer_current_cfg->onewin){ - mplayer_vector_append(vector,"-wid"); - mplayer_vector_append(vector,mplayer_wid);} - if(mplayer_current_cfg->xmmsaudio){ - mplayer_vector_append(vector,"-ao"); - mplayer_vector_append(vector,"pcm"); - mplayer_vector_append(vector,"-aofile"); - mplayer_vector_append(vector,mplayer_fifoname); - mplayer_vector_append(vector,"-autosync"); - mplayer_vector_append(vector,"10000"); - mplayer_vector_append(vector,"-nowaveheader"); - mplayer_vector_append(vector,"-format"); - mplayer_vector_append(vector,"128"); - } - if(mplayer_current_cfg->extra){ - mplayer_debugf("debug - adding extra options\n"); - temp= g_strsplit(mplayer_current_cfg->extra," ",0); - while(temp[i]){ - mplayer_vector_append(vector,temp[i]); - i++; - } - g_strfreev(temp); - } - - mplayer_vector_append(vector,mplayer_file); - return vector; -} -void mplayer_vector_append(char**vector,char*param){ - int i=0; - while(vector[i])i++; - if(i >= (MPLAYER_MAX_VECTOR -1)) { - mplayer_debugf("Too many arguments to mplayer!!\n"); - mplayer_debugf("Ignoring parameter: %s\n",param); - return; - } - mplayer_debugf("Adding parameter: %s\n",param); - vector[i]=strdup(param); -} - -void mplayer_read_to_eol(char *str1,char *str2){ - /* copy str2 to str1 till \n is reached in str2 */ - int i=0,j=0; - while(!((str2[j]=='\n')||(str2[j]==(char)0)||(str2[j]==(char)10)||(j>32) )) - str1[i++]=str2[j++]; - str1[i]=(char)0; -} - - -static void mplayer_about(void) -{ - static GtkWidget *window = NULL; - if (window) - return; - - window = xmms_show_message( - "About " PACKAGE, - PACKAGE " " VERSION "\n" - "Author: " " Nandan Dixit " " <nandan@cse.iitb.ac.in>" "\n" - "http://xmmsmplayer.sourceforge.net/" "\n" - "Ported to Audacious: " " Aaron Sheldon " "\n" - "http://audacious-media-player.org/" "\n" - "This library is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU Library General Public\n", - "Ok", FALSE, NULL, NULL); - - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); - - gtk_widget_show(window); - -} -/* -void mplayer_quitting_video(GtkWidget *widget, gpointer data) { - mplayer_debugf("debug - entered quitting_video\n"); - if(widget==mplayer_video){ - mplayer_debugf("debug - correct widget\n"); - mplayer_video=NULL; - mplayer_wid[0]='\0'; - } -} -*/
--- a/src/mplayer/xmmsmplayer.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -//#include <iconv.h> -//#include <libintl.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <audacious/plugin.h> -#include <audacious/beepctrl.h> -#include <audacious/rcfile.h> -#include <audacious/util.h> -#include <time.h> - -#define MPLAYER_INFO_SIZE 128 -#define MPLAYER_TITLE_SIZE 260 -#define MPLAYER_AUDIO_SIZE 4096 -#define MPLAYER_MAX_VECTOR 64 - -/* For debugging output change the define below */ -#define mplayer_debugf -/* #define mplayer_debugf printf */ - - -enum mplayer_vo{ - MPLAYER_VO_NONE = 0, - MPLAYER_VO_XV, - MPLAYER_VO_X11, - MPLAYER_VO_GL, - MPLAYER_VO_SDL -}; - -enum mplayer_ao{ - MPLAYER_AO_NONE = 0, - MPLAYER_AO_OSS, - MPLAYER_AO_ARTS, - MPLAYER_AO_ESD, - MPLAYER_AO_ALSA, - MPLAYER_AO_SDL, - MPLAYER_AO_XMMS -}; -struct mplayer_info { /* Stores the info about a file */ - gchar *filename; - gint vbr,abr,br; /*Video, audio and total bitrates */ - gchar artist[MPLAYER_INFO_SIZE]; - gchar title[MPLAYER_INFO_SIZE]; - glong filesize; /* bytes */ - gint length; /* in seconds */ - gchar caption[MPLAYER_TITLE_SIZE]; - gint rate; /*sampling rate*/ - gint nch; /*no of channels */ - gint x,y; /*x,y resolution */ -} -; - -struct mplayer_cfg{ - gint vo,ao; - gboolean zoom,framedrop,idx,onewin,xmmsaudio; - gchar *extra; -}; - -void mplayer_read_to_eol(char *str1,char *str2); -char **mplayer_make_vector(); -void *mplayer_play_loop(void *arg); -void mplayer_vector_append(char**vector,char*param); - -struct mplayer_info *mplayer_read_file_info(char *filename); -gint mplayer_is_our_file(char *filename); -void mplayer_quitting_video(GtkWidget *widget, gpointer data); -void mplayer_play_file(char *filename); -void mplayer_stop(); -void mplayer_cleanup(); -void mplayer_pause(short p); -void mplayer_seek(int t); -gint mplayer_get_time(); -void mplayer_get_song_info(char * filename, char ** title, int * length); -void mplayer_init(); -InputPlugin *get_iplugin_info(void); - -void on_button_ok_clicked (GtkButton *button, gpointer user_data); -GtkWidget* mplayer_create_configure_win (void); -void mplayer_configure(); -static void mplayer_about(void); -struct mplayer_cfg *mplayer_read_cfg(); -void mplayer_quitting_video(GtkWidget *widget, gpointer data);
--- a/src/notify/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -OBJECTIVE_LIBS = libnotify$(SHARED_SUFFIX) - -LIBDIR = $(plugindir)/$(GENERAL_PLUGIN_DIR) - -SOURCES = notify.c - -OBJECTS = ${SOURCES:.c=.o} - -CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(LIBNOTIFY_CFLAGS) $(ARCH_DEFINES) -I../../intl -I../.. -DDATA_DIR=\"$(datadir)\" - -CXXFLAGS = $(CFLAGS) - -LIBADD = $(GTK_LIBS) $(LIBNOTIFY_LIBS) - -include ../../mk/objective.mk
--- a/src/notify/notify.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,346 +0,0 @@ -/* - * libnotify plugin for audacious 1.1+ - * http://nenolod.net/code/audacious-notify - * - * See `COPYING' in the directory root for license details. - */ -#include <glib.h> -#include <glib/gi18n.h> -#include <gtk/gtk.h> -#include <string.h> - -#include <libnotify/notify.h> -#include "audacious/plugin.h" -#include "audacious/playlist.h" -#include "audacious/input.h" -#include "audacious/configdb.h" - -#include "config.h" - -static void init(void); -static void cleanup(void); -static void configure_gui(void); -static void configure_load(void); -static void configure_save(void); -static gboolean watchdog_func(gpointer unused); -static gint timeout_tag = 0; - -static gint notify_playlist_pos = -1; -static gchar *previous_title = NULL; -static gboolean was_playing = FALSE; - -typedef struct -{ - gint notif_timeout; - gboolean notif_neverexpire; - gboolean notif_skipnf; -} -audcfg_t; - -static audcfg_t audcfg = { 5000 , FALSE , TRUE }; - -/* our API. */ -static void do_notification(gchar *summary, gchar *message, gchar *icon_uri); - -GeneralPlugin notify_gp = -{ - NULL, /* handle */ - NULL, /* filename */ - -1, /* xmms_session */ - NULL, /* Description */ - init, - NULL, - configure_gui, - cleanup -}; - -GeneralPlugin *get_gplugin_info(void) -{ - notify_gp.description = g_strdup_printf(_("libnotify Plugin %s"), PACKAGE_VERSION); - return ¬ify_gp; -} - -static void init(void) -{ - /* load configuration */ - configure_load(); - - /* Initialise libnotify */ - notify_init(PACKAGE); - - /* - TODO: I assume 100 means 100ms checking interval? Why not 200? - It would be twice as efficient and the user shouldn't notice any difference. - */ - timeout_tag = g_timeout_add(100, watchdog_func, NULL); -} - -static void cleanup(void) -{ - if ( timeout_tag > 0 ) - { - g_source_remove(timeout_tag); - timeout_tag = 0; - } - - if (previous_title != NULL) - { - g_free(previous_title); - previous_title = NULL; - } - - /* Uninitialise libnotify */ - if ( notify_is_initted() == TRUE ) - notify_uninit(); -} - -static gboolean watchdog_func(gpointer unused) -{ - gint pos = playlist_get_position(); - gchar *title = playlist_get_songtitle(pos); - - /* - Trigger a notice if a song is now playing and one of the following is true: - 1. it has a different title from the last time this ran - 2. there is no title but it's a different playlist position - 3. the player was stopped the last time this ran - (listed in the order they are checked) - - FIXME: The same song twice in a row will only get announced once. - Proposed Remedy: Add a check for playback progress. - */ - if (ip_data.playing && - ((title != NULL && previous_title != NULL && - g_strcasecmp(title, previous_title)) || - (title == NULL && pos != notify_playlist_pos) || (! was_playing))) - { - gchar *tmpbuf, *filename, *songtitle; - TitleInput *tuple; - - tuple = playlist_get_tuple(pos); - - if (tuple == NULL) - return TRUE; - - if (tuple->performer || tuple->album_name || tuple->track_name) { - filename = playlist_get_filename(pos); - - tmpbuf = g_markup_printf_escaped("<b>%s</b>\n<i>%s</i>\n%s", - (tuple->performer ? tuple->performer : ( audcfg.notif_skipnf == FALSE ? _("Unknown Artist") : "" )), - (tuple->album_name ? tuple->album_name : ( audcfg.notif_skipnf == FALSE ? _("Unknown Album") : "" )), - (tuple->track_name ? - tuple->track_name : - (filename ? - (strrchr(filename, '/') ? (strrchr(filename, '/') + 1) : filename) : - _("Unknown Track") - ) - ) - ); - } else { - songtitle = playlist_get_songtitle(pos); - - tmpbuf = g_markup_printf_escaped("%s", (songtitle ? songtitle : _("Unknown Track"))); - } - - do_notification("Audacious", tmpbuf, DATA_DIR "/pixmaps/audacious.png"); - g_free(tmpbuf); - } - - notify_playlist_pos = pos; - - if (previous_title != NULL) - { - g_free(previous_title); - previous_title = NULL; - } - - previous_title = g_strdup(title); - was_playing = ip_data.playing; - - return TRUE; -} - -static void do_notification(gchar *summary, gchar *message, gchar *icon_uri) -{ - NotifyNotification *n; - gint ret; - - n = notify_notification_new(summary, - message, - NULL, NULL); - - /* make sure we have a notify object before continuing, - * for paranoia's sake anyhow. -nenolod - */ - if (n == NULL) - return; - - if ( audcfg.notif_neverexpire == FALSE ) - notify_notification_set_timeout(n, audcfg.notif_timeout); - else - notify_notification_set_timeout(n, NOTIFY_EXPIRES_NEVER); - - if (icon_uri != NULL) - { - GdkPixbuf *gp = gdk_pixbuf_new_from_file(icon_uri, NULL); - - if (gp != NULL) - { - notify_notification_set_icon_from_pixbuf(n, GDK_PIXBUF(gp)); - g_object_unref(G_OBJECT(gp)); - } - } - - ret = notify_notification_show(n, NULL); - -#if 0 - /* rainy day: handle this condition below -nenolod */ - if (ret == 0) - { - /* do something */ - } -#endif - - g_object_unref(G_OBJECT(n)); -} - - -/* ABOUTBOX - TODO -> complete me with credits info! - -static void about_gui(void) -{ - static GtkWidget *aboutwin = NULL; - gchar *aboutstr; - - if ( aboutwin != NULL ) - return; - - aboutstr = g_strdup_printf( _("Audacious libnotify Plugin\n\n...") ); - aboutwin = xmms_show_message( _("About libnotify Plugin"), _(aboutstr), _("Ok"), FALSE, NULL, NULL); - g_free( aboutstr ); - g_signal_connect( G_OBJECT(aboutwin) , "destroy", G_CALLBACK(gtk_widget_destroyed), &aboutwin ); -} -*/ - - -/* CONFIGURATION */ - -static void configure_load(void) -{ - ConfigDb *db; - - db = bmp_cfg_db_open(); - bmp_cfg_db_get_bool(db, "libnotify", "notif_skipnf", &audcfg.notif_skipnf); - bmp_cfg_db_get_int(db, "libnotify", "notif_timeout", &audcfg.notif_timeout); - bmp_cfg_db_get_bool(db, "libnotify", "notif_neverexpire", &audcfg.notif_neverexpire); - bmp_cfg_db_close(db); -} - -static void configure_save(void) -{ - ConfigDb *db = bmp_cfg_db_open(); - bmp_cfg_db_set_bool(db, "libnotify", "notif_skipnf", audcfg.notif_skipnf); - bmp_cfg_db_set_int(db, "libnotify", "notif_timeout", audcfg.notif_timeout); - bmp_cfg_db_set_bool(db, "libnotify", "notif_neverexpire", audcfg.notif_neverexpire); - bmp_cfg_db_close(db); -} - - -static void configure_ev_notiftimeout_toggle( GtkToggleButton *togglebt , gpointer hbox ) -{ - gtk_widget_set_sensitive( GTK_WIDGET(hbox) , !gtk_toggle_button_get_active( togglebt ) ); -} - -static void configure_ev_notifskipnf_commit( gpointer togglebt ) -{ - audcfg.notif_skipnf = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(togglebt) ); -} - -static void configure_ev_notiftimeout_commit( gpointer spinbt ) -{ - audcfg.notif_timeout = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbt) ); -} - -static void configure_ev_notifexpire_commit( gpointer togglebt ) -{ - audcfg.notif_neverexpire = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(togglebt) ); -} - -static void configure_ev_bok( gpointer configwin ) -{ - configure_save(); - gtk_widget_destroy( GTK_WIDGET(configwin) ); -} - -static void configure_gui(void) -{ - static GtkWidget *configwin = NULL; - GtkWidget *configwin_vbox; - GtkWidget *notif_info_frame, *notif_info_vbox, *notif_info_skipnf_cbt; - GtkWidget *notif_timeout_frame, *notif_timeout_hbox, *notif_timeout_vbox; - GtkWidget *notif_timeout_spinbt, *notif_timeout_cbt; - GtkWidget *hbuttonbox, *button_ok, *button_cancel; - - if ( configwin != NULL ) - return; - - configwin = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_type_hint( GTK_WINDOW(configwin), GDK_WINDOW_TYPE_HINT_DIALOG ); - gtk_window_set_title( GTK_WINDOW(configwin), _("libnotify plugin") ); - gtk_container_set_border_width( GTK_CONTAINER(configwin), 10 ); - g_signal_connect( G_OBJECT(configwin) , "destroy" , G_CALLBACK(gtk_widget_destroyed) , &configwin ); - configwin_vbox = gtk_vbox_new( FALSE , 6 ); - gtk_container_add( GTK_CONTAINER(configwin) , configwin_vbox ); - button_ok = gtk_button_new_from_stock( GTK_STOCK_OK ); - - /* notification info */ - notif_info_frame = gtk_frame_new( _("Notification details") ); - gtk_box_pack_start( GTK_BOX(configwin_vbox) , notif_info_frame , TRUE , TRUE , 0 ); - notif_info_vbox = gtk_vbox_new( FALSE , 4 ); - gtk_container_set_border_width( GTK_CONTAINER(notif_info_vbox), 4 ); - gtk_container_add( GTK_CONTAINER(notif_info_frame) , notif_info_vbox ); - notif_info_skipnf_cbt = gtk_check_button_new_with_label( _("Skip empty fields") ); - g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" , - G_CALLBACK(configure_ev_notifskipnf_commit) , notif_info_skipnf_cbt ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notif_info_skipnf_cbt) , audcfg.notif_skipnf ); - gtk_box_pack_start( GTK_BOX(notif_info_vbox) , notif_info_skipnf_cbt , FALSE , FALSE , 0 ); - - /* notification timeout */ - notif_timeout_frame = gtk_frame_new( _("Notification timeout") ); - gtk_box_pack_start( GTK_BOX(configwin_vbox) , notif_timeout_frame , TRUE , TRUE , 0 ); - notif_timeout_vbox = gtk_vbox_new( FALSE , 4 ); - gtk_container_set_border_width( GTK_CONTAINER(notif_timeout_vbox), 4 ); - gtk_container_add( GTK_CONTAINER(notif_timeout_frame) , notif_timeout_vbox ); - notif_timeout_hbox = gtk_hbox_new( FALSE , 2 ); - notif_timeout_spinbt = gtk_spin_button_new_with_range( 1 , 20000 , 100 ); - gtk_spin_button_set_value( GTK_SPIN_BUTTON(notif_timeout_spinbt) , (gdouble)audcfg.notif_timeout ); - g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" , - G_CALLBACK(configure_ev_notiftimeout_commit) , notif_timeout_spinbt ); - gtk_box_pack_start( GTK_BOX(notif_timeout_hbox) , - gtk_label_new( _("Expire time:") ) , FALSE , FALSE , 0 ); - gtk_box_pack_start( GTK_BOX(notif_timeout_hbox) , notif_timeout_spinbt , FALSE , FALSE , 0 ); - gtk_box_pack_start( GTK_BOX(notif_timeout_hbox) , - gtk_label_new( _("ms") ) , FALSE , FALSE , 0 ); - gtk_box_pack_start( GTK_BOX(notif_timeout_vbox) , notif_timeout_hbox , FALSE , FALSE , 0 ); - notif_timeout_cbt = gtk_check_button_new_with_label( _("Notification never expires") ); - g_signal_connect( G_OBJECT(notif_timeout_cbt) , "toggled" , - G_CALLBACK(configure_ev_notiftimeout_toggle) , notif_timeout_hbox ); - g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" , - G_CALLBACK(configure_ev_notifexpire_commit) , notif_timeout_cbt ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notif_timeout_cbt) , audcfg.notif_neverexpire ); - gtk_box_pack_start( GTK_BOX(notif_timeout_vbox) , notif_timeout_cbt , FALSE , FALSE , 0 ); - - /* buttons */ - hbuttonbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout( GTK_BUTTON_BOX(hbuttonbox) , GTK_BUTTONBOX_END ); - button_cancel = gtk_button_new_from_stock( GTK_STOCK_CANCEL ); - g_signal_connect_swapped( G_OBJECT(button_cancel) , "clicked" , - G_CALLBACK(gtk_widget_destroy) , configwin ); - gtk_container_add( GTK_CONTAINER(hbuttonbox) , button_cancel ); - g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" , - G_CALLBACK(configure_ev_bok) , configwin ); - gtk_container_add( GTK_CONTAINER(hbuttonbox) , button_ok ); - gtk_box_pack_start( GTK_BOX(configwin_vbox) , hbuttonbox , FALSE , FALSE , 0 ); - - gtk_widget_show_all( configwin ); -}
--- a/src/sap/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -include ../../mk/rules.mk -include ../../mk/init.mk - -OBJECTIVE_LIBS = libsapplug$(SHARED_SUFFIX) -SUBDIRS = saplib - -LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR) - -LIBADD += $(GTK_LIBS) ./saplib/libsap.a - -SOURCES = fileinfo.c sapfile.c sap_plug.c - -CFLAGS += $(GTK_CFLAGS) $(PICFLAGS) -I../../intl -I../.. -CXXFLAGS += $(GTK_CFLAGS) $(PICFLAGS) -I../../intl -I../.. - -OBJECTS = ${SOURCES:.c=.o} - -include ../../mk/objective.mk
--- a/src/sap/doc/CHANGES Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -0.1 - first release (nothing works except "play" :)) - -0.2 - added vis_plugin hooks (spectrum analyzer works now) ;-) - - some fixes - -0.3 - compiler optimizations - - Fixed some compiler warnings in saplib - - Makefile has install target now :) - - Made saplib-exported routines callable from within C code. - - No sapPlaySong on SAP load (sapEngine.cpp), caller should initialize song - - Corrected title display - - Can skip to subsongs if they exist. - - File info box - - Can edit and write SAP tags - - sourcetree reorganisation :) - - fixed compilation problems with gcc 3.x - - should compile on FreeBSD - -0.3f - merged a fix from Miloslaw Smyk for a bug with Crossfade output plugin - (song played twice as fast after some time, not seen using OSS output) - -0.31 - fix for segfault crash with file info (ctrl+3) - - works on FreeBSD out of the box - \ No newline at end of file
--- a/src/sap/doc/COMPILATION Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -COMPILATION REQUIREMENTS ------------------------- - -To compile the plugin you need: - - - gcc/g++ and at least libc6 2.1.x with POSIX pthreads - and a linux or *BSD system - - TESTED: - linux/x86 (gcc 2.95.2 and glibc 2.1.3) - compiles cleanly, works OK - linux/x86 (gcc 2.95.4 and glibc 2.2.5) - compiles cleanly, works OK - linux/alpha (gcc 3.2.2 and glibc 2.2.5) - compiles cleanly, works OK - - - xmms (of course :)), libxmms,libxmms-devel - - TESTED: - xmms 1.2.7 - OK - REPORTED: - xmms 1.2.8 - OK - - - gtk,gtk-devel, glib,glib-devel - - TESTED: - gtk+ 1.2.10 glib 1.2.10 - OK - REPORTED - gtk+ 1.2.8 glib 1.2.8 - OK - - -COMPILATION INSTRUCTIONS ------------------------- - -NOTE: Since I cannot have access to as many platforms as linux runs on, I need the -information about copilation issues on different machines/oses/architectures. -Just compile it! If it fails drop me a line with info on your system, -compiler and glibc versions. -If it compiles OK, and you use something different than the software / platform -mentioned above as TESTED, I need the info even more. Please be helpful ;) - -To compile just do a 'make && make install' in the plugin source dir. -That's it. Enjoy!
--- a/src/sap/doc/CREDITS Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -AUTHORS -------- -Michal Szwaczko (mikey@scene.pl) - -This plugin wouldn't be possible without the work of -Adam 'SoTe' Bienias. Adam wrote saplib, a portable POKEY+6502 emulator library -that is used extensively by the plugin. Thanks Adam!. - -CONTRIBUTORS ------------- -Azbest (azbest@plasma.ath.cx) - bugreports, FTP space. -Miloslaw Smyk (thorgal@wfmh.org.pl) - bugfix for Crossfade output plugin. -Mattias Fenner (informix@web.de) - bugreports, XMMS pluginpack maintainer. -Daniel Kozminski (dely@scene.pl) - media support :) - -[This space is for you]
--- a/src/sap/doc/README Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -SAPPLUG - an XMMS plugin for POKEY tunes ----------------------------------------- - -Sapplug is a POKEY tunes player plugin for X Multimedia System (xmms) -This is a beta release, after first alpha versions seem to work fine. - -This, however means that it's still a work-in-progress software, some -features are missing. If you find some bugs - firs look in TODO list -to check if I am already working on them, same with new features requests. - -!!! Check TODO before sending me hate-mail. !!! - -USAGE ------ - -Just fire up xmms as you would normally and load some SAP tunes. -In case of not being able to play check in the preferences if -the plugin is installed and active!!! -Do not hesitate to mail me if you have problems compiling the plugin, -hovewer, due to limited amount of time, I will not be able to answer any -mail concerning general use of xmms or general plugin installation. -Report problems with *compiling* or *using* *this* plugin !!! - -Some notes: - -The seekbar is used to switch subsongs within a multi-song SAP. -Just click on it and the player plays next subsong! -The number of songs in a SAP file is displayed in the main xmms window -as X kHz (where X is the number of songs within the SAP file) -This info is also available in the sapfile info box. - -File info box is brought up when you click "View file info" in XMMS :) -It gives you general information about SAP file and presents so called -SAP tag. It's a set of name, author and date of the song, similar to an mp3 tag. -You can also edit this SAP tag, i.e. change author, name or date of the song. -Click "Save" and the new tag gets written to the file. Also, you can remove -the tag from the SAPfile by clicking "Remove Tag" - -Enjoy!! --- -mikey -New Generation // WireLabs -<mikey@scene.pl> \ No newline at end of file
--- a/src/sap/doc/README.audacious Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -Audacious sapplug-xmms Port 0.31 - -Copyright (c) 2006 Aaron Sheldon - -This is a port of sapplug-xmms, an atari SAP music player. - -Refer to the README for more information
--- a/src/sap/doc/TODO Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -TODO list for SAP plugin. - -- Make plugin jump to next song in playlist when finished -- Seek within a song -
--- a/src/sap/fileinfo.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <gtk/gtk.h> -#include <audacious/util.h> -#include <string.h> - -#include "fileinfo.h" -#include "saplib/sapLib.h" - -static void fail (gchar *error) { - - gchar *errorstring; - - errorstring = g_strdup_printf("An error occured:\n%s", error); - xmms_show_message("Error!",errorstring, "Ok", FALSE, NULL, NULL); - g_free(errorstring); - return; -} - - -static void write_tag (GtkWidget *w , gpointer data) { - - - gchar *author, *title, *date, *tmpfn, *original_filename; - FILE *outf; - - int ofd; - - /* tags taken from info_box (edited or not) */ - author = (gchar*)gtk_entry_get_text(GTK_ENTRY(performer_entry)); - title = (gchar*)gtk_entry_get_text(GTK_ENTRY(title_entry)); - date = (gchar*)gtk_entry_get_text(GTK_ENTRY(date_entry)); - original_filename = (gchar*)gtk_entry_get_text(GTK_ENTRY(filename_entry)); - - // prepare tmp file - tmpfn = g_strdup_printf("/tmp/sapplugXXXXXX"); - - if ((ofd = mkstemp( tmpfn )) < 0 ) { - - fail("Can't make tempfile"); - g_free(tmpfn); - return; - - } - - if ((outf = fdopen(ofd,"wb")) == NULL ) { - - g_free(tmpfn); - fail("Cant write to file"); - close(ofd); - return; - - } - - /* start writing header */ - - fprintf(outf,"SAP\r\n"); - - if (strlen(author) != 0) - - fprintf(outf, "AUTHOR \"%s\"\r\n",author); - - if (strlen(title) != 0) - - fprintf(outf,"NAME \"%s\"\r\n",title); - - if (strlen(date) != 0) - - fprintf(outf,"DATE \"%s\"\r\n",date); - - /* save original songtype */ - - fprintf(outf,"TYPE %c\r\n",type_h); - - /* save original TAGS */ - - if (is_stereo == 1) - - fprintf(outf,"STEREO\r\n"); - - if (fastplay != -1) - - fprintf(outf,"FASTPLAY %d\r\n",fastplay); - - if (songs != -1) - - fprintf(outf,"SONGS %d\r\n",songs); - - if (defsong != -1) - - fprintf(outf,"DEFSONG %d\r\n",defsong); - - if (ini_address != -1) - - fprintf(outf,"INIT %.4X\r\n",ini_address); - - if (msx_address != -1) - - fprintf(outf,"MUSIC %.4X\r\n",msx_address); - - if (plr_address != -1) - - fprintf(outf,"PLAYER %.4X\r\n",plr_address); - - /* header written - now append original SAP data */ - - fwrite(&buffer+headersize, 1, filesize-headersize,outf); - fclose(outf); - - /* and rename it */ - if (rename(tmpfn,original_filename) < 0) { - - remove(tmpfn); - g_free(tmpfn); - fail("Failed to write!"); - return; - } - - remove(tmpfn); - g_free(tmpfn); - gtk_widget_destroy(window); - -} - -static void remove_tag (void) { - - gtk_entry_set_text(GTK_ENTRY(performer_entry),""); - gtk_entry_set_text(GTK_ENTRY(title_entry),""); - gtk_entry_set_text(GTK_ENTRY(date_entry),""); - -} - -void sap_file_info_box(char *filename) { - - gchar *tmp; - gchar *info_text; - - static GtkWidget *info_frame, *info_box, *sap_info_label; - static GtkWidget *tag_frame; - - GtkWidget *hbox, *label, *filename_hbox, *vbox, *left_vbox; - GtkWidget *table, *bbox, *cancel_button; - GtkWidget *save_button, *remove_button; - - - if (filename != NULL) { - - /* dig info from the sapfile */ - if ((load_sap(filename)) < 0) return; - - if (!window) { - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), vbox); - - filename_hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); - - label = gtk_label_new("Filename:"); - gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); - filename_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); - gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry,TRUE, TRUE, 0); - - hbox = gtk_hbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - - left_vbox = gtk_vbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); - - tag_frame = gtk_frame_new("SAP Tag:"); - gtk_box_pack_start(GTK_BOX(left_vbox), tag_frame, FALSE, FALSE, 0); - - table = gtk_table_new(5, 5, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_container_add(GTK_CONTAINER(tag_frame), table); - - label = gtk_label_new("Title:"); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 5, 5); - - title_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new("Artist:"); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 5, 5); - - performer_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), performer_entry, 1, 4, 1, 2, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new("Date:"); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, - GTK_FILL, GTK_FILL, 5, 5); - - date_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), - GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0); - - save_button = gtk_button_new_with_label("Save"); - gtk_signal_connect(GTK_OBJECT(save_button), "clicked", - GTK_SIGNAL_FUNC(write_tag), NULL); - - GTK_WIDGET_SET_FLAGS(save_button, GTK_CAN_DEFAULT); - - gtk_box_pack_start(GTK_BOX(bbox), save_button, TRUE, TRUE, 0); - gtk_widget_grab_default(save_button); - - remove_button = gtk_button_new_with_label("Remove Tag"); - gtk_signal_connect_object(GTK_OBJECT(remove_button), - "clicked", - GTK_SIGNAL_FUNC(remove_tag), NULL); - - GTK_WIDGET_SET_FLAGS(remove_button, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox),remove_button, TRUE, TRUE, 0); - - cancel_button = gtk_button_new_with_label("Cancel"); - gtk_signal_connect_object(GTK_OBJECT(cancel_button), - "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - GTK_OBJECT(window)); - GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox),cancel_button, TRUE, TRUE, 0); - - /* info frame */ - info_frame = gtk_frame_new("SAP Info:"); - gtk_box_pack_start(GTK_BOX(hbox), info_frame, FALSE, FALSE, 0); - - info_box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(info_frame), info_box); - gtk_container_set_border_width(GTK_CONTAINER(info_box), 5); - gtk_box_set_spacing(GTK_BOX(info_box), 0); - - sap_info_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(sap_info_label), 0, 0); - gtk_label_set_justify(GTK_LABEL(sap_info_label), - GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(info_box), sap_info_label, FALSE, - FALSE, 0); - /* end info frame */ - - gtk_widget_show_all(window); - - } else - - gdk_window_raise(window->window); - gtk_widget_set_sensitive(tag_frame, TRUE); - - /* window drawn and displayed ... now - the code - - clear up entries */ - remove_tag(); - - /* show filename in the entrybox */ - gtk_entry_set_text(GTK_ENTRY(filename_entry),filename); - /* and in the window title ... */ - tmp = g_strdup_printf("File Info - [%s]", g_basename(filename)); - gtk_window_set_title(GTK_WINDOW(window), tmp); - - /* fill up entries with what we dug out from the sapfile */ - gtk_entry_set_text(GTK_ENTRY(performer_entry),author); - gtk_entry_set_position(GTK_ENTRY(performer_entry),0); - gtk_entry_set_text(GTK_ENTRY(title_entry),name); - gtk_entry_set_position(GTK_ENTRY(title_entry),0); - gtk_entry_set_text(GTK_ENTRY(date_entry),date); - gtk_entry_set_position(GTK_ENTRY(date_entry),0); - /* fill in sap_info_frame; */ - info_text = g_strdup_printf( - "Type: %s\nStereo: %s\nSpeed: %d / Frame\nSongs: %d\n\nSize: %ld\n", - - type, - (is_stereo > 0) ? "Yes" : "No", - times_per_frame, - (songs > 0) ? songs : 1, - filesize ); - - gtk_label_set_text(GTK_LABEL(sap_info_label),info_text); - - /* cleanup */ - g_free(info_text); - g_free(tmp); - - } - -}
--- a/src/sap/fileinfo.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ - -static GtkWidget *title_entry, *performer_entry; -static GtkWidget *date_entry; -static GtkWidget *filename_entry; -static GtkWidget *window = NULL; - -extern int load_sap (char *); -extern unsigned char buffer; - -extern long filesize; -extern int headersize; -extern char author[]; -extern char name[]; -extern char date[]; -extern int is_stereo; -extern int fastplay; -extern char type_h; /* type as seen in SAP header; */ -extern char type[]; /* type in ascii; */ -extern int plr_address; -extern int msx_address; -extern int ini_address; -extern int songs; -extern int defsong; -extern int times_per_frame;
--- a/src/sap/sap_plug.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <audacious/util.h> -#include <audacious/plugin.h> -#include <glib.h> -#include <string.h> - -#include "sap_plug.h" - -InputPlugin sap_ip = { - - NULL, - NULL, - "SAP Plugin " VERSION, - NULL, - sap_about, - NULL, - sap_is_our_file, - NULL, - sap_play_file, - sap_stop, - sap_pause, - sap_seek, - NULL, - sap_get_time, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - sap_file_info_box, - NULL -}; - -InputPlugin *get_iplugin_info (void) { - return &sap_ip; -} - -static int sap_is_our_file (char *filename) { - - char *ext; - - ext = strrchr(filename, '.'); - - if (ext) - { - if (!strcmp(ext, ".SAP")) - return 1; - if (!strcmp(ext, ".sap")) - return 1; - } - - return 0; -} - -static void *play_loop (gpointer arg) -{ - while (going) - { - sapRenderBuffer(play_buf,N_RENDER); - - /* for spectrum analyser */ - produce_audio(sap_ip.output->written_time(), FMT_S16_NE, 2, N_RENDER<<2, play_buf, &going); - } - - sap_ip.output->buffer_free(); - sap_ip.output->buffer_free(); - g_thread_exit(NULL); -} - -static void sap_play_file (char *filename) -{ - GString *titstr; - - if ((currentFile = sapLoadMusicFile(filename)) == NULL) return; - - /* for tunes */ - tunes = currentFile->numOfSongs; - - if (tunes < 0) tunes = 1; - - /* we always start with 1st tune */ - currentSong = 0; - - sapPlaySong(currentSong); - - going = TRUE; - audio_error = FALSE; - - if (sap_ip.output->open_audio(FMT_S16_LE, OUTPUT_FREQ, 2) == 0) { - - audio_error = TRUE; - going = FALSE; - - return; - } - /* delete '.sap' from filename to display */ - titstr = g_string_new(g_basename(filename)); - g_string_truncate(titstr,titstr->len - 4); - - sap_ip.set_info(titstr->str, tunes, tunes*1024, OUTPUT_FREQ, 2); - - g_string_free(titstr,TRUE); - - play_thread = g_thread_create(play_loop, NULL, TRUE, NULL); -} - -static void sap_stop (void) -{ - if (going) - { - going = FALSE; - g_thread_join(play_thread); - sap_ip.output->close_audio(); - } -} - -static void sap_seek(int time) { - - if (currentSong != tunes) { - - currentSong = (currentSong+1) % currentFile->numOfSongs; - sapPlaySong(currentSong); - sap_ip.output->flush(currentSong * 1000); - - } -} - -static void sap_pause(short paused) { - - sap_ip.output->pause(paused); - -} - -static int sap_get_time(void) { - - return sap_ip.output->output_time(); -} - -static void sap_about (void) { - - static GtkWidget *aboutbox; - - if (aboutbox != NULL) - return; - - aboutbox = xmms_show_message( - "About SAP Plugin", - "SAP Player plug-in v"VERSION"\nby Michal Szwaczko <mikey@scene.pl>\n SAP library ver 0.3F by Adam Bienias\n\n" - "Get more POKEY sound from ASMA at:\n[http://asma.musichall.cz]\n\nEnjoy!", - "Ok", FALSE, NULL, NULL); - - gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), &aboutbox); -}
--- a/src/sap/sap_plug.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ -#include "saplib/sapLib.h" - -/* Default frequency */ -#define OUTPUT_FREQ 44100 -/* how many samples per one saprender() */ -#define N_RENDER 1024 - -/* functions */ -static int sap_is_our_file (char *); -static void sap_play_file(gchar *); -static void sap_stop(void); -static void sap_pause(short); -static void sap_seek(int); -static int sap_get_time(void); -static void sap_about(void); - -extern void sap_file_info_box(char *); - -static gboolean going; -static gboolean audio_error; -GThread *play_thread; - -int currentSong; -static int tunes; - -sapMUSICstrc *currentFile; - -signed short play_buf[N_RENDER << 2];
--- a/src/sap/sapfile.c Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <string.h> - -#include "sapfile.h" - -int load_sap (char *fname) { - - struct stat st; - int i, k; - - FILE *f; - - /* flush static buffers */ - - memset(author, 0, 2048); - memset(name, 0, 2048); - memset(date, 0, 2048); - memset(type, 0, 20); - - /* get filesize */ - - if (stat(fname, &st) < 0) - - return -1; - - filesize = st.st_size; - - /* open & read file into buffer */ - - f = fopen(fname, "rb"); - - if ( !f ) - - return -1; - - fread(buffer, 1, filesize, f); - - fclose(f); - - /* check if it is a sap file */ - - if (strncmp(buffer, "SAP", 3) != 0 ) - - return -1; - - /* set headersize */ - - for (i = 0; i < filesize; i++) { - - if (buffer[i] == '\xFF' ) { - - headersize = i; - break; - } - - if (buffer[i] != '\xFF' && i == filesize-1) - - return -1; - } - - /* sanity checking done - parse the info tags - please someone rewrite this !!! :) - this code sux0r ... */ - - /* check for author */ - - k = 0; - - for (i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "AUTHOR", 6) == 0 ) { - - i = i + 8; - - while (buffer[i] != '"' && buffer[i] != 0x0D && buffer[i] != 0x0A) { - - author[k] = buffer[i]; - k++; i++; - } - break; - } - /* notfound */ - sprintf(author, "%s", ""); - } - - /* check for name */ - - k = 0; - - for (i = 0;i < headersize; i++) { - - if ( strncmp(buffer + i, "NAME", 4) == 0 ) { - - i = i + 6; - - while (buffer[i] != '"' && buffer[i] != 0x0D && buffer[i] != 0x0A) { - - name[k] = buffer[i]; - k++; i++; - } - break; - } - /* notfound */ - sprintf(name, "%s", ""); - } - - /* check for date */ - - k = 0; - - for(i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "DATE", 4) == 0 ) { - - i = i + 6; - - while (buffer[i] != '"' && buffer[i] != 0x0D && buffer[i] != 0x0A) { - - date[k] = buffer[i]; - k++; i++; - } - break; - } - /* notfound */ - sprintf(date, "%s", ""); - } - - - /* check for stereo */ - - for (i = 0; i < headersize; i++) { - - if (strncmp(buffer + i, "STEREO", 6) == 0 ) { - - is_stereo = 1; - break; - } - /* notfound */ - is_stereo = -1; - } - - /* check fastplay; */ - - for (i = 0; i < headersize; i++) { - - if (strncmp(buffer + i, "FASTPLAY", 8) == 0 ) { - - k = strtol(&buffer[i + 1 + 8], NULL, 10); - - if ( k == 0 || k > 312 ) - - /* illegal fastplay value */ - return -1; - - else - - fastplay = k; - - switch (k) { - - case 156: - - times_per_frame = 2; - break; - - case 104: - - times_per_frame = 3; - break; - - case 78: - - times_per_frame = 4; - break; - - } - break; - } - /* notfound */ - fastplay = -1; - times_per_frame = 1; - } - - /* check songs */ - for (i = 0; i < headersize; i++) { - - if (strncmp(buffer + i, "SONGS", 5) == 0) { - - k = strtol(&buffer[i + 1 + 5], NULL, 10); - - if ( (k == 0) || (k > 0xffff) ) - /* illegal songs value */ - return -1; - else - - songs = k; - break; - } - /* notfound */ - songs = -1; - } - - /* check defsong */ - for (i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "DEFSONG", 7) == 0 ) { - - k = strtol(&buffer[i + 1 + 7], NULL, 10); - - if ( (k < 0) || (k > 0xffff) ) - /* illegal defsong value */ - return -1; - - else - - defsong = k; - break; - } - /* notfound */ - defsong = -1; - } - - - /* check songtype */ - for (i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "TYPE", 4) == 0 ) { - - i = i + 5; - - if (buffer[i] == 'B') { - /* SAP documentation says - "any player" */ - sprintf(type, "Standard"); - type_h = 'B'; - break; - } - - if (buffer[i] == 'S') { - - sprintf(type, "SoftSynth"); - type_h = 'S'; - break; - } - - if (buffer[i] == 'D') { - - sprintf(type, "DigiSynth"); - type_h = 'D'; - break; - } - - if (buffer[i] == 'C') { - - sprintf(type, "CMC Synth"); - type_h= 'C'; - break; - } - - if (buffer[i] == 'M') { - /* unsupported (?) */ - sprintf(type, "M-Type"); - type_h = 'M'; - break; - } - - if (buffer[i] == 'R') { - /* this is unsupported - perhaps we */ - /* should return -1 as for now */ - sprintf(type, "Regs"); - type_h = 'R'; - break; - } - /* unsupported songtype */ - return -1; - } - /* no type specified */ - if (i == headersize - 1) return -1; - - } - - /* msx_address */ - for (i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "MUSIC", 5) == 0 ) { - - k = strtol(&buffer[i + 1 + 5], NULL, 16); - - if ( (k == 0) || (k > 0xffff) ) - /* illegal address */ - return -1; - else - - msx_address = k; - break; - } - /* notfound */ - msx_address = -1; - } - - /* ini address */ - for (i = 0;i < headersize; i++) { - - if (strncmp(buffer + i, "INIT", 4) == 0 ) { - - k = strtol(&buffer[i + 1 + 4], NULL, 16); - - if ( (k == 0) || (k > 0xffff) ) - /* illegal address */ - return -1; - else - - ini_address = k; - break; - } - /* notfound */ - ini_address = -1; - } - /* player */ - for (i = 0; i < headersize; i++) { - - if (strncmp(buffer + i,"PLAYER", 6) == 0 ) { - - k = strtol(&buffer[i + 1 + 6], NULL, 16); - - if ( (k == 0) || (k > 0xffff) ) - /* illegal */ - return -1; - else - - plr_address = k; - break; - } - /* notfound */ - plr_address = -1; - } - - return 1; -}
--- a/src/sap/sapfile.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * SAP xmms plug-in. - * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> - * - * SAP Library ver. 1.56 by Adam Bienias - * - * This is free software. You can modify it and distribute it under the terms - * of the GNU General Public License. The verbatim text of the license can - * be found in file named COPYING in the source directory. - * - * 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 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. - * - */ - -char buffer[0x10000]; - -char author[2048]; -char name[2048]; -char date[2048]; -char type[20]; /* type in ascii */ -char type_h; /* type as seen in SAP header; */ - -long filesize; - -int headersize; -int is_stereo; -int fastplay; -int plr_address; -int msx_address; -int ini_address; -int songs; -int defsong; -int times_per_frame; /* times per frame */
--- a/src/sap/saplib/Makefile Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -include ../../../mk/rules.mk -include ../../../mk/init.mk - -CFLAGS += $(PICFLAGS) -I../../intl -I../.. -CXXFLAGS += $(PICFLAGS) -I../../intl -I../.. - -OBJECTIVE_LIBS_NOINST = libsap.a -SOURCES = pokey0.cxx pokey1.cxx sapCpu.cxx sapEngine.cxx sapPokey.cxx - -OBJECTS = ${SOURCES:.cxx=.o} - -include ../../../mk/objective.mk - -libsap.a: $(OBJECTS) - $(AR) cq $@ $(OBJECTS)
--- a/src/sap/saplib/legal.txt Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - Disclaimer. - -I, Adam Bienias, author of the SAP Library, I'm not responsible -for any kind of hardware or software damage caused by this library. -Use it on your risk. SAP Library is distributed as FREEWARE but -any changes in the library must be approved by me. If You use SAP -Library in Your program, then You must include information about -SAP library: "SAP Library ver.x.xx by Adam Bienias". - - For contact send email to: adam@nautilus.com.pl
--- a/src/sap/saplib/pokey0.cxx Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -#include <ctype.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "sapGlobals.h" - -#define NAMESPACENAME POKEY0_NAMESPACE -#define POKEY_INIT_FUNC void pokeyInit0( void ) -#define POKEY_RESET_FUNC void pokeyReset0( void ) -#define POKEY_UPDATESOUND_FUNC void pokeyUpdateSound0( int n ) -#define POKEY_UPDATECOUNT_FUNC void pokeyUpdateSoundCounters0( void ) -#define POKEY_WRITE_FUNC void pokeyWriteByte0( short unsigned int address, BYTE value ) -#define POKEY_WRITE_2FUNC(a,v) pokeyWriteByte0(a,v) - -#include "pokeyNamespace.h" - -bool *generateIRQ0 = &POKEY0_NAMESPACE::generateIRQ0; - -POKEY_WRITE_FUNC -{ - address&=0x0F; - - switch( address ) - { - case 0x00: - divideByN_Latch[0] = value; - SetupChannels01; - break; - case 0x01: - audioControl_Latch[0] = value; - audioControl_Latch2[0] = value&15; - audioControl_Latch_Digi[0] = (value>>4)&1 ? 15:0; - Channel0Distortion = channelsDistorionTable0[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels01; - break; - case 0x02: - divideByN_Latch[1] = value; - SetupChannels01; - break; - case 0x03: - audioControl_Latch[1] = value; - audioControl_Latch2[1] = value&15; - audioControl_Latch_Digi[1] = (value>>4)&1 ? 15:0; - Channel1Distortion = channelsDistorionTable1[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels01; - break; - case 0x04: - divideByN_Latch[2] = value; - SetupChannels23; - break; - case 0x05: - audioControl_Latch[2] = value; - audioControl_Latch2[2] = value&15; - audioControl_Latch_Digi[2] = (value>>4)&1 ? 15:0; - Channel2Distortion = channelsDistorionTable2[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels23; - break; - case 0x06: - divideByN_Latch[3] = value; - SetupChannels23; - break; - case 0x07: - audioControl_Latch[3] = value; - audioControl_Latch2[3] = value&15; - audioControl_Latch_Digi[3] = (value>>4)&1 ? 15:0; - Channel3Distortion = channelsDistorionTable3[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels23; - break; - case 0x08: - { - BYTE prevAUDCTL; - prevAUDCTL = AUDCTL; - AUDCTL = value; - pcc1564 = value & 1 ? 112:28; - - noiseAND = AUDCTL & 128 ? 0x1FF:0x1FFFF; - - switch_J3_Q_stateAND[0] = AUDCTL&4 ? 15:0; - switch_J3_Q_stateAND[1] = AUDCTL&2 ? 15:0; - - SetupChannels01; - SetupChannels23; - - if( (prevAUDCTL^AUDCTL)&0x10 ) - divideByN[1] = 2; - if( (prevAUDCTL^AUDCTL)&0x8 ) - divideByN[3] = 2; - - break; - } - case 0x0D: - break; - case 0x0E: - // najpierw czyscimy status przerwan IRQ_ST. Tam gdzie we wpisywanej wartosci jest 0, - // status tego przerwania jest zerowany - IRQ_ST = IRQ_ST&value; - IRQ_EN = value; - // teraz sprawdzamy czy musimy ustawic linie IRQ - IRQ_line = ((IRQ_ST&IRQ_EN)!=0x00) ? 0x01:0x00; - break; - case 0x0F: - break; - } -} - -void pokeyGenerateCheckIRQline( void ) -{ - if( ((cpuFlag_I&1)==0) && IRQ_line ) - { - BYTE fl,lsb,msb; - atariMem[0x100 + cpuReg_S] = (cpuReg_PC>>8)&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = cpuReg_PC&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = fl = cpuGetFlags(); cpuReg_S--; - lsb = atariMem[0xFFFE]; msb = atariMem[0xFFFF]; - cpuReg_PC = ((WORD)lsb) + ((WORD)msb)*256; - } -} - -void pokeyGenerateIRQ( BYTE irqMask ) -{ - IRQ_ST |= irqMask; - IRQ_line = ((IRQ_ST&IRQ_EN)!=0x00) ? 0x01:0x00; - pokeyGenerateCheckIRQline(); -} - -
--- a/src/sap/saplib/pokey1.cxx Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -#include <ctype.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "sapGlobals.h" - -#define NAMESPACENAME POKEY1_NAMESPACE -#define POKEY_INIT_FUNC void pokeyInit1( void ) -#define POKEY_RESET_FUNC void pokeyReset1( void ) -#define POKEY_UPDATESOUND_FUNC void pokeyUpdateSound1( int n ) -#define POKEY_UPDATECOUNT_FUNC void pokeyUpdateSoundCounters1( void ) -#define POKEY_WRITE_FUNC void pokeyWriteByte1( short unsigned int address, BYTE value ) -#define POKEY_WRITE_2FUNC(a,v) pokeyWriteByte1(a,v) - -#include "pokeyNamespace.h" - -POKEY_WRITE_FUNC -{ - address&=0x0F; - - switch( address ) - { - case 0x00: - divideByN_Latch[0] = value; - SetupChannels01; - break; - case 0x01: - audioControl_Latch[0] = value; - audioControl_Latch2[0] = value&15; - audioControl_Latch_Digi[0] = (value>>4)&1 ? 15:0; - Channel0Distortion = channelsDistorionTable0[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels01; - break; - case 0x02: - divideByN_Latch[1] = value; - SetupChannels01; - break; - case 0x03: - audioControl_Latch[1] = value; - audioControl_Latch2[1] = value&15; - audioControl_Latch_Digi[1] = (value>>4)&1 ? 15:0; - Channel1Distortion = channelsDistorionTable1[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels01; - break; - case 0x04: - divideByN_Latch[2] = value; - SetupChannels23; - break; - case 0x05: - audioControl_Latch[2] = value; - audioControl_Latch2[2] = value&15; - audioControl_Latch_Digi[2] = (value>>4)&1 ? 15:0; - Channel2Distortion = channelsDistorionTable2[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels23; - break; - case 0x06: - divideByN_Latch[3] = value; - SetupChannels23; - break; - case 0x07: - audioControl_Latch[3] = value; - audioControl_Latch2[3] = value&15; - audioControl_Latch_Digi[3] = (value>>4)&1 ? 15:0; - Channel3Distortion = channelsDistorionTable3[ (value>>4)&15 ]; - if( !(value&0x10) ) - SetupChannels23; - break; - case 0x08: - { - BYTE prevAUDCTL; - prevAUDCTL = AUDCTL; - AUDCTL = value; - pcc1564 = value & 1 ? 112:28; - - noiseAND = AUDCTL & 128 ? 0x1FF:0x1FFFF; - - switch_J3_Q_stateAND[0] = AUDCTL&4 ? 15:0; - switch_J3_Q_stateAND[1] = AUDCTL&2 ? 15:0; - - SetupChannels01; - SetupChannels23; - - if( (prevAUDCTL^AUDCTL)&0x10 ) - divideByN[1] = 2; - if( (prevAUDCTL^AUDCTL)&0x8 ) - divideByN[3] = 2; - - break; - } - case 0x0D: - break; - case 0x0E: - break; - case 0x0F: - break; - } -}
--- a/src/sap/saplib/pokeyNamespace.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,665 +0,0 @@ -// This is very funny piece of code :)). This is a "fake" pokey template. - -namespace NAMESPACENAME { - -BYTE IRQ_EN; -BYTE IRQ_ST; -BYTE IRQ_line; -bool generateIRQ0; - -const double cutFreq = 24000.0 / 44100.0; // cutoff frequency = 20000, sampling frequency = 44100 -const int samplerRate = 0x2836D6; // (1773447 / 44100) * 65536; -const int samplerRateOver = 0xA0DB5/2; // (1773447 / 176400) * 65536; - -//const double cutFreq2 = 26000.0 / 1773447.0; // cutoff frequency = 20000, sampling frequency = 44100 -const double cutFreq2 = 28000.0 / 176400; // cutoff frequency = 20000, sampling frequency = 44100 - -const int cutFreq2i = 650; - -#define MAKESAMPLE\ - {\ - ss-=0x10000;\ - if( ss<0 )\ - {\ - ss += samplerRateOver;\ - DWORD pomd; int pomi;\ - pomd = ((DWORD*)&switch_J3_Q_state[0])[0];\ - pomd &= ((DWORD*)&switch_J3_Q_stateAND[0])[0];\ - pomd ^= ((DWORD*)&signal_state_out[0])[0];\ - pomd &= ((DWORD*)&freq_sequre[0])[0];\ - pomd |= ((DWORD*)&audioControl_Latch_Digi[0])[0];\ - pomd &= ((DWORD*)&audioControl_Latch2[0])[0];\ - pomd = pomd + (pomd>>16);\ - pomi = (int)( pomd + (pomd>>8) ) & 255;\ - oldValI = oldValI + ((cutFreq2i*((pomi<<12) - oldValI))>>12);\ - delay++; if( (delay&7)==0 )\ - {\ - pomi = oldValI>>3;\ - if( pomi<-16384 ) pomi = -16384; else if( pomi>32767 ) pomi = 32767;\ - sndBuf[sndBufPtr] = (WORD)pomi;\ - sndBufPtr = (sndBufPtr+sampleStep)&16383;\ - }\ - }\ - } - -int sndBufPtrUpp; - -int oldValI = 0; -double oldVal=0.0; -int delay = 0; - -BYTE AUDCTL; -int pcc1564,noiseAND,pokeyClockCounter64k; - -DWORD pokeyClockCounter; -DWORD poly4Counter,poly5Counter,poly4_5Counter; - -BYTE poly17[0x20000]; -BYTE poly4_b[36000]; // minimum size is 312*114+15 -BYTE poly5_b[36000]; // minimum size is 312*114+31 -BYTE poly4_5_b[37000]; // minimum size is 312*114+465 - -BYTE poly4[15] = { -15, 15, 15, 15, 0, 0, 0, 15, 0, 0, 15, 15, 0, 15, 0 -}; - -BYTE poly5[31] = { -15, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 0, 0, 0, 0, 0, 15, 15, 15, 0, 0, 15, 0, 0, 0, 15, 0, 15, 0 -}; - -int divideByN[4]; -int divideByN_Latch[4]; -int divideByN_Latch2[4]; -BYTE switch_J2_signal_Q[4]; -BYTE signal_state_out[4]; -BYTE switch_J3_Q_state[4]; -BYTE switch_J3_Q_stateAND[4]; -BYTE audioControl_Latch[4]; -BYTE audioControl_Latch2[4]; -BYTE audioControl_Latch_Digi[4]; -BYTE freq_sequre[4]; - -void (*Channel0Distortion)(void); -void (*Channel1Distortion)(void); -void (*Channel2Distortion)(void); -void (*Channel3Distortion)(void); - -//--- -void channel0_0( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[0] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel0_2( void ) -{ - signal_state_out[0] = signal_state_out[0] ^ poly5_b[ poly5Counter + pokeyClockCounter ]; -} -void channel0_4( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[0] = poly4_b[ poly4Counter + pokeyClockCounter ]; -} -void channel0_8( void ) -{ - signal_state_out[0] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel0_A( void ) -{ - signal_state_out[0] = signal_state_out[0] ^ 15; -} -void channel0_C( void ) -{ - signal_state_out[0] = poly4_b[ pokeyClockCounter + poly4Counter ]; -} -//--- -void channel1_0( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[1] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel1_2( void ) -{ - signal_state_out[1] = signal_state_out[1] ^ poly5_b[ poly5Counter + pokeyClockCounter ]; -} -void channel1_4( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[1] = poly4_b[ poly4Counter + pokeyClockCounter ]; -} -void channel1_8( void ) -{ - signal_state_out[1] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel1_A( void ) -{ - signal_state_out[1] = signal_state_out[1] ^ 15; -} -void channel1_C( void ) -{ - signal_state_out[1] = poly4_b[ pokeyClockCounter + poly4Counter ]; -} -//--- -void channel2_0( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[2] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel2_2( void ) -{ - signal_state_out[2] = signal_state_out[2] ^ poly5_b[ poly5Counter + pokeyClockCounter ]; -} -void channel2_4( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[2] = poly4_b[ poly4Counter + pokeyClockCounter ]; -} -void channel2_8( void ) -{ - signal_state_out[2] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel2_A( void ) -{ - signal_state_out[2] = signal_state_out[2] ^ 15; -} -void channel2_C( void ) -{ - signal_state_out[2] = poly4_b[ pokeyClockCounter + poly4Counter ]; -} -//--- -void channel3_0( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[3] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel3_2( void ) -{ - signal_state_out[3] = signal_state_out[3] ^ poly5_b[ poly5Counter + pokeyClockCounter ]; -} -void channel3_4( void ) -{ - if( poly5_b[ poly5Counter + pokeyClockCounter ]!=0 ) - signal_state_out[3] = poly4_b[ poly4Counter + pokeyClockCounter ]; -} -void channel3_8( void ) -{ - signal_state_out[3] = poly17[ pokeyClockCounter & noiseAND ]; -} -void channel3_A( void ) -{ - signal_state_out[3] = signal_state_out[3] ^ 15; -} -void channel3_C( void ) -{ - signal_state_out[3] = poly4_b[ pokeyClockCounter + poly4Counter ]; -} - -void channel0_1( void ) -{ - signal_state_out[0] = 15; -} -void channel1_1( void ) -{ - signal_state_out[1] = 15; -} -void channel2_1( void ) -{ - signal_state_out[2] = 15; -} -void channel3_1( void ) -{ - signal_state_out[3] = 15; -} - -typedef void (*funcPoint)(void); -funcPoint channelsDistorionTable0[16]= - { &channel0_0, &channel0_1, &channel0_2, &channel0_1, &channel0_4, &channel0_1, &channel0_2, &channel0_1, &channel0_8, &channel0_1, &channel0_A, &channel0_1, &channel0_C, &channel0_1, &channel0_A, &channel0_1 }; -funcPoint channelsDistorionTable1[16]= - { &channel1_0, &channel1_1, &channel1_2, &channel1_1, &channel1_4, &channel1_1, &channel1_2, &channel1_1, &channel1_8, &channel1_1, &channel1_A, &channel1_1, &channel1_C, &channel1_1, &channel1_A, &channel1_1 }; -funcPoint channelsDistorionTable2[16]= - { &channel2_0, &channel2_1, &channel2_2, &channel2_1, &channel2_4, &channel2_1, &channel2_2, &channel2_1, &channel2_8, &channel2_1, &channel2_A, &channel2_1, &channel2_C, &channel2_1, &channel2_A, &channel2_1 }; -funcPoint channelsDistorionTable3[16]= - { &channel3_0, &channel3_1, &channel3_2, &channel3_1, &channel3_4, &channel3_1, &channel3_2, &channel3_1, &channel3_8, &channel3_1, &channel3_A, &channel3_1, &channel3_C, &channel3_1, &channel3_A, &channel3_1 }; - -void pus_zero( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - - i = n; - do - { - pokeyClockCounter++; - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; - -} - -void pus_2h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_23h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_0h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_01h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; - -} - -void pus_02h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_012h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_023h( int n ) -{ -unsigned int i; -unsigned int ch; -DWORD pp; -int ss; - - pp = pokeyClockCounter + (pcc1564 - pokeyClockCounter64k); - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - if( pokeyClockCounter>=pp ) - { - pp = pokeyClockCounter + pcc1564; - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; - pokeyClockCounter64k = pcc1564 + pokeyClockCounter - pp ; -} - -void pus_0123h( int n ) -{ -unsigned int i; -unsigned int ch; -int ss; - - ss = sndBufPtrUpp; - i = n; - do - { - pokeyClockCounter++; - ch = 0; { if( --divideByN[ch]==0 ) { generateIRQ0=true; divideByN[ch] = divideByN_Latch2[ch]; Channel0Distortion(); } } - ch = 1; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel1Distortion(); } } - ch = 2; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel2Distortion(); switch_J3_Q_state[0] = signal_state_out[0]; } } - ch = 3; { if( --divideByN[ch]==0 ) { divideByN[ch] = divideByN_Latch2[ch]; Channel3Distortion(); switch_J3_Q_state[1] = signal_state_out[1]; } } - MAKESAMPLE - } while(--i); - sndBufPtrUpp = ss; -} - -typedef void (*funcPoint2)(int n); - -funcPoint2 channelsGeneration[16]={ - &pus_zero, &pus_zero, &pus_zero, &pus_zero, - &pus_2h, &pus_23h, &pus_2h, &pus_23h, - &pus_0h, &pus_0h, &pus_01h, &pus_01h, - &pus_02h, &pus_023h, &pus_012h, &pus_0123h -}; - -}; // end of namespace POKEY_NAMESPACE - -using namespace NAMESPACENAME; - -POKEY_INIT_FUNC -{ -unsigned int i; -DWORD pol; -BYTE old; - - pol = 0x1FFFF; - for( i=0; i<0x20000; i++ ) - { - poly17[i] = (BYTE)(pol&1 ? 15:0); - pol = pol | (((pol&1) ^ ((pol>>5)&1)) << 17); - pol>>=1; - } - - for( i=0; i<sizeof(poly4_b); i++ ) // this table repeats after 15 - poly4_b[i] = poly4[i % 15]; - - for( i=0; i<sizeof(poly5_b); i++ ) // this table repeats after 31 - poly5_b[i] = poly5[i % 31]; - - old = 0; - for( i=0; i<sizeof(poly4_5_b); i++ ) // this table repeats after 465 - { - if( poly5[i % 31] ) - old = poly4[i % 15]; - poly4_5_b[i] = old; - } - -} - -POKEY_RESET_FUNC -{ -int i; - - IRQ_EN = 0x00; - IRQ_ST = 0x00; - IRQ_line = 0x00; - - poly4Counter = 0; - poly5Counter = 0; - poly4_5Counter = 0; - pokeyClockCounter = 0; - pokeyClockCounter64k = 0; - pcc1564 = 28; - oldValI = 0; - oldVal =0.0; - - for( i=0; i<4; i++ ) - { - divideByN[i] = 1; - divideByN_Latch[i] = 0; - divideByN_Latch2[i] = 0; - switch_J2_signal_Q[i] = 0; - signal_state_out[i] = 0; - switch_J3_Q_state[i] = 0; - switch_J3_Q_stateAND[i] = 0; - audioControl_Latch[i] = 0; - audioControl_Latch2[i] = 0; - audioControl_Latch_Digi[i] = 0; - freq_sequre[i] = 0; - } - - for( i=0; i<16; i++ ) - POKEY_WRITE_2FUNC( 0xD200+i, 0 ); - AUDCTL = 0; - POKEY_WRITE_2FUNC( 0xD208, 0x28 ); - - sndBufPtrUpp = 0; - delay = 0; - -} - -POKEY_UPDATESOUND_FUNC -{ - - channelsGeneration[ (AUDCTL>>3)&15 ](n); - -} - - -POKEY_UPDATECOUNT_FUNC -{ - - pokeyClockCounter = pokeyClockCounter & 0x7FFFFFFF; - poly4Counter = (int)(((DWORD)(poly4Counter+pokeyClockCounter)) % 15) - pokeyClockCounter; - poly5Counter = (int)(((DWORD)(poly5Counter+pokeyClockCounter)) % 31) - pokeyClockCounter; - poly4_5Counter = (int)(((DWORD)(poly4_5Counter+pokeyClockCounter)) % 465) - pokeyClockCounter; - -} - -#undef SetupChannels01 -#undef SetupChannels23 - -#define SetupChannels01\ - switch( AUDCTL&0x50 )\ - {\ - case 0x00:\ - divideByN_Latch2[0] = divideByN_Latch[0]+1;\ - if( ((audioControl_Latch[0]&0xA0)==0xA0) && (divideByN_Latch2[0]<3) )\ - freq_sequre[0] = 0;\ - else\ - freq_sequre[0] = 15;\ - divideByN_Latch2[1] = divideByN_Latch[1]+1;\ - if( ((audioControl_Latch[1]&0xA0)==0xA0) && (divideByN_Latch2[1]<3) )\ - freq_sequre[1] = 0;\ - else\ - freq_sequre[1] = 15;\ - break;\ - case 0x10:\ - divideByN_Latch2[0] = divideByN_Latch[0]+1;\ - if( ((audioControl_Latch[0]&0xA0)==0xA0) && (divideByN_Latch2[0]<3) )\ - freq_sequre[0] = 0;\ - else\ - freq_sequre[0] = 15;\ - divideByN_Latch2[1] = divideByN_Latch[1]*256+divideByN_Latch2[0];\ - if( ((audioControl_Latch[1]&0xA0)==0xA0) && (divideByN_Latch2[1]<3) )\ - freq_sequre[1] = 0;\ - else\ - freq_sequre[1] = 15;\ - break;\ - case 0x40:\ - divideByN_Latch2[0] = divideByN_Latch[0]+4;\ - if( ((audioControl_Latch[0]&0xA0)==0xA0) && (divideByN_Latch2[0]<0x50) )\ - freq_sequre[0] = 0;\ - else\ - freq_sequre[0] = 15;\ - divideByN_Latch2[1] = divideByN_Latch[1]+1;\ - if( ((audioControl_Latch[1]&0xA0)==0xA0) && (divideByN_Latch2[1]<3) )\ - freq_sequre[1] = 0;\ - else\ - freq_sequre[1] = 15;\ - break;\ - case 0x50:\ - divideByN_Latch2[0] = divideByN_Latch[0]+7;\ - freq_sequre[0] = 0;\ - divideByN_Latch2[1] = divideByN_Latch[1]*256+divideByN_Latch2[0];\ - if( ((audioControl_Latch[1]&0xA0)==0xA0) && (divideByN_Latch2[1]<0x50) )\ - freq_sequre[1] = 0;\ - else\ - freq_sequre[1] = 15;\ - break;\ - } - -#define SetupChannels23\ - switch( AUDCTL&0x28 )\ - {\ - case 0x00:\ - divideByN_Latch2[2] = divideByN_Latch[2]+1;\ - if( ((audioControl_Latch[2]&0xA0)==0xA0) && (divideByN_Latch2[2]<3) )\ - freq_sequre[2] = 0;\ - else\ - freq_sequre[2] = 15;\ - divideByN_Latch2[3] = divideByN_Latch[3]+1;\ - if( ((audioControl_Latch[3]&0xA0)==0xA0) && (divideByN_Latch2[3]<3) )\ - freq_sequre[3] = 0;\ - else\ - freq_sequre[3] = 15;\ - break;\ - case 0x08:\ - divideByN_Latch2[2] = divideByN_Latch[2]+1;\ - if( ((audioControl_Latch[2]&0xA0)==0xA0) && (divideByN_Latch2[2]<3) )\ - freq_sequre[2] = 0;\ - else\ - freq_sequre[2] = 15;\ - divideByN_Latch2[3] = divideByN_Latch[3]*256+divideByN_Latch2[2];\ - if( ((audioControl_Latch[3]&0xA0)==0xA0) && (divideByN_Latch2[3]<3) )\ - freq_sequre[3] = 0;\ - else\ - freq_sequre[3] = 15;\ - break;\ - case 0x20:\ - divideByN_Latch2[2] = divideByN_Latch[2]+4;\ - if( ((audioControl_Latch[2]&0xA0)==0xA0) && (divideByN_Latch2[2]<0x50) )\ - freq_sequre[2] = 0;\ - else\ - freq_sequre[2] = 15;\ - divideByN_Latch2[3] = divideByN_Latch[3]+1;\ - if( ((audioControl_Latch[3]&0xA0)==0xA0) && (divideByN_Latch2[3]<3) )\ - freq_sequre[3] = 0;\ - else\ - freq_sequre[3] = 15;\ - break;\ - case 0x28:\ - divideByN_Latch2[2] = divideByN_Latch[2]+7;\ - freq_sequre[2] = 0;\ - divideByN_Latch2[3] = divideByN_Latch[3]*256+divideByN_Latch2[2];\ - if( ((audioControl_Latch[3]&0xA0)==0xA0) && (divideByN_Latch2[3]<0x50) )\ - freq_sequre[3] = 0;\ - else\ - freq_sequre[3] = 15;\ - break;\ - }
--- a/src/sap/saplib/sapCpu.cxx Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1581 +0,0 @@ -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "sapGlobals.h" - -void cpuInit( void ) -{ - cpuReg_PC = 0xFFFF; - cpuReg_S = 0xFF; - cpuReg_A = 0x00; - cpuReg_X = 0x00; - cpuReg_Y = 0x00; - cpuSetFlags( 0x20 ); -} - - -void cpuSetFlags( BYTE flags ) -{ - cpuFlag_N = flags; - cpuFlag_V = (flags>>6)&1; - cpuFlag_B = (flags>>4)&1; - cpuFlag_D = (flags>>3)&1; - cpuFlag_I = (flags>>2)&1; - cpuFlag_Z = (flags&2)==0 ? 1:0; - cpuFlag_C = flags&1; -} - - -BYTE cpuGetFlags( void ) -{ -BYTE flags; - - flags = (cpuFlag_N&0x80) | ((cpuFlag_V&1)<<6) | 0x20 | ((cpuFlag_B&1)<<4) | ((cpuFlag_D&1)<<3) | ((cpuFlag_I&1)<<2) | (cpuFlag_Z==0 ? 2:0) | (cpuFlag_C&1); - return flags; -} - -#define CPY {\ - cB ^= 255;\ - int cpuIntValue2;\ - cpuIntValue2 = ((int)cpuReg_Y) + ((int)cB) + 1;\ - cpuFlag_N = cpuFlag_Z = (BYTE)cpuIntValue2; cpuFlag_C = (BYTE)(cpuIntValue2>>8);\ - cpuFlag_V = (( ((cpuReg_Y^cB)^0x80) & (cpuReg_Y^cpuIntValue2) & 0x80))&0x80 ? 1:0;\ - } -#define CMP {\ - cB ^= 255;\ - int cpuIntValue2;\ - cpuIntValue2 = ((int)cpuReg_A) + ((int)cB) + 1;\ - cpuFlag_N = cpuFlag_Z = (BYTE)cpuIntValue2; cpuFlag_C = (BYTE)(cpuIntValue2>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB)^0x80) & (cpuReg_A^cpuIntValue2) & 0x80))&0x80 ? 1:0;\ - } -#define CPX {\ - cB ^= 255;\ - int cpuIntValue2;\ - cpuIntValue2 = ((int)cpuReg_X) + ((int)cB) + 1;\ - cpuFlag_N = cpuFlag_Z = (BYTE)cpuIntValue2; cpuFlag_C = (BYTE)(cpuIntValue2>>8);\ - cpuFlag_V = (( ((cpuReg_X^cB)^0x80) & (cpuReg_X^cpuIntValue2) & 0x80))&0x80 ? 1:0;\ - } - -#define DECCMP {\ - cB--;\ - int cpuIntValue2;\ - cpuIntValue2 = ((int)cpuReg_A) + ((int)cB^255) + 1;\ - cpuFlag_N = cpuFlag_Z = (BYTE)cpuIntValue2; cpuFlag_C = (BYTE)(cpuIntValue2>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB^255)^0x80) & (cpuReg_A^cpuIntValue2) & 0x80))&0x80 ? 1:0;\ - } -#define DEC { cB--; cpuFlag_N = cpuFlag_Z = cB; } -#define INC { cB++; cpuFlag_N = cpuFlag_Z = cB; } -#define AND { cpuReg_A &= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define ASL { cpuFlag_C = cB>>7; cB<<=1; cpuFlag_N = cpuFlag_Z = cB; } -#define EOR { cpuReg_A ^= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define ORA { cpuReg_A |= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define ADC {\ - if( cpuFlag_D&1 )\ - {\ - BYTE al,ah;\ - al = (cpuReg_A & 0x0f) + (cB & 0x0f) + (cpuFlag_C&1);\ - if (al > 9) al += 6;\ - ah = ((cpuReg_A >> 4)&0x0F) + ((cB >> 4)&0x0F); if (al > 0x0f) ah++;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A + cB + (cpuFlag_C&1);\ - cpuFlag_V = (((ah << 4) ^ cpuReg_A) & 0x80) && !((cpuReg_A ^ cB) & 0x80) ? 1:0;\ - if (ah > 9) ah += 6; cpuFlag_C = (ah > 0x0f) ? 1:0; cpuReg_A = (ah << 4) | (al & 0x0f);\ - }\ - else\ - {\ - WORD te;\ - te = cpuReg_A + cB + (cpuFlag_C&1);\ - cpuFlag_C = (BYTE)(te>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB)^0x80) & (cpuReg_A^te) & 0x80)) ? 1:0;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A = (BYTE)te;\ - }\ - } -#define SBC {\ - if( cpuFlag_D&1 )\ - {\ - BYTE al,ah; unsigned int tmp; tmp = (DWORD)cpuReg_A - (DWORD)cB - (WORD)((cpuFlag_C&1)^1);\ - al = (cpuReg_A & 0x0f) - (cB & 0x0f) - ((cpuFlag_C&1)^1);\ - ah = ((cpuReg_A >> 4)&0x0F) - ((cB >> 4)&0x0F); if (al & 0x10) { al -= 6; ah--; } if (ah & 0x10) ah -= 6;\ - cpuFlag_C = (tmp < (unsigned int)0x100) ? 1:0; cpuFlag_N = cpuFlag_Z = (BYTE)tmp;\ - cpuFlag_V = (((cpuReg_A ^ tmp) & 0x80) && ((cpuReg_A ^ cB) & 0x80) ) ? 1:0;\ - cpuReg_A = (ah << 4) | (al & 0x0f);\ - }\ - else\ - {\ - WORD te;\ - te = cpuReg_A + (cB^255) + (cpuFlag_C&1);\ - cpuFlag_C = (BYTE)(te>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB^255)^0x80) & (cpuReg_A^te) & 0x80)) ? 1:0;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A = (BYTE)te;\ - }\ - } -#define INCSBC {\ - cB++;\ - if( cpuFlag_D&1 )\ - {\ - BYTE al,ah; unsigned int tmp; tmp = (DWORD)cpuReg_A - (DWORD)cB - (WORD)((cpuFlag_C&1)^1);\ - al = (cpuReg_A & 0x0f) - (cB & 0x0f) - ((cpuFlag_C&1)^1);\ - ah = ((cpuReg_A >> 4)&0x0F) - ((cB >> 4)&0x0F); if (al & 0x10) { al -= 6; ah--; } if (ah & 0x10) ah -= 6;\ - cpuFlag_C = (tmp < (unsigned int)0x100) ? 1:0; cpuFlag_N = cpuFlag_Z = (BYTE)tmp;\ - cpuFlag_V = (((cpuReg_A ^ tmp) & 0x80) && ((cpuReg_A ^ cB) & 0x80) ) ? 1:0;\ - cpuReg_A = (ah << 4) | (al & 0x0f);\ - }\ - else\ - {\ - WORD te;\ - te = cpuReg_A + (cB^255) + (cpuFlag_C&1);\ - cpuFlag_C = (BYTE)(te>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB^255)^0x80) & (cpuReg_A^te) & 0x80)) ? 1:0;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A = (BYTE)te;\ - }\ - } - -#define ROL { BYTE cFlag; cFlag = cB>>7; cB = (cB<<1) + (cpuFlag_C&1); cpuFlag_C = cFlag; cpuFlag_N = cpuFlag_Z = cB; } -#define ROR { BYTE cFlag; cFlag = cB; cB = (cB>>1) + (cpuFlag_C<<7); cpuFlag_C = cFlag; cpuFlag_N = cpuFlag_Z = cB; } -#define LSR { cpuFlag_C = cB; cB>>=1; cpuFlag_N = cpuFlag_Z = cB; } -#define ASLORA { cpuFlag_C = cB>>7; cB<<=1; cpuReg_A |= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define ROLAND { BYTE cFlag; cFlag = cB>>7; cB = (cB<<1) + (cpuFlag_C&1); cpuFlag_C = cFlag; cpuReg_A &= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define LSREOR { cpuFlag_C = cB; cB>>=1; cpuReg_A ^= cB; cpuFlag_N = cpuFlag_Z = cpuReg_A; } -#define RORADC {\ - BYTE cC = cB; cB = (cB>>1) + (cpuFlag_C<<7); cpuFlag_C = cC;\ - if( cpuFlag_D&1 )\ - {\ - BYTE al,ah;\ - al = (cpuReg_A & 0x0f) + (cB & 0x0f) + (cpuFlag_C&1);\ - if (al > 9) al += 6;\ - ah = ((cpuReg_A >> 4)&0x0F) + ((cB >> 4)&0x0F); if (al > 0x0f) ah++;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A + cB + (cpuFlag_C&1);\ - cpuFlag_V = (((ah << 4) ^ cpuReg_A) & 0x80) && !((cpuReg_A ^ cB) & 0x80) ? 1:0;\ - if (ah > 9) ah += 6; cpuFlag_C = (ah > 0x0f) ? 1:0; cpuReg_A = (ah << 4) | (al & 0x0f);\ - }\ - else\ - {\ - WORD te;\ - te = cpuReg_A + cB + (cpuFlag_C&1);\ - cpuFlag_C = (BYTE)(te>>8);\ - cpuFlag_V = (( ((cpuReg_A^cB)^0x80) & (cpuReg_A^te) & 0x80)) ? 1:0;\ - cpuFlag_N = cpuFlag_Z = cpuReg_A = (BYTE)te;\ - }\ - } - -#define CondJump( a ) cpuReg_PC += (a) ? (WORD)(signed short int)(signed char)atariMem[cpuReg_PC+1]+2:2; - -//------- - -#define FREDDIEWRITEBYTE(ad,val)\ - {\ - if( (ad&0xFF00)==0xD200 )\ - {\ - if( isStereo==false )\ - pokeyWriteByte0( ad, val );\ - else if( (ad&0x10)==0 )\ - pokeyWriteByte0( ad, val );\ - else\ - pokeyWriteByte1( ad, val );\ - }\ - else if( ad==0xD40A )\ - holded = true;\ - else atariMem[ad] = val;\ - } - -#define Load_IMD(a) BYTE cB; { cB = atariMem[cpuReg_PC+1]; cpuReg_PC+=2; a; } -#define Load_ZP(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]; cB = atariMem[cA]; cpuReg_PC+=2; a; } -#define Load_ZPX(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_X; cB = atariMem[cA]; cpuReg_PC+=2; a; } -#define Load_ZPY(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_Y; cB = atariMem[cA]; cpuReg_PC+=2; a; } -#define Load_ABS(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0]; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; } -#define Load_ABSX(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_X; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; } -#define Load_ABSY(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_Y; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; } -#define Load_PreX(a) BYTE cB; { BYTE cA=(atariMem[cpuReg_PC+1]+cpuReg_X)&255; WORD cWA = ((WORD*)&atariMem[cA])[0]; cB = freddieReadByte(cWA); cpuReg_PC+=2; a; } -#define Load_PostY(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]; WORD cWA = ((WORD*)&atariMem[cA])[0] + (WORD)cpuReg_Y; cB = freddieReadByte(cWA); cpuReg_PC+=2; a; } - -#define LoadReg_IMD(a) { a = cpuFlag_N = cpuFlag_Z = atariMem[cpuReg_PC+1]; cpuReg_PC+=2; } -#define LoadReg_ZP(a) { BYTE cA=atariMem[cpuReg_PC+1]; a = cpuFlag_N = cpuFlag_Z = atariMem[cA]; cpuReg_PC+=2; } -#define LoadReg_ZPX(a) { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_X; a = cpuFlag_N = cpuFlag_Z = atariMem[cA]; cpuReg_PC+=2; } -#define LoadReg_ZPY(a) { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_Y; a = cpuFlag_N = cpuFlag_Z = atariMem[cA]; cpuReg_PC+=2; } -#define LoadReg_ABS(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0]; a = cpuFlag_N = cpuFlag_Z = freddieReadByte(cWA); cpuReg_PC+=3; } -#define LoadReg_ABSX(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_X; a = cpuFlag_N = cpuFlag_Z = freddieReadByte(cWA); cpuReg_PC+=3; } -#define LoadReg_ABSY(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_Y; a = cpuFlag_N = cpuFlag_Z = freddieReadByte(cWA); cpuReg_PC+=3; } -#define LoadReg_PreX(a) { BYTE cA=(atariMem[cpuReg_PC+1]+cpuReg_X)&255; WORD cWA = ((WORD*)&atariMem[cA])[0]; a = cpuFlag_N = cpuFlag_Z = freddieReadByte(cWA); cpuReg_PC+=2; } -#define LoadReg_PostY(a) { BYTE cA=atariMem[cpuReg_PC+1]; WORD cWA = ((WORD*)&atariMem[cA])[0] + (WORD)cpuReg_Y; a = cpuFlag_N = cpuFlag_Z = freddieReadByte(cWA); cpuReg_PC+=2; } - -#define Modify_ZP(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]; cB = atariMem[cA]; cpuReg_PC+=2; a; atariMem[cA] = cB; } -#define Modify_ZPX(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_X; cB = atariMem[cA]; cpuReg_PC+=2; a; atariMem[cA] = cB; } -#define Modify_ABS(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0]; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; FREDDIEWRITEBYTE(cWA,cB); } -#define Modify_ABSX(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_X; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; FREDDIEWRITEBYTE(cWA,cB); } -#define Modify_ABSY(a) BYTE cB; { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_Y; cB = freddieReadByte(cWA); cpuReg_PC+=3; a; FREDDIEWRITEBYTE(cWA,cB); } -#define Modify_PreX(a) BYTE cB; { BYTE cA=(atariMem[cpuReg_PC+1]+cpuReg_X)&255; WORD cWA = ((WORD*)&atariMem[cA])[0]; cB = freddieReadByte(cWA); cpuReg_PC+=2; a; FREDDIEWRITEBYTE(cWA,cB); } -#define Modify_PostY(a) BYTE cB; { BYTE cA=atariMem[cpuReg_PC+1]; WORD cWA = ((WORD*)&atariMem[cA])[0] + (WORD)cpuReg_Y; cB = freddieReadByte(cWA); cpuReg_PC+=2; a; FREDDIEWRITEBYTE(cWA,cB); } - -#define Store_ZP(a) { BYTE cA=atariMem[cpuReg_PC+1]; cpuReg_PC+=2; atariMem[cA] = a; } -#define Store_ZPX(a) { BYTE cA=atariMem[cpuReg_PC+1]+cpuReg_X; cpuReg_PC+=2; atariMem[cA] = a; } -#define Store_ABS(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0]; cpuReg_PC+=3; FREDDIEWRITEBYTE(cWA,a); } -#define Store_ABSX(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_X; cpuReg_PC+=3; FREDDIEWRITEBYTE(cWA,a); } -#define Store_ABSY(a) { WORD cWA = ((WORD*)&atariMem[cpuReg_PC+1])[0] + (WORD)cpuReg_Y; cpuReg_PC+=3; FREDDIEWRITEBYTE(cWA,a); } -#define Store_PreX(a) { BYTE cA=(atariMem[cpuReg_PC+1]+cpuReg_X)&255; WORD cWA = ((WORD*)&atariMem[cA])[0]; cpuReg_PC+=2; FREDDIEWRITEBYTE(cWA,a); } -#define Store_PostY(a) { BYTE cA=atariMem[cpuReg_PC+1]; WORD cWA = ((WORD*)&atariMem[cA])[0] + (WORD)cpuReg_Y; cpuReg_PC+=2; FREDDIEWRITEBYTE(cWA,a); } - -int opcode_0x00(bool &holded) /* 0x00 - BRK 7 cycles */ -{ - cpuReg_PC++; - return 20; -} -int opcode_0x01(bool &holded) /* 0x01 - ORA (,X) 6 cycles */ -{ - Load_PreX( ORA ); - return 6; -} -int opcode_0x02(bool &holded) /* 0x02 - ... hang */ -{ - return 20; -} -int opcode_0x03(bool &holded) /* 0x03 - ASL:ORA (,X) 8 cycles */ -{ - Modify_PreX( ASLORA ); - return 8; -} -int opcode_0x04(bool &holded) /* 0x04 - NOP2 3 cycles */ -{ - cpuReg_PC+=2; - return 3; -} -int opcode_0x05(bool &holded) /* 0x05 - ORA ZP 3 cycles */ -{ - Load_ZP( ORA ); - return 3; -} -int opcode_0x06(bool &holded) /* 0x06 - ASL ZP 5 cycles */ -{ - Modify_ZP( ASL ) - return 5; -} -int opcode_0x07(bool &holded) /* 0x07 - ASL:ORA ZP 5 cycles */ -{ - Modify_ZP( ASLORA ) - return 5; -} -int opcode_0x08(bool &holded) /* 0x08 - PHP 3 cycles */ -{ -BYTE te; - cpuReg_PC++; - te = (cpuFlag_N&0x80) | ((cpuFlag_V&1)<<6) | 0x20 | ((cpuFlag_B&1)<<4) | ((cpuFlag_D&1)<<3) | ((cpuFlag_I&1)<<2) | (cpuFlag_Z==0 ? 2:0) | (cpuFlag_C&1); - atariMem[0x100 + cpuReg_S] = te; cpuReg_S--; - return 3; -} -int opcode_0x09(bool &holded) /* 0x09 - ORA # 2 cycles */ -{ - Load_IMD( ORA ); - return 2; -} -int opcode_0x0A(bool &holded) /* 0x0A - ASL @ 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_C = cpuReg_A>>7; cpuReg_A<<=1; cpuFlag_N = cpuFlag_Z = cpuReg_A; - return 2; -} -int opcode_0x0B(bool &holded) /* 0x0B - ???? */ -{ - return 20; -} -int opcode_0x0C(bool &holded) /* 0x0C - NOP3 4 cycles */ -{ - cpuReg_PC+=3; - return 4; -} -int opcode_0x0D(bool &holded) /* 0x0D - ORA ABS 4 cycles */ -{ - Load_ABS( ORA ); - return 4; -} -int opcode_0x0E(bool &holded) /* 0x0E - ASL ABS 6 cycles */ -{ - Modify_ABS( ASL ); - return 6; -} -int opcode_0x0F(bool &holded) /* 0x0F - ASL:ORA ABS 6 cycles */ -{ - Modify_ABS( ASLORA ); - return 6; -} -int opcode_0x10(bool &holded) /* 0x10 - BPL 2-4 cycles */ -{ - CondJump( (cpuFlag_N&0x80)==0 ); - return 3; -} -int opcode_0x11(bool &holded) /* 0x11 - ORA (),Y 5,6 cycles */ -{ - Load_PostY( ORA ); - return 5; -} -int opcode_0x12(bool &holded) /* 0x12 - ... hang */ -{ - return 20; -} -int opcode_0x13(bool &holded) /* 0x13 - ASL:ORA (),Y 8 cycles */ -{ - Modify_PostY( ASLORA ); - return 8; -} -int opcode_0x14(bool &holded) /* 0x14 - NOP2 */ -{ - cpuReg_PC+=2; - return 3; -} -int opcode_0x15(bool &holded) /* 0x15 - ORA ZP,X 4 cycles */ -{ - Load_ZPX( ORA ); - return 4; -} -int opcode_0x16(bool &holded) /* 0x16 - ASL ZP,X 6 cycles */ -{ - Modify_ZPX( ASL ); - return 6; -} -int opcode_0x17(bool &holded) /* 0x17 - ASL:ORA ZP,X 6 cycles */ -{ - Modify_ZPX( ASLORA ); - return 6; -} -int opcode_0x18(bool &holded) /* 0x18 - CLC 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_C = 0; - return 2; -} -int opcode_0x19(bool &holded) /* 0x19 - ORA ABS,Y 4,5 cycles */ -{ - Load_ABSY( ORA ); - return 4; -} -int opcode_0x1A(bool &holded) /* 0x1A - NOP1 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0x1B(bool &holded) /* 0x1B - ASL:ORA ABS,Y 7 cycles */ -{ - Modify_ABSY( ASLORA ); - return 7; -} -int opcode_0x1C(bool &holded) /* 0x1C - NOP3 7 cycles */ -{ - cpuReg_PC+=3; - return 7; -} -int opcode_0x1D(bool &holded) /* 0x1D - ORA ABS,X 4,5 cycles */ -{ - Load_ABSX( ORA ); - return 4; -} -int opcode_0x1E(bool &holded) /* 0x1E - ASL ABS,X 7 cycles */ -{ - Modify_ABSX( ASL ); - return 7; -} -int opcode_0x1F(bool &holded) /* 0x1F - ASL:ORA ABS,X 7 cycles */ -{ - Modify_ABSX( ASLORA ); - return 7; -} -int opcode_0x20(bool &holded) /* 0x20 - JSR ABS 6 cycles */ -{ - cpuReg_PC+=2; - atariMem[0x100 + cpuReg_S] = (cpuReg_PC>>8)&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = cpuReg_PC&0xFF; cpuReg_S--; - cpuReg_PC = ((WORD*)&atariMem[cpuReg_PC-1])[0]; - return 6; -} -int opcode_0x21(bool &holded) /* 0x21 - AND (,X) 6 cycles */ -{ - Load_PreX( AND ); - return 6; -} -int opcode_0x22(bool &holded) /* 0x22 - ... hang */ -{ - return 20; -} -int opcode_0x23(bool &holded) /* 0x23 - ROL:AND (,X) 8 cycles */ -{ - Modify_PreX( ROLAND ); - return 8; -} -int opcode_0x24(bool &holded) /* 0x24 - BIT ZP 3 cycles */ -{ -BYTE cb; - cb = atariMem[cpuReg_PC+1]; - cpuFlag_Z = cb&cpuReg_A; cpuFlag_N = cb; cpuFlag_V = cb>>6; - cpuReg_PC+=2; - return 3; -} -int opcode_0x25(bool &holded) /* 0x25 - AND ZP 3 cycles */ -{ - Load_ZP( AND ); - return 3; -} -int opcode_0x26(bool &holded) /* 0x26 - ROL ZP 5 cycles */ -{ - Modify_ZP( ROL ); - return 5; -} -int opcode_0x27(bool &holded) /* 0x27 - ROL:AND ZP 5 cycles */ -{ - Modify_ZP( ROLAND ); - return 5; -} -int opcode_0x28(bool &holded) /* 0x28 - PLP 4 cycles */ -{ -BYTE te; - cpuReg_PC++; cpuReg_S++; te = atariMem[0x100 + cpuReg_S]; - cpuFlag_N = te; cpuFlag_V = (te>>6)&1; cpuFlag_B = (te>>4)&1; cpuFlag_D = (te>>3)&1; cpuFlag_I = (te>>2)&1; cpuFlag_Z = (te&2)^2; cpuFlag_C = te&1; - pokeyGenerateCheckIRQline(); - return 4; -} -int opcode_0x29(bool &holded) /* 0x29 - AND # 2 cycles */ -{ - Load_IMD( AND ); - return 2; -} -int opcode_0x2A(bool &holded) /* 0x2A - ROL @ 2 cycles */ -{ -BYTE cC; - cpuReg_PC++; - cC = cpuReg_A>>7; cpuReg_A = (cpuReg_A<<1) + (cpuFlag_C&1); cpuFlag_C = cC; cpuFlag_N = cpuFlag_Z = cpuReg_A; - return 2; -} -int opcode_0x2B(bool &holded) /* 0x2B - ???? */ -{ - return 20; -} -int opcode_0x2C(bool &holded) /* 0x2C - BIT ABS 4 cycles */ -{ -BYTE cb; - cb = atariMem[((WORD*)&atariMem[cpuReg_PC+1])[0]]; - cpuFlag_Z = cb&cpuReg_A; cpuFlag_N = cb; cpuFlag_V = cb>>6; - cpuReg_PC+=3; - return 4; -} -int opcode_0x2D(bool &holded) /* 0x2D - AND ABS 4 cycles */ -{ - Load_ABS( AND ); - return 4; -} -int opcode_0x2E(bool &holded) /* 0x2E - ROL ABS 6 cycles */ -{ - Modify_ABS( ROL ); - return 6; -} -int opcode_0x2F(bool &holded) /* 0x2F - ROL:AND ABS 6 cycles */ -{ - Modify_ABS( ROLAND ); - return 6; -} -int opcode_0x30(bool &holded) /* 0x30 - BMI 2-4 cycles */ -{ - CondJump( (cpuFlag_N&0x80) ); - return 2; -} -int opcode_0x31(bool &holded) /* 0x31 - AND (),Y 5,6 cycles */ -{ - Load_PostY( AND ); - return 5; -} -int opcode_0x32(bool &holded) /* 0x32 - ... hang */ -{ - return 20; -} -int opcode_0x33(bool &holded) /* 0x33 - ROL:AND (),Y 8 cycles */ -{ - Modify_PostY( ROLAND ); - return 8; -} -int opcode_0x34(bool &holded) /* 0x34 - NOP2 */ -{ - cpuReg_PC+=2; - return 8; -} -int opcode_0x35(bool &holded) /* 0x35 - AND ZP,X 4 cycles */ -{ - Load_ZPX( AND ); - return 4; -} -int opcode_0x36(bool &holded) /* 0x36 - ROL ZP,X 6 cycles */ -{ - Modify_ZPX( ROL ); - return 6; -} -int opcode_0x37(bool &holded) /* 0x37 - ROL:AND ZP,X 6 cycles */ -{ - Modify_ZPX( ROLAND ); - return 6; -} -int opcode_0x38(bool &holded) /* 0x38 - SEC 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_C = 1; - return 2; -} -int opcode_0x39(bool &holded) /* 0x39 - AND ABS,Y 4,5 cycles */ -{ - Load_ABSY( AND ); - return 4; -} -int opcode_0x3A(bool &holded) /* 0x3A - NOP1 */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0x3B(bool &holded) /* 0x3B - ROL:AND ABS,Y 7 cycles */ -{ - Modify_ABSY( ROLAND ); - return 7; -} -int opcode_0x3C(bool &holded) /* 0x3C - NOP3 */ -{ - cpuReg_PC+=3; - return 4; -} -int opcode_0x3D(bool &holded) /* 0x3D - AND ABS,X 4,5 cycles */ -{ - Load_ABSX( AND ); - return 4; -} -int opcode_0x3E(bool &holded) /* 0x3E - ROL ABS,X 7 cycles */ -{ - Modify_ABSX( ROL ); - return 7; -} -int opcode_0x3F(bool &holded) /* 0x3F - ROL:AND ABS,X 7 cycles */ -{ - Modify_ABSX( ROLAND ); - return 7; -} -int opcode_0x40(bool &holded) /* 0x40 - RTI 6 cycles */ -{ -BYTE te; - cpuReg_PC++; - cpuReg_S++; te = atariMem[0x100 + cpuReg_S]; - cpuFlag_N = te; cpuFlag_V = (te>>6)&1; cpuFlag_B = (te>>4)&1; cpuFlag_D = (te>>3)&1; cpuFlag_I = (te>>2)&1; cpuFlag_Z = (te&2)^2; cpuFlag_C = te&1; - cpuReg_S++; cpuReg_PC = (WORD)atariMem[0x100 + cpuReg_S]; - cpuReg_S++; cpuReg_PC+= ((WORD)atariMem[0x100 + cpuReg_S])*256; - return 6; -} -int opcode_0x41(bool &holded) /* 0x41 - EOR (,X) 6 cycles */ -{ - Load_PreX( EOR ); - return 6; -} -int opcode_0x42(bool &holded) /* 0x42 - ... hang */ -{ - return 20; -} -int opcode_0x43(bool &holded) /* 0x43 - LSR:EOR (,X) 8 cycles */ -{ - Modify_PreX( LSREOR ); - return 8; -} -int opcode_0x44(bool &holded) /* 0x44 - NOP2 3 cycles */ -{ - cpuReg_PC+=2; - return 3; -} -int opcode_0x45(bool &holded) /* 0x45 - EOR ZP 3 cycles */ -{ - Load_ZP( EOR ); - return 3; -} -int opcode_0x46(bool &holded) /* 0x46 - LSR ZP 5 cycles */ -{ - Modify_ZP( LSR ); - return 5; -} -int opcode_0x47(bool &holded) /* 0x47 - LSR:EOR ZP 5 cycles */ -{ - Modify_ZP( LSREOR ); - return 5; -} -int opcode_0x48(bool &holded) /* 0x48 - PHA 3 cycles */ -{ - cpuReg_PC++; - atariMem[0x100 + cpuReg_S] = cpuReg_A; cpuReg_S--; - return 3; -} -int opcode_0x49(bool &holded) /* 0x49 - EOR # 2 cycles */ -{ - Load_IMD( EOR ); - return 2; -} -int opcode_0x4A(bool &holded) /* 0x4A - LSR @ 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_C = cpuReg_A; cpuReg_A>>=1; cpuFlag_N = cpuFlag_Z = cpuReg_A; - return 2; -} -int opcode_0x4B(bool &holded) /* 0x4B - ???? */ -{ - cpuReg_PC--; - return 20; -} -int opcode_0x4C(bool &holded) /* 0x4C - JMP 3 cycles */ -{ - cpuReg_PC = ((WORD*)&atariMem[cpuReg_PC+1])[0]; - return 3; -} -int opcode_0x4D(bool &holded) /* 0x4D - EOR ABS 4 cycles */ -{ - Load_ABS( EOR ); - return 4; -} -int opcode_0x4E(bool &holded) /* 0x4E - LSR ABS 6 cycles */ -{ - Modify_ABS( LSR ); - return 6; -} -int opcode_0x4F(bool &holded) /* 0x4F - LSR:EOR ABS 6 cycles */ -{ - Modify_ABS( LSREOR ); - return 6; -} - -int opcode_0x50(bool &holded) /* 0x50 - BVC 2-4 cycles */ -{ - CondJump( (cpuFlag_V&1)==0 ); - return 2; -} - -int opcode_0x51(bool &holded) /* 0x51 - EOR (),Y 5 cycles */ -{ - Load_PostY( EOR ); - return 5; -} -int opcode_0x52(bool &holded) /* 0x52 - ... hang */ -{ - return 20; -} -int opcode_0x53(bool &holded) /* 0x53 - LSR:EOR (),Y 8 cycles */ -{ - Modify_PostY( LSREOR ); - return 8; -} -int opcode_0x54(bool &holded) /* 0x54 - NOP2 */ -{ - cpuReg_PC+=2; - return 3; -} -int opcode_0x55(bool &holded) /* 0x55 - EOR ZP,X 4 cycles */ -{ - Load_ZPX( EOR ); - return 4; -} -int opcode_0x56(bool &holded) /* 0x56 - LSR ZP,X 6 cycles */ -{ - Modify_ZPX( LSR ); - return 6; -} -int opcode_0x57(bool &holded) /* 0x57 - LSR:EOR ZP,X 6 cycles */ -{ - Modify_ZPX( LSREOR ); - return 6; -} -int opcode_0x58(bool &holded) /* 0x58 - CLI 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_I = 0; - pokeyGenerateCheckIRQline(); - return 2; -} -int opcode_0x59(bool &holded) /* 0x59 - EOR ABS,Y 4,5 cycles */ -{ - Load_ABSY( EOR ); - return 4; -} -int opcode_0x5A(bool &holded) /* 0x5A - NOP1 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0x5B(bool &holded) /* 0x5B - LSR:EOR ABS,Y 7 cycles */ -{ - Modify_ABSY( EOR ); - return 7; -} -int opcode_0x5C(bool &holded) /* 0x5C - NOP3 7 cycles */ -{ - cpuReg_PC+=3; - return 7; -} -int opcode_0x5D(bool &holded) /* 0x5D - EOR ABS,X 4,5 cycles */ -{ - Load_ABSX( EOR ); - return 4; -} -int opcode_0x5E(bool &holded) /* 0x5E - LSR ABS,X 7 cycles */ -{ - Modify_ABSX( EOR ); - return 7; -} -int opcode_0x5F(bool &holded) /* 0x5F - LSR:EOR ABS,X 7 cycles */ -{ - Modify_ABSX( LSREOR ); - return 7; -} - -int opcode_0x60(bool &holded) /* 0x60 - RTS 6 cycles */ -{ - cpuReg_S++; cpuReg_PC = (WORD)atariMem[0x100 + cpuReg_S]; - cpuReg_S++; cpuReg_PC+= ((WORD)atariMem[0x100 + cpuReg_S])*256 + 1; - return 6; -} -int opcode_0x61(bool &holded) /* 0x61 - ADC (,X) 6 cycles */ -{ - Load_PreX( ADC ); - return 6; -} -int opcode_0x62(bool &holded) /* 0x62 - ... hang */ -{ - return 20; -} -int opcode_0x63(bool &holded) /* 0x63 - ROR:ADC (,X) 8 cycles */ -{ - Modify_PreX( RORADC ); - return 8; -} -int opcode_0x64(bool &holded) /* 0x64 - NOP2 3 cycles */ -{ - cpuReg_PC+=2; - return 3; -} -int opcode_0x65(bool &holded) /* 0x65 - ADC ZP 3 cycles */ -{ - Load_ZP( ADC ); - return 3; -} -int opcode_0x66(bool &holded) /* 0x66 - ROR ZP 5 cycles */ -{ - Modify_ZP( ROR ); - return 5; -} -int opcode_0x67(bool &holded) /* 0x67 - ROR:ADC ZP 5 cycles */ -{ - Modify_ZP( RORADC ); - return 5; -} -int opcode_0x68(bool &holded) /* 0x68 - PLA 4 cycles */ -{ - cpuReg_PC++; - cpuReg_S++; cpuFlag_N = cpuFlag_Z = cpuReg_A = atariMem[0x100 + cpuReg_S]; - return 4; -} -int opcode_0x69(bool &holded) /* 0x69 - ADC # 2 cycles */ -{ - Load_IMD( ADC ); - return 2; -} -int opcode_0x6A(bool &holded) /* 0x6A - ROR @ 2 cycles */ -{ -BYTE cC; - cpuReg_PC++; - cC = cpuReg_A; cpuReg_A = (cpuReg_A>>1) + (cpuFlag_C<<7); cpuFlag_C = cC; cpuFlag_N = cpuFlag_Z = cpuReg_A; - return 2; -} -int opcode_0x6B(bool &holded) /* 0x6B - ???? */ -{ - return 20; -} -int opcode_0x6C(bool &holded) /* 0x6C - JMP ( ) 6 cycles */ -{ - WORD wA = ((WORD*)&atariMem[cpuReg_PC+1])[0]; - wA = ((WORD*)&atariMem[wA])[0]; - cpuReg_PC = wA; - return 6; -} -int opcode_0x6D(bool &holded) /* 0x6D - ADC ABS 4 cycles */ -{ - Load_ABS( ADC ); - return 4; -} -int opcode_0x6E(bool &holded) /* 0x6E - ROR ABS 6 cycles */ -{ - Modify_ABS( ROR ); - return 6; -} -int opcode_0x6F(bool &holded) /* 0x6F - ROR:ADC ABS 6 cycles */ -{ - Modify_ABS( RORADC ); - return 6; -} -int opcode_0x70(bool &holded) /* 0x70 - BVS 2-4 cycles */ -{ - CondJump( (cpuFlag_V&1) ); - return 2; -} -int opcode_0x71(bool &holded) /* 0x71 - ADC ( ),Y 5,6 cycles */ -{ - Load_PostY( ADC ); - return 5; -} -int opcode_0x72(bool &holded) /* 0x72 - ... hang */ -{ - return 20; -} -int opcode_0x73(bool &holded) /* 0x73 - ROR:ADC ( ),Y 8 cycles */ -{ - Modify_PostY( RORADC ); - return 8; -} -int opcode_0x74(bool &holded) /* 0x74 - NOP2 4 cycles */ -{ - return 4; -} -int opcode_0x75(bool &holded) /* 0x75 - ADC ZP,X 4 cycles */ -{ - Load_ZPX( ADC ); - return 4; -} -int opcode_0x76(bool &holded) /* 0x76 - ROR ZP,X 6 cycles */ -{ - Modify_ZPX( ROR ); - return 6; -} -int opcode_0x77(bool &holded) /* 0x77 - ROR:ADC ZP,X 6 cycles */ -{ - Modify_ZPX( RORADC ); - return 6; -} -int opcode_0x78(bool &holded) /* 0x78 - SEI 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_I = 1; - return 2; -} -int opcode_0x79(bool &holded) /* 0x79 - ADC ABS,Y 4,5 cycles */ -{ - Load_ABSY( ADC ); - return 4; -} -int opcode_0x7A(bool &holded) /* 0x7A - NOP1 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0x7B(bool &holded) /* 0x7B - ROR:ADC ABS,Y 6 cycles */ -{ - Modify_ABSY( RORADC ); - return 6; -} -int opcode_0x7C(bool &holded) /* 0x7C - NOP3 7 cycles */ -{ - cpuReg_PC+=3; - return 7; -} -int opcode_0x7D(bool &holded) /* 0x7D - ADC ABS,X 4,5 cycles */ -{ - Load_ABSX( ADC ); - return 4; -} -int opcode_0x7E(bool &holded) /* 0x7E - ROR ABS,X 7 cycles */ -{ - Modify_ABSX( ROR ); - return 7; -} -int opcode_0x7F(bool &holded) /* 0x7F - ROR:ADC ABS,X 7 cycles */ -{ - Modify_ABSX( RORADC ); - return 7; -} - -int opcode_0x80(bool &holded) /* 0x80 - NOP2 2 cycles */ -{ - cpuReg_PC+=2; - return 2; -} -int opcode_0x81(bool &holded) /* 0x81 - STA ( ,X) 6 cycles */ -{ - Store_PreX( cpuReg_A ); - return 6; -} -int opcode_0x82(bool &holded) /* 0x82 - NOP2 2 cycles */ -{ - cpuReg_PC+=2; - return 2; -} -int opcode_0x83(bool &holded) /* 0x83 - STORE(A&X) (,X) 6 cycles */ -{ - Store_PreX( (cpuReg_A&cpuReg_X) ); - return 6; -} -int opcode_0x84(bool &holded) /* 0x84 - STY ZP 3 cycles */ -{ - atariMem[atariMem[cpuReg_PC+1]] = cpuReg_Y; - cpuReg_PC+=2; - return 3; -} -int opcode_0x85(bool &holded) /* 0x85 - STA ZP 3 cycles */ -{ - atariMem[atariMem[cpuReg_PC+1]] = cpuReg_A; - cpuReg_PC+=2; - return 3; -} -int opcode_0x86(bool &holded) /* 0x86 - STX ZP 3 cycles */ -{ - atariMem[atariMem[cpuReg_PC+1]] = cpuReg_X; - cpuReg_PC+=2; - return 3; -} -int opcode_0x87(bool &holded) /* 0x87 - STORE(A&X) ZP 3 cycles */ -{ - atariMem[atariMem[cpuReg_PC+1]] = cpuReg_A&cpuReg_X; - cpuReg_PC+=2; - return 3; -} -int opcode_0x88(bool &holded) /* 0x88 - DEY 2 cycles */ -{ - cpuReg_PC++; - cpuReg_Y--; - cpuFlag_N = cpuFlag_Z = cpuReg_Y; - return 2; -} -int opcode_0x89(bool &holded) /* 0x89 - NOP2 2 cycles */ -{ - cpuReg_PC+=2; - return 2; -} -int opcode_0x8A(bool &holded) /* 0x8A - TXA 2 cycles */ -{ - cpuReg_PC+=1; - cpuFlag_N = cpuFlag_Z = cpuReg_A = cpuReg_X; - return 2; -} -int opcode_0x8B(bool &holded) /* 0x8B - TXA:AND # 2 cycles */ -{ - cpuReg_A = cpuReg_X; - cpuFlag_N = cpuFlag_Z = cpuReg_A = cpuReg_A & atariMem[cpuReg_PC+1]; - cpuReg_PC+=2; - return 2; -} -int opcode_0x8C(bool &holded) /* 0x8C - STY ABS 4 cycles */ -{ - Store_ABS( cpuReg_Y ); - return 4; -} -int opcode_0x8D(bool &holded) /* 0x8D - STA ABS 4 cycles */ -{ - Store_ABS( cpuReg_A ); - return 4; -} -int opcode_0x8E(bool &holded) /* 0x8E - STX ABS 4 cycles */ -{ - Store_ABS( cpuReg_X ); - return 4; -} -int opcode_0x8F(bool &holded) /* 0x8F - STORE(A&X) ABS 4 cycles */ -{ - Store_ABS( (cpuReg_A&cpuReg_X) ); - return 4; -} -int opcode_0x90(bool &holded) /* 0x90 - BCC 2-4 cycles */ -{ - CondJump( (cpuFlag_C&1)==0 ); - return 2; -} -int opcode_0x91(bool &holded) /* 0x91 - STA ( ),Y 6 cycles */ -{ - Store_PostY( cpuReg_A ); - return 6; -} -int opcode_0x92(bool &holded) /* 0x92 - ... hang */ -{ - return 20; -} -int opcode_0x93(bool &holded) /* 0x93 - STORE(A&X) (),Y 4,5 cycles */ -{ - Store_PostY( (cpuReg_A&cpuReg_X) ); - return 6; -} -int opcode_0x94(bool &holded) /* 0x94 - STY ZP,X 4 cycles */ -{ - atariMem[(atariMem[cpuReg_PC+1]+cpuReg_X)&0xFF] = cpuReg_Y; - cpuReg_PC+=2; - return 4; -} -int opcode_0x95(bool &holded) /* 0x95 - STA ZP,X 4 cycles */ -{ - atariMem[(atariMem[cpuReg_PC+1]+cpuReg_X)&0xFF] = cpuReg_A; - cpuReg_PC+=2; - return 4; -} -int opcode_0x96(bool &holded) /* 0x96 - STX ZP,Y 4 cycles */ -{ - atariMem[(atariMem[cpuReg_PC+1]+cpuReg_Y)&0xFF] = cpuReg_X; - cpuReg_PC+=2; - return 4; -} -int opcode_0x97(bool &holded) /* 0x97 - STORE(A&X) ZP,Y 4 cycles */ -{ - atariMem[(atariMem[cpuReg_PC+1]+cpuReg_Y)&0xFF] = cpuReg_X&cpuReg_A; - cpuReg_PC+=2; - return 4; -} -int opcode_0x98(bool &holded) /* 0x98 - TYA 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_A = cpuReg_Y; - return 2; -} -int opcode_0x99(bool &holded) /* 0x99 - STA ABS,Y 5 cycles */ -{ - Store_ABSY( cpuReg_A ); - return 5; -} -int opcode_0x9A(bool &holded) /* 0x9A - TXS 2 cycles */ -{ - cpuReg_PC++; - cpuReg_S = cpuReg_X; - return 2; -} -int opcode_0x9B(bool &holded) /* 0x9B - ???? */ -{ - return 20; -} -int opcode_0x9C(bool &holded) /* 0x9C - ???? */ -{ - return 20; -} -int opcode_0x9D(bool &holded) /* 0x9D - STA ABS,X 5 cycles */ -{ - Store_ABSX( cpuReg_A ); - return 5; -} -int opcode_0x9E(bool &holded) /* 0x9E - ???? */ -{ - return 20; -} -int opcode_0x9F(bool &holded) /* 0x9F - ???? */ -{ - return 20; -} -int opcode_0xA0(bool &holded) /* 0xA0 - LDY # 2 cycles */ -{ - LoadReg_IMD( cpuReg_Y ); - return 2; -} -int opcode_0xA1(bool &holded) /* 0xA1 - LDA (,X) 6 cycles */ -{ - LoadReg_PreX( cpuReg_A ); - return 6; -} -int opcode_0xA2(bool &holded) /* 0xA2 - LDX # 2 cycles */ -{ - LoadReg_IMD( cpuReg_X ); - return 2; -} -int opcode_0xA3(bool &holded) /* 0xA3 - LDA:TAX (,X) 6 cycles */ -{ - LoadReg_IMD( cpuReg_A ); - cpuReg_X = cpuReg_A; - return 6; -} -int opcode_0xA4(bool &holded) /* 0xA4 - LDY ZP 3 cycles */ -{ - LoadReg_ZP( cpuReg_Y ); - return 3; -} -int opcode_0xA5(bool &holded) /* 0xA5 - LDA ZP 3 cycles */ -{ - LoadReg_ZP( cpuReg_A ); - return 3; -} -int opcode_0xA6(bool &holded) /* 0xA6 - LDX ZP 3 cycles */ -{ - LoadReg_ZP( cpuReg_X ); - return 3; -} -int opcode_0xA7(bool &holded) /* 0xA7 - LDA:TAX ZP 3 cycles */ -{ - LoadReg_ZP( cpuReg_A ); - cpuReg_X = cpuReg_A; - return 3; -} -int opcode_0xA8(bool &holded) /* 0xA8 - TAY 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_Y = cpuReg_A; - return 2; -} -int opcode_0xA9(bool &holded) /* 0xA9 - LDA # 2 cycles */ -{ - LoadReg_IMD( cpuReg_A ); - return 2; -} -int opcode_0xAA(bool &holded) /* 0xAA - TAX 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_X = cpuReg_A; - return 2; -} -int opcode_0xAB(bool &holded) /* 0xAB - AND #:TAX 2 cycles */ -{ - cpuFlag_N = cpuFlag_Z = cpuReg_A = cpuReg_X = cpuReg_A & atariMem[cpuReg_PC+1]; - cpuReg_PC+=2; - return 2; -} -int opcode_0xAC(bool &holded) /* 0xAC - LDY ABS 4 cycles */ -{ - LoadReg_ABS( cpuReg_Y ); - return 4; -} -int opcode_0xAD(bool &holded) /* 0xAD - LDA ABS 4 cycles */ -{ - LoadReg_ABS( cpuReg_A ); - return 4; -} -int opcode_0xAE(bool &holded) /* 0xAE - LDX ABS 4 cycles */ -{ - LoadReg_ABS( cpuReg_X ); - return 4; -} -int opcode_0xAF(bool &holded) /* 0xAF - LDA:TAX ABS 4 cycles */ -{ - LoadReg_ABS( cpuReg_A ); - cpuReg_X = cpuReg_A; - return 4; -} -int opcode_0xB0(bool &holded) /* 0xB0 - BCS 2-4 cycles */ -{ - CondJump( (cpuFlag_C&1) ); - return 2; -} -int opcode_0xB1(bool &holded) /* 0xB1 - LDA ( ),Y 5,6 cycles */ -{ - LoadReg_PostY( cpuReg_A ); - return 5; -} -int opcode_0xB2(bool &holded) /* 0xB2 - ... hang */ -{ - return 20; -} -int opcode_0xB3(bool &holded) /* 0xB3 - LDA:TAX ( ),Y 5,6 cycles */ -{ - LoadReg_PostY( cpuReg_A ); - cpuReg_X = cpuReg_A; - return 5; -} -int opcode_0xB4(bool &holded) /* 0xB4 - LDY ZP,X 4 cycles */ -{ - LoadReg_ZPX( cpuReg_Y ); - return 4; -} -int opcode_0xB5(bool &holded) /* 0xB5 - LDA ZP,X 4 cycles */ -{ - LoadReg_ZPX( cpuReg_A ); - return 4; -} -int opcode_0xB6(bool &holded) /* 0xB6 - LDX ZP,Y 4 cycles */ -{ - LoadReg_ZPY( cpuReg_X ); - return 4; -} -int opcode_0xB7(bool &holded) /* 0xB7 - LDA:TAX ZP,Y 4 cycles */ -{ - LoadReg_ZPY( cpuReg_X ); - cpuReg_A = cpuReg_X; - return 4; -} -int opcode_0xB8(bool &holded) /* 0xB8 - CLV 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_V = 0; - return 2; -} -int opcode_0xB9(bool &holded) /* 0xB9 - LDA ABS,Y 4,5 cycles */ -{ - LoadReg_ABSY( cpuReg_A ); - return 4; -} -int opcode_0xBA(bool &holded) /* 0xBA - TSX 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_X = cpuReg_S; - return 2; -} -int opcode_0xBB(bool &holded) /* 0xBB - ???? */ -{ - return 20; -} -int opcode_0xBC(bool &holded) /* 0xBC - LDY ABS,X 4,5 cycles */ -{ - LoadReg_ABSX( cpuReg_Y ); - return 4; -} -int opcode_0xBD(bool &holded) /* 0xBD - LDA ABS,X 4,5 cycles */ -{ - LoadReg_ABSX( cpuReg_A ); - return 4; -} -int opcode_0xBE(bool &holded) /* 0xBE - LDX ABS,Y 4,5 cycles */ -{ - LoadReg_ABSY( cpuReg_X ); - return 4; -} -int opcode_0xBF(bool &holded) /* 0xBF - LDA:TAX ABS,Y 4,5 cycles */ -{ - LoadReg_ABSY( cpuReg_X ); - cpuReg_A = cpuReg_X; - return 4; -} -int opcode_0xC0(bool &holded) /* 0xC0 - CPY # 2 cycles */ -{ - Load_IMD( CPY ); - return 2; -} -int opcode_0xC1(bool &holded) /* 0xC1 - CMP (,X) 6 cycles */ -{ - Load_PreX( CMP ); - return 6; -} -int opcode_0xC2(bool &holded) /* 0xC2 - NOP2 2 cycles */ -{ - cpuReg_PC+=2; - return 2; -} -int opcode_0xC3(bool &holded) /* 0xC3 - DEC:CMP (,X) 8 cycles */ -{ - Modify_PreX( DECCMP ); - return 8; -} -int opcode_0xC4(bool &holded) /* 0xC4 - CPY ZP 3 cycles */ -{ - Load_ZP( CPY ); - return 3; -} -int opcode_0xC5(bool &holded) /* 0xC5 - CMP ZP 3 cycles */ -{ - Load_ZP( CMP ); - return 3; -} -int opcode_0xC6(bool &holded) /* 0xC6 - DEC ZP 5 cycles */ -{ - Modify_ZP( DEC ); - return 5; -} -int opcode_0xC7(bool &holded) /* 0xC7 - DEC:CMP ZP 5 cycles */ -{ - Modify_ZP( DECCMP ); - return 8; -} -int opcode_0xC8(bool &holded) /* 0xC8 - INY 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_Y = cpuReg_Y+1; - return 2; -} -int opcode_0xC9(bool &holded) /* 0xC9 - CMP # 2 cycles */ -{ - Load_IMD( CMP ); - return 2; -} -int opcode_0xCA(bool &holded) /* 0xCA - DEX 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_X = cpuReg_X-1; - return 2; -} -int opcode_0xCB(bool &holded) /* 0xCB - ???? */ -{ - return 20; -} -int opcode_0xCC(bool &holded) /* 0xCC - CPY ABS 4 cycles */ -{ - Load_ABS( CPY ); - return 4; -} -int opcode_0xCD(bool &holded) /* 0xCD - CMP ABS 4 cycles */ -{ - Load_ABS( CMP ); - return 4; -} -int opcode_0xCE(bool &holded) /* 0xCE - DEC ABS 6 cycles */ -{ - Modify_ABS( DEC ); - return 6; -} -int opcode_0xCF(bool &holded) /* 0xCF - DEC:CMP ABS 6 cycles */ -{ - Modify_ABS( DECCMP ); - return 6; -} -int opcode_0xD0(bool &holded) /* 0xD0 - BNE 2-4 cycles */ -{ - CondJump( cpuFlag_Z ); - return 2; -} -int opcode_0xD1(bool &holded) /* 0xD1 - CMP (),Y 5,6 cycles */ -{ - Load_PostY( CMP ); - return 5; -} -int opcode_0xD2(bool &holded) /* 0xD2 - ... hang */ -{ - return 20; -} -int opcode_0xD3(bool &holded) /* 0xD3 - DEC:CMP (),Y 8 cycles */ -{ - Modify_PostY( DECCMP ); - return 8; -} -int opcode_0xD4(bool &holded) /* 0xD4 - NOP2 4 cycles */ -{ - cpuReg_PC+=2; - return 4; -} -int opcode_0xD5(bool &holded) /* 0xD5 - CMP ZP,X 4 cycles */ -{ - Load_ZPX( CMP ); - return 4; -} -int opcode_0xD6(bool &holded) /* 0xD6 - DEC ZP,X 6 cycles */ -{ - Modify_ZPX( DEC ); - return 6; -} -int opcode_0xD7(bool &holded) /* 0xD7 - DEC:CMP ZP,X 6 cycles */ -{ - Modify_ZPX( DECCMP ); - return 6; -} -int opcode_0xD8(bool &holded) /* 0xD8 - CLD 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_D = 0; - return 2; -} -int opcode_0xD9(bool &holded) /* 0xD9 - CMP ABS,Y 4,5 cycles */ -{ - Load_ABSY( CMP ); - return 4; -} -int opcode_0xDA(bool &holded) /* 0xDA - NOP1 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0xDB(bool &holded) /* 0xDB - DEC:CMP ABS,Y 7 cycles */ -{ - Modify_ABSY( DECCMP ); - return 7; -} -int opcode_0xDC(bool &holded) /* 0xDC - NOP3 4 cycles */ -{ - cpuReg_PC+=3; - return 4; -} -int opcode_0xDD(bool &holded) /* 0xDD - CMP ABS,X 4,5 cycles */ -{ - Load_ABSX( CMP ); - return 4; -} -int opcode_0xDE(bool &holded) /* 0xDE - DEC ABS,X 7 cycles */ -{ - Modify_ABSX( DEC ); - return 7; -} -int opcode_0xDF(bool &holded) /* 0xDF - DEC:CMP ABS,X 7 cycles */ -{ - Modify_ABSX( DECCMP ); - return 7; -} -int opcode_0xE0(bool &holded) /* 0xE0 - CPX # 2 cycles */ -{ - Load_IMD( CPX ); - return 2; -} -int opcode_0xE1(bool &holded) /* 0xE1 - SBC (,X) 6 cycles */ -{ - Load_PreX( SBC ); - return 6; -} -int opcode_0xE2(bool &holded) /* 0xE2 - NOP2 2 cycles */ -{ - cpuReg_PC+=2; - return 2; -} -int opcode_0xE3(bool &holded) /* 0xE3 - INC:SBC (,X) 8 cycles */ -{ - Modify_PreX( INCSBC ); - return 8; -} -int opcode_0xE4(bool &holded) /* 0xE4 - CPX ZP 3 cycles */ -{ - Load_ZP( CPX ); - return 3; -} -int opcode_0xE5(bool &holded) /* 0xE5 - SBC ZP 3 cycles */ -{ - Load_ZP( SBC ); - return 3; -} -int opcode_0xE6(bool &holded) /* 0xE6 - INC ZP 5 cycles */ -{ - Modify_ZP( INC ); - return 5; -} -int opcode_0xE7(bool &holded) /* 0xE7 - INC:SBC ZP 5 cycles */ -{ - Modify_ZP( INCSBC ); - return 5; -} -int opcode_0xE8(bool &holded) /* 0xE8 - INX 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_N = cpuFlag_Z = cpuReg_X = cpuReg_X+1; - return 2; -} -int opcode_0xE9(bool &holded) /* 0xE9 - SBC # 2 cycles */ -{ - Load_IMD( SBC ); - return 2; -} -int opcode_0xEA(bool &holded) /* 0xEA - NOP 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0xEB(bool &holded) /* 0xEB - ???? */ -{ - return 20; -} -int opcode_0xEC(bool &holded) /* 0xEC - CPX ABS 4 cycles */ -{ - Load_ABS( CPX ); - return 4; -} -int opcode_0xED(bool &holded) /* 0xED - SBC ABS 4 cycles */ -{ - Load_ABS( SBC ); - return 4; -} -int opcode_0xEE(bool &holded) /* 0xEE - INC ABS 6 cycles */ -{ - Modify_ABS( INC ); - return 6; -} -int opcode_0xEF(bool &holded) /* 0xEF - INC:SBC ABS 6 cycles */ -{ - Modify_ABS( INCSBC ); - return 6; -} -int opcode_0xF0(bool &holded) /* 0xF0 - BEQ 2-4 cycles */ -{ - CondJump( (cpuFlag_Z==0) ); - return 2; -} -int opcode_0xF1(bool &holded) /* 0xF1 - SBC (),Y 5,6 cycles */ -{ - Load_PostY( SBC ); - return 5; -} -int opcode_0xF2(bool &holded) /* 0xF2 - ... hang */ -{ - return 20; -} -int opcode_0xF3(bool &holded) /* 0xF3 - INC:SBC (),Y 8 cycles */ -{ - Modify_PostY( INCSBC ); - return 8; -} -int opcode_0xF4(bool &holded) /* 0xF4 - NOP2 4 cycles */ -{ - cpuReg_PC+=2; - return 4; -} -int opcode_0xF5(bool &holded) /* 0xF5 - SBC ZP,X 4 cycles */ -{ - Load_ZPX( SBC ); - return 4; -} -int opcode_0xF6(bool &holded) /* 0xF6 - INC ZP,X 6 cycles */ -{ - Modify_ZPX( INC ); - return 6; -} -int opcode_0xF7(bool &holded) /* 0xF7 - INC:SBC ZP,X 6 cycles */ -{ - Modify_ZPX( INCSBC ); - return 6; -} -int opcode_0xF8(bool &holded) /* 0xF8 - SED 2 cycles */ -{ - cpuReg_PC++; - cpuFlag_D = 1; - return 2; -} -int opcode_0xF9(bool &holded) /* 0xF9 - SBC ABS,Y 4,5 cycles */ -{ - Load_ABSY( SBC ); - return 4; -} -int opcode_0xFA(bool &holded) /* 0xFA - NOP1 2 cycles */ -{ - cpuReg_PC++; - return 2; -} -int opcode_0xFB(bool &holded) /* 0xFB - INC:SBC ABS,Y 7 cycles */ -{ - Modify_ABSY( INCSBC ); - return 7; -} -int opcode_0xFC(bool &holded) /* 0xDC - NOP3 4 cycles */ -{ - cpuReg_PC+=3; - return 4; -} -int opcode_0xFD(bool &holded) /* 0xFD - SBC ABS,X 4,5 cycles */ -{ - Load_ABSX( SBC ); - return 4; -} -int opcode_0xFE(bool &holded) /* 0xFE - INC ABS,X 7 cycles */ -{ - Modify_ABSX( INC ); - return 7; -} -int opcode_0xFF(bool &holded) /* 0xDF - INC:SBC ABS,X 7 cycles */ -{ - Modify_ABSX( INCSBC ); - return 7; -} - -opcodeFunc opcodes_0x00_0xFF[256]={ - &opcode_0x00, &opcode_0x01, &opcode_0x02, &opcode_0x03, &opcode_0x04, &opcode_0x05, &opcode_0x06, &opcode_0x07, - &opcode_0x08, &opcode_0x09, &opcode_0x0A, &opcode_0x0B, &opcode_0x0C, &opcode_0x0D, &opcode_0x0E, &opcode_0x0F, - &opcode_0x10, &opcode_0x11, &opcode_0x12, &opcode_0x13, &opcode_0x14, &opcode_0x15, &opcode_0x16, &opcode_0x17, - &opcode_0x18, &opcode_0x19, &opcode_0x1A, &opcode_0x1B, &opcode_0x1C, &opcode_0x1D, &opcode_0x1E, &opcode_0x1F, - &opcode_0x20, &opcode_0x21, &opcode_0x22, &opcode_0x23, &opcode_0x24, &opcode_0x25, &opcode_0x26, &opcode_0x27, - &opcode_0x28, &opcode_0x29, &opcode_0x2A, &opcode_0x2B, &opcode_0x2C, &opcode_0x2D, &opcode_0x2E, &opcode_0x2F, - &opcode_0x30, &opcode_0x31, &opcode_0x32, &opcode_0x33, &opcode_0x34, &opcode_0x35, &opcode_0x36, &opcode_0x37, - &opcode_0x38, &opcode_0x39, &opcode_0x3A, &opcode_0x2B, &opcode_0x3C, &opcode_0x3D, &opcode_0x3E, &opcode_0x3F, - &opcode_0x40, &opcode_0x41, &opcode_0x42, &opcode_0x43, &opcode_0x44, &opcode_0x45, &opcode_0x46, &opcode_0x47, - &opcode_0x48, &opcode_0x49, &opcode_0x4A, &opcode_0x4B, &opcode_0x4C, &opcode_0x4D, &opcode_0x4E, &opcode_0x4F, - &opcode_0x50, &opcode_0x51, &opcode_0x52, &opcode_0x53, &opcode_0x54, &opcode_0x55, &opcode_0x56, &opcode_0x57, - &opcode_0x58, &opcode_0x59, &opcode_0x5A, &opcode_0x5B, &opcode_0x5C, &opcode_0x5D, &opcode_0x5E, &opcode_0x5F, - &opcode_0x60, &opcode_0x61, &opcode_0x62, &opcode_0x63, &opcode_0x64, &opcode_0x65, &opcode_0x66, &opcode_0x67, - &opcode_0x68, &opcode_0x69, &opcode_0x6A, &opcode_0x6B, &opcode_0x6C, &opcode_0x6D, &opcode_0x6E, &opcode_0x6F, - &opcode_0x70, &opcode_0x71, &opcode_0x72, &opcode_0x73, &opcode_0x74, &opcode_0x75, &opcode_0x76, &opcode_0x77, - &opcode_0x78, &opcode_0x79, &opcode_0x7A, &opcode_0x7B, &opcode_0x7C, &opcode_0x7D, &opcode_0x7E, &opcode_0x7F, - &opcode_0x80, &opcode_0x81, &opcode_0x82, &opcode_0x83, &opcode_0x84, &opcode_0x85, &opcode_0x86, &opcode_0x87, - &opcode_0x88, &opcode_0x89, &opcode_0x8A, &opcode_0x8B, &opcode_0x8C, &opcode_0x8D, &opcode_0x8E, &opcode_0x8F, - &opcode_0x90, &opcode_0x91, &opcode_0x92, &opcode_0x93, &opcode_0x94, &opcode_0x95, &opcode_0x96, &opcode_0x97, - &opcode_0x98, &opcode_0x99, &opcode_0x9A, &opcode_0x9B, &opcode_0x9C, &opcode_0x9D, &opcode_0x9E, &opcode_0x9F, - &opcode_0xA0, &opcode_0xA1, &opcode_0xA2, &opcode_0xA3, &opcode_0xA4, &opcode_0xA5, &opcode_0xA6, &opcode_0xA7, - &opcode_0xA8, &opcode_0xA9, &opcode_0xAA, &opcode_0xAB, &opcode_0xAC, &opcode_0xAD, &opcode_0xAE, &opcode_0xAF, - &opcode_0xB0, &opcode_0xB1, &opcode_0xB2, &opcode_0xB3, &opcode_0xB4, &opcode_0xB5, &opcode_0xB6, &opcode_0xB7, - &opcode_0xB8, &opcode_0xB9, &opcode_0xBA, &opcode_0xBB, &opcode_0xBC, &opcode_0xBD, &opcode_0xBE, &opcode_0xBF, - &opcode_0xC0, &opcode_0xC1, &opcode_0xC2, &opcode_0xC3, &opcode_0xC4, &opcode_0xC5, &opcode_0xC6, &opcode_0xC7, - &opcode_0xC8, &opcode_0xC9, &opcode_0xCA, &opcode_0xCB, &opcode_0xCC, &opcode_0xCD, &opcode_0xCE, &opcode_0xCF, - &opcode_0xD0, &opcode_0xD1, &opcode_0xD2, &opcode_0xD3, &opcode_0xD4, &opcode_0xD5, &opcode_0xD6, &opcode_0xD7, - &opcode_0xD8, &opcode_0xD9, &opcode_0xDA, &opcode_0xDB, &opcode_0xDC, &opcode_0xDD, &opcode_0xDE, &opcode_0xDF, - &opcode_0xE0, &opcode_0xE1, &opcode_0xE2, &opcode_0xE3, &opcode_0xE4, &opcode_0xE5, &opcode_0xE6, &opcode_0xE7, - &opcode_0xE8, &opcode_0xE9, &opcode_0xEA, &opcode_0xEB, &opcode_0xEC, &opcode_0xED, &opcode_0xEE, &opcode_0xEF, - &opcode_0xF0, &opcode_0xF1, &opcode_0xF2, &opcode_0xF3, &opcode_0xF4, &opcode_0xF5, &opcode_0xF6, &opcode_0xF7, - &opcode_0xF8, &opcode_0xF9, &opcode_0xFA, &opcode_0xFB, &opcode_0xFC, &opcode_0xFD, &opcode_0xFE, &opcode_0xFF, -}; -
--- a/src/sap/saplib/sapEngine.cxx Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,657 +0,0 @@ -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define __MAIN_DECLARATIONS__ - -#include "sapGlobals.h" - -#include "sapLib.h" - -namespace _SAP_internals_ { - -void playerCallSubroutine( WORD address ); -void playerProcessOneFrame( void ); - -volatile int prSbp; -volatile int musicAddress,playerAddress,playerInit,playerType,defSong,fastPlay; -volatile BOOL fileLoadStatus=FALSE; - -char inputBuffer[65536]; -char commentBuffer[65536]; - -sapMUSICstrc currentMusic; - -BYTE emulEmptyLine[]={ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -} - -using namespace _SAP_internals_; - -sapMUSICstrc *sapLoadMusicFile( char *fname ) -{ -BOOL formatKnown,binaryFile; int i; -int numOfSongs; - - fileLoadStatus = FALSE; - if( fname==NULL ) - return NULL; - - cpuInit( ); - pokeyInit( ); - pokeyReset( ); - prSbp = 0; - sndBufPtr = 0; - memset( sndBuf, 0, sizeof(sndBuf) ); - commentBuffer[0] = 0; - memset( atariMem, 0, sizeof(atariMem) ); - atariMem[0x0000] = 0xFF; // CMC bug. - atariMem[0xFEFF] = 0xFF; // CMC bug. -// atariMem[0xFFFE] = 0xFF; // CMC bug. -// atariMem[0xFFFF] = 0xFF; // CMC bug. - - isStereo = false; - sampleStep = 1; - formatKnown = FALSE; binaryFile = FALSE; - musicAddress = playerAddress = playerType = numOfSongs = defSong = fastPlay = -1; - FILE *inpf; - inpf = fopen( fname, "rb" ); - if( inpf!=NULL ) - { - BYTE blkHead[4]; WORD blkBegin = 0,blkEnd = 0; int blk; - - blk = 0; i = 0; - while( 1 ) - { - int val; val = fgetc( inpf ); - if( formatKnown==FALSE ) - { - if( (val==EOF) || (i>=4) ) - { - // error - break; - } - if( (val==0x0A) || (val==0x0D) ) - { - inputBuffer[i] = 0; - if( strcmp( inputBuffer, "SAP" )!=0 ) - { - // error - break; - } - // headerID is OK - i = 0; - formatKnown = TRUE; - continue;; - } - inputBuffer[i++] = (char)val; - } - else if( binaryFile==FALSE ) - { - if( val==EOF ) - { - // error - break; - } - if( val==0xFF ) - { - if( i!=0 ) - { - // error. There wasn't EOL in this line - break; - } - // so this is the end of header - binaryFile = TRUE; - blkHead[blk++] = (BYTE)val; - continue; - } - if( (val==0x0A) || (val==0x0D) ) - { - if( i==0 ) - continue; - inputBuffer[i++] = 0; - char *codes[]={ "PLAYER", "MUSIC", "INIT", "TYPE", "SONGS", "DEFSONG", "FASTPLAY", "STEREO", "TIME", NULL }; - int j,k,a; - for( j=0;; j++ ) - { - if( codes[j]==NULL ) - break; - k = 0; - while( 1 ) - { - if( k>=i ) - { - // not this code - i = 0; - break; - } - if( (codes[j][k]==0) && ((inputBuffer[k]==' ') || (inputBuffer[k]==0)) ) - { - // found - switch( j ) - { - case 0: // player address - a = strtol( &inputBuffer[k], NULL, 16 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - playerAddress = a; - i = 0; - goto cont; - break; - case 1: // music address - a = strtol( &inputBuffer[k], NULL, 16 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - musicAddress = a; - i = 0; - goto cont; - break; - case 2: // binary player init - a = strtol( &inputBuffer[k], NULL, 16 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - playerInit = a; - i = 0; - goto cont; - break; - case 3: // player type - while( inputBuffer[k]!=0 ) - { - if( (inputBuffer[k]=='B') || (inputBuffer[k]=='b') ) - { - playerType = 'b'; - break; - } - if( (inputBuffer[k]=='C') || (inputBuffer[k]=='c') ) - { - playerType = 'c'; - break; - } - if( (inputBuffer[k]=='D') || (inputBuffer[k]=='d') ) - { - playerType = 'd'; - break; - } - if( (inputBuffer[k]=='S') || (inputBuffer[k]=='s') ) - { - playerType = 's'; - break; - } - if( !isspace(inputBuffer[k]) ) - { - i = 0; - goto cont; - } - k++; - } - i = 0; - goto cont; - break; - case 4: // num of songs - a = strtol( &inputBuffer[k], NULL, 10 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - numOfSongs = a; - sprintf( &commentBuffer[ strlen(commentBuffer) ], "Number of songs = %d\n", numOfSongs ); - i = 0; - goto cont; - break; - case 5: // default songs - a = strtol( &inputBuffer[k], NULL, 10 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - defSong = a; - i = 0; - goto cont; - break; - case 6: // fastPlay - a = strtol( &inputBuffer[k], NULL, 10 ); - if( (a==0) || (a>0xFFFF) ) - { - // error - i = 0; - goto cont; - } - fastPlay = a; - i = 0; - goto cont; - break; - case 7: // Stereo - isStereo = true; - sampleStep = 2; - sprintf( &commentBuffer[ strlen(commentBuffer) ], "In Stereo!\n" ); - i = 0; - goto cont; - break; - case 8: // Time - { - int min,sec; - min = sec = -1; - sscanf( &inputBuffer[k], "%d:%d", &min, &sec ); - if( min==-1 || sec==-1 ) - { - i = 0; - goto cont; - } - sprintf( &commentBuffer[ strlen(commentBuffer) ], "Time in sec %d\n", min*60+sec ); - i = 0; - goto cont; - break; - } - } - i = 0; - goto cont; - } - if( codes[j][k]==0 ) - break; // not this code - if( codes[j][k]!=inputBuffer[k] ) - break; // not this code - k++; - } - } - sprintf( &commentBuffer[ strlen(commentBuffer) ], "%s\n", inputBuffer ); - // not found - i = 0; - continue; - } - inputBuffer[i++] = (char)val; - } - else if( binaryFile==TRUE ) - { - if( val==EOF ) - { - if( blk==0 ) - { - fileLoadStatus = TRUE; - break; // OK - } - // error - break; - } - if( blk<4 ) - { - blkHead[blk++] = (BYTE)val; - if( blk==2 ) - { - if( (blkHead[0]&blkHead[1])==255 ) - blk = 0; - } - if( blk==4 ) - { - blkBegin = ((WORD)blkHead[0]) + ((WORD)blkHead[1])*256; - blkEnd = ((WORD)blkHead[2]) + ((WORD)blkHead[3])*256; - } - } - else - { - atariMem[blkBegin] = (BYTE)val; - if( blkBegin==blkEnd ) - { - blk = 0; - } - blkBegin++; - } - } - cont:; - - } - fclose( inpf ); - - } - if( playerType==-1 ) - return NULL; - fileLoadStatus = TRUE; - - currentMusic.defSong = defSong; - currentMusic.numOfSongs = numOfSongs; - - - currentMusic.commentBuffer = &commentBuffer[0]; - currentMusic.currentTimeIn50Sec = 0; - -// sapPlaySong( defSong ); - return ¤tMusic; -} - - -void sapPlaySong( int numOfSong ) -{ - - if( fileLoadStatus==FALSE ) - return; - - if( numOfSong==-1 ) - numOfSong = 0; - numOfSong &= 0xFF; - numOfSong = numOfSong % currentMusic.numOfSongs; - - sndBufPtr = prSbp = 0; - switch( playerType ) - { - case 'c': - if( (playerAddress==-1) || (musicAddress==-1) ) - { - fileLoadStatus = FALSE; - break; - } - cpuReg_S = 0xFF; - cpuReg_A = 0x70; - cpuReg_X = (musicAddress&0xFF); - cpuReg_Y = (musicAddress>>8)&0xFF; - playerCallSubroutine( playerAddress+3 ); - cpuReg_S = 0xFF; - cpuReg_A = 0x00; - cpuReg_X = numOfSong; - playerCallSubroutine( playerAddress+3 ); - break; - case 'b': - case 'm': - if( (playerInit==-1) || (playerAddress==-1) ) - { - fileLoadStatus = FALSE; - break; - } - cpuReg_S = 0xFF; - cpuReg_A = numOfSong; - playerCallSubroutine( playerInit ); - break; - case 'd': - if( (playerInit==-1) || (playerAddress==-1) ) - { - fileLoadStatus = FALSE; - break; - } - cpuReg_S = 0xFF; - cpuReg_PC = 0xFFFF; - cpuReg_PC--; - atariMem[0x100 + cpuReg_S] = (cpuReg_PC>>8)&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = cpuReg_PC&0xFF; cpuReg_S--; - cpuReg_PC = playerInit; - cpuReg_A = numOfSong; - cpuReg_X = 0; - cpuReg_Y = 0; - cpuSetFlags( 0x20 ); - break; - case 's': - if( (playerInit==-1) || (playerAddress==-1) ) - { - fileLoadStatus = FALSE; - break; - } - cpuReg_S = 0xFF; - cpuReg_PC = playerInit; - cpuReg_A = 0; - cpuReg_X = 0; - cpuReg_Y = 0; - cpuSetFlags( 0x20 ); - break; - } -} - - -void _SAP_internals_::playerCallSubroutine( WORD address ) -{ -int i,k; - - cpuReg_PC = 0xFFFF; - cpuReg_PC--; - atariMem[0x100 + cpuReg_S] = (cpuReg_PC>>8)&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = cpuReg_PC&0xFF; cpuReg_S--; - cpuReg_PC = address; - k = 0; - bool holded; - while(k<1000000) - { - BYTE opcode = atariMem[ cpuReg_PC ]; - i = opcodes_0x00_0xFF[opcode](holded); - k+=i; - if( i>10 ) - return; - if( cpuReg_PC==0xFFFF ) - break; - } - k++; -} - -extern bool *generateIRQ0; -int numsPerFrame; - -void _SAP_internals_::playerProcessOneFrame( void ) -{ -int ilp = 0; -BYTE oldFlags = 0,oldA = 0,oldX = 0,oldY = 0,oldS = 0; -WORD oldPC = 0; -BOOL notRestored = 0; -bool holded; -int cycleInLine,lineInFrame; - - numsPerFrame = 0; - - if( playerType=='d' ) - { - oldFlags = cpuGetFlags(); - oldA = cpuReg_A; - oldX = cpuReg_X; - oldY = cpuReg_Y; - oldPC = cpuReg_PC; - oldS = cpuReg_S; - notRestored = TRUE; - } - if( playerType=='s' ) - { - - } - - if( playerType!='s' ) - { - cpuReg_S = 0x8F; - cpuReg_PC = 0xFFFF; - cpuReg_PC--; - atariMem[0x100 + cpuReg_S] = (cpuReg_PC>>8)&0xFF; cpuReg_S--; - atariMem[0x100 + cpuReg_S] = cpuReg_PC&0xFF; cpuReg_S--; - } - - switch( playerType ) - { - case 'c': - cpuReg_PC = playerAddress+6; - break; - case 'b': - case 'd': - case 'm': - cpuReg_PC = playerAddress; - break; - } - cycleInLine = 0; - if( fastPlay!=-1 ) - lineInFrame = 0; - else if( playerType=='s' ) - lineInFrame = 0; - else - lineInFrame = 248; - holded = false; - pokeyUpdateSoundCounters(); - - while(1) - { - if( cpuReg_PC!=0xFFFF ) - { - BYTE opcode = atariMem[ cpuReg_PC ]; - ilp = opcodes_0x00_0xFF[opcode](holded); - if( ilp>10 ) - return; // not supported instruction has been executed - if( (playerType=='b') || (playerType=='c') ) - ilp = 1; - } - else - { - if( playerType=='d' ) - { - if( notRestored==TRUE ) - { - notRestored = FALSE; - cpuReg_PC = oldPC; - cpuReg_A = oldA; - cpuReg_X = oldX; - cpuReg_Y = oldY; - cpuSetFlags( oldFlags ); - cpuReg_S = oldS; - } - } - else - { - do { - pokeyUpdateSound(114); - lineInFrame++; - currentMusic.currentTimeIn50Sec++; - if( fastPlay!=-1 ) - { - if( lineInFrame==fastPlay ) - { - pokeyUpdateSoundCounters(); - goto bre; - } - } - else - { - if( lineInFrame==248 ) - { - pokeyUpdateSoundCounters(); - goto bre; - } - if( lineInFrame==312 ) - { - lineInFrame=0; - pokeyUpdateSoundCounters(); - } - } - } while(1); - } - } - again: - for(;ilp>0;ilp--) - { - if( cycleInLine>=103-9 ) - { - if( cycleInLine==103-9 ) - { - if( holded ) - { - ilp = 0; - holded = false; - } - } - if( cycleInLine==113-9 ) - { - pokeyUpdateSound(114); - cycleInLine = -1; - lineInFrame++; - currentMusic.currentTimeIn50Sec++; - if( fastPlay!=-1 ) - { - if( lineInFrame==fastPlay ) - { - pokeyUpdateSoundCounters(); - goto bre; - } - } - else if( playerType=='s' ) - { - if( lineInFrame==78 ) - { - pokeyUpdateSoundCounters(); - atariMem[0x45]--; - if( atariMem[0x45]==0 ) - atariMem[0xB07B]++; - goto bre; - } - } - else - { - if( lineInFrame==248 ) - { - pokeyUpdateSoundCounters(); - goto bre; - } - if( lineInFrame==312 ) - { - lineInFrame=0; - pokeyUpdateSoundCounters(); - } - } - ANTIC_VCOUNT_D40B = (BYTE)(lineInFrame / 2); - } - } - cycleInLine++; - } - if( holded ) - { - ilp=114-9; - goto again; - } - if( generateIRQ0[0] ) - { - generateIRQ0[0] = false; - pokeyGenerateIRQ(1); - numsPerFrame++; - } - } - bre:; -} - - -void sapRenderBuffer( short int *buffer, int number_of_samples ) -{ -int i; - - if( fileLoadStatus==FALSE ) - return; - - i = 0; - number_of_samples *= sampleStep; - while( i<number_of_samples ) - { - if( prSbp==sndBufPtr ) - playerProcessOneFrame(); - for( ;prSbp!=sndBufPtr; prSbp=(prSbp+1)&16383 ) - { - if( isStereo ) - buffer[i] = sndBuf[prSbp&16383]; - else - { - buffer[i*2+0] = sndBuf[prSbp&16383]; - buffer[i*2+1] = sndBuf[prSbp&16383]; - } - if( i>=number_of_samples ) - break; - i++; - } - } -} -
--- a/src/sap/saplib/sapGlobals.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#ifdef __MAIN_DECLARATIONS__ -#define axeEXTERN -#else -#define axeEXTERN extern -#endif - -#ifndef BYTE -#define BYTE unsigned char -#endif -#ifndef WORD -#define WORD unsigned short int -#endif -#ifndef DWORD -#define DWORD unsigned long int -#endif -#ifndef BOOL -#define BOOL int -#endif -#define TRUE 1 -#define FALSE 0 - -axeEXTERN bool isStereo; -axeEXTERN int sampleStep; - -extern void pokeyGenerateCheckIRQline(void); -extern void pokeyGenerateIRQ( BYTE irqMask ); - -axeEXTERN BYTE atariMem[ 0x10000 ]; -axeEXTERN WORD sndBuf[16384]; -axeEXTERN int sndBufPtr; - -axeEXTERN BYTE ANTIC_VCOUNT_D40B; - -axeEXTERN WORD cpuReg_PC; -axeEXTERN BYTE cpuFlag_N,cpuFlag_Z,cpuFlag_C,cpuFlag_D,cpuFlag_B,cpuFlag_I,cpuFlag_V,cpuReg_A,cpuReg_X,cpuReg_Y,cpuReg_S; -// cpuFlag_N is valid only in last bit-7 -// cpuFlag_Z is set if whole cpuFlag_Z is not zero -// cpuFlag_C is valid only in first bit-0 -// cpuFlag_D is valid only in first bit-0 -// cpuFlag_B is valid only in first bit-0 -// cpuFlag_I is valid only in first bit-0 -// cpuFlag_V is valid only in first bit-0 - - -extern void cpuInit( void ); -extern int cpuExecuteOneOpcode( void ); -extern BYTE cpuGetFlags( void ); -extern void cpuSetFlags( BYTE flags ); - -extern void pokeyInit( void ); -extern void pokeyReset( void ); -extern BYTE pokeyReadByte( short unsigned int address ); -extern void pokeyWriteByte0( short unsigned int address, BYTE value ); -extern void pokeyWriteByte1( short unsigned int address, BYTE value ); -extern void pokeyUpdateSound( int n ); -extern void pokeyUpdateSoundCounters( void ); - -inline BYTE freddieReadByte( WORD ad ) -{ - if( (ad&0xF800)==0xD000 ) - { - if( (ad&0xFF00)==0xD200 ) - { - return pokeyReadByte( ad ); - } - if( (ad&0xFF0F)==0xD40B ) - return ANTIC_VCOUNT_D40B; - } - return atariMem[ad]; -} -inline BYTE freddieCPUReadByte( WORD ad ) -{ - return atariMem[ad]; -} - -inline void freddieWriteByte( WORD ad, BYTE val ) -{ - if( (ad&0xFF00)==0xD200 ) - { - if( ((ad&0x10)==0) || (isStereo==false) ) pokeyWriteByte0( ad, val ); - else pokeyWriteByte1( ad, val ); - return; - } - atariMem[ad] = val; -} - -typedef int (*opcodeFunc)(bool &holded); - -extern opcodeFunc opcodes_0x00_0xFF[256];
--- a/src/sap/saplib/sapLib.h Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int numOfSongs; - int defSong; - char *commentBuffer; - int currentTimeIn50Sec; -} sapMUSICstrc; - -sapMUSICstrc *sapLoadMusicFile( char *fname ); -void sapPlaySong( int numOfSong ); -void sapRenderBuffer( short int *buffer, int number_of_samples ); - -#ifdef __cplusplus -} -#endif -
--- a/src/sap/saplib/sapPokey.cxx Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#include <ctype.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "sapGlobals.h" - -extern void pokeyInit0( void ); -extern void pokeyInit1( void ); -extern void pokeyReset0( void ); -extern void pokeyReset1( void ); -extern void pokeyUpdateSound0( int n ); -extern void pokeyUpdateSound1( int n ); -extern void pokeyUpdateSoundCounters0( void ); -extern void pokeyUpdateSoundCounters1( void ); - -void pokeyInit( void ) -{ - pokeyInit0(); - pokeyInit1(); -} -void pokeyReset( void ) -{ - pokeyReset0(); - pokeyReset1(); -} - -void pokeyUpdateSound( int n ) -{ -int oldBufPtr = sndBufPtr; - pokeyUpdateSound0( n ); - if( isStereo ) - { - sndBufPtr = (oldBufPtr+1)&16383; - pokeyUpdateSound1( n ); - sndBufPtr = (sndBufPtr-1)&16383; - } -} - -void pokeyUpdateSoundCounters( void ) -{ - pokeyUpdateSoundCounters0(); - pokeyUpdateSoundCounters1(); -} - -BYTE pokeyReadByte( short unsigned int address) -{ -BYTE retVal; - - switch( address&0x0F ) - { - case 0x09: - return 0xFF; - case 0x0A: - retVal = (BYTE)((255*rand())/RAND_MAX); - return retVal; - case 0x0E: - return 0xFF; - case 0x0F: - return 0xFF; - } - return 0xFF; -}
--- a/src/sap/scripts/gen_symbols Mon Nov 06 15:04:13 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#! /bin/sh -/usr/bin/nm -B $1 | sed -n -e 's/^.*[ ]\([ABCDGISTW][ABCDGISTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' | sed 's/.* //' | sort | uniq > symbols -egrep -e "get_.plugin_info" "symbols" > syms -rm -f symbols \ No newline at end of file