# HG changeset patch # User nenolod # Date 1162358910 28800 # Node ID 0393aae79318595638799c4855c7fc6e79dfe4a9 # Parent 46e074b915eba0043bcdcfebdb12fb515dc98f73 [svn] - clean up about box - add on-beat branch-change evaluation diff -r 46e074b915eb -r 0393aae79318 ChangeLog --- a/ChangeLog Tue Oct 31 15:33:08 2006 -0800 +++ b/ChangeLog Tue Oct 31 21:28:30 2006 -0800 @@ -1,3 +1,11 @@ +2006-10-31 23:33:08 +0000 William Pitcock + revision [326] + - @%#^# + + trunk/src/modplug/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2006-10-31 23:31:33 +0000 William Pitcock revision [324] - fix reference diff -r 46e074b915eb -r 0393aae79318 src/paranormal/containers.c --- a/src/paranormal/containers.c Tue Oct 31 15:33:08 2006 -0800 +++ b/src/paranormal/containers.c Tue Oct 31 21:28:30 2006 -0800 @@ -7,6 +7,7 @@ #include #include "actuators.h" +#include "paranormal.h" /* **************** all containers **************** */ @@ -143,7 +144,7 @@ { { "change_interval", "The number of seconds between changing the " "child to be executed", OPT_TYPE_INT, { ival: 20 } }, - { "random", "Whether or not the change should be random", + { "beat", "Whether or not the change should only occur on a beat", OPT_TYPE_BOOLEAN, { bval: TRUE } }, { 0 } }; @@ -153,6 +154,7 @@ GSList *children; GSList *current; int last_change; + int last_beat; }; static void @@ -174,19 +176,29 @@ { struct container_cycle_data *cdata = (struct container_cycle_data*)data; int now; - - now = SDL_GetTicks (); + int new_beat = ((pn_sound_data->pcm_data[0][0]+pn_sound_data->pcm_data[1][0]) >> 7) >= 80 ? 1 : 0; - if (now - cdata->last_change - > opts[0].val.ival * 1000) + /* + * Change branch if all of the requirements are met for the branch to change. + */ + if ((opts[1].val.bval == TRUE && new_beat != cdata->last_beat) || opts[1].val.bval == FALSE) { - cdata->last_change = now; + now = SDL_GetTicks(); + + if (now - cdata->last_change + > opts[0].val.ival * 1000) + { + cdata->last_change = now; - /* FIXME: add randomization support */ - if (cdata->current) - cdata->current = cdata->current->next; + /* FIXME: add randomization support */ + if (cdata->current) + cdata->current = cdata->current->next; + } } + /* reset the tracking for on-beat branch changing. */ + cdata->last_beat = new_beat; + if (! cdata->current) cdata->current = cdata->children; @@ -199,7 +211,7 @@ "container_cycle", "Branched-execution Container", "A container that alternates which of its children is executed; it " - "can either change children randomly or go in order.", + "can either change on an interval, or only on a beat.", ACTUATOR_FLAG_CONTAINER, container_cycle_opts, container_cycle_init, container_cycle_cleanup, container_cycle_exec }; diff -r 46e074b915eb -r 0393aae79318 src/paranormal/plugin.c --- a/src/paranormal/plugin.c Tue Oct 31 15:33:08 2006 -0800 +++ b/src/paranormal/plugin.c Tue Oct 31 21:28:30 2006 -0800 @@ -244,7 +244,9 @@ static void pn_xmms_about (void) { - xmms_show_message("Paranormal Visualization Studio " VERSION "\n\n\ + xmms_show_message("About Paranormal Visualization Studio", + +"Paranormal Visualization Studio " VERSION "\n\n\ Copyright (C) 2006, William Pitcock \n\ Portions Copyright (C) 2001, Jamie Gennis \n\ \n\