changeset 164:0393aae79318 trunk

[svn] - clean up about box - add on-beat branch-change evaluation
author nenolod
date Tue, 31 Oct 2006 21:28:30 -0800
parents 46e074b915eb
children f57b76df3d96
files ChangeLog src/paranormal/containers.c src/paranormal/plugin.c
diffstat 3 files changed, 33 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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 <nenolod@nenolod.net>
+  revision [326]
+  - @%#^#
+  
+  trunk/src/modplug/Makefile |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2006-10-31 23:31:33 +0000  William Pitcock <nenolod@nenolod.net>
   revision [324]
   - fix reference
--- 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 <glib.h>
 
 #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
 };
--- 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 <nenolod -at- nenolod.net>\n\
 Portions Copyright (C) 2001, Jamie Gennis <jgennis -at- mindspring.com>\n\
 \n\