No, I don't, but thanks for asking :-) I would not mind having access but I am also not sure about the dynamics of different externals. I tend to litter my contributions all over, as opposed to a specific library, so I am not clear how others would feel about that...

BTW, I discovered one regression for my modular-sized average patch, which has been fixed since. Attached is a new revision...

Best,

Ico

On 09/10/2014 06:36 AM, pured...@11h11.com wrote:
Don't you have write access to the external repository?

I don't know if this page is up-to-date:
http://puredata.info/docs/developer/SVNCommitAccess

You can skip the "2. post an introduction to pd-dev of yourself" & "3.describe why you need commit access to the repository". Not sure who will grant you the permission.

Anyone?
Cheers

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list


--
Ivica Ico Bukvic, D.M.A.
Associate Professor
Computer Music
ICAT Senior Fellow
DISIS, L2Ork
Virginia Tech
School of Performing Arts - 0141
Blacksburg, VA 24061
(540) 231-6139
i...@vt.edu
www.performingarts.vt.edu
disis.music.vt.edu
l2ork.music.vt.edu

--- ../../../pd-extended/externals/maxlib/average.c	2013-10-27 15:48:21.866606276 -0400
+++ average.c	2014-09-09 19:28:16.694066181 -0400
@@ -24,10 +24,10 @@
 
 #include "m_pd.h"
 #include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
 
-#define MAX_ARG  128                /* maximum number of items to average */
-
-static char *version = "average v0.1, written by Olaf Matthes <olaf.matt...@gmx.de>";
+static char *version = "average v0.2, written by Olaf Matthes <olaf.matt...@gmx.de>, revised by Ivica Ico Bukvic <i...@vt.edu>";
  
 typedef struct average
 {
@@ -38,7 +38,7 @@
   t_outlet *x_outtendency;          /* outputs the tendency of the average */
   t_int    x_limit;                 /* indicates if input is 'blocked' (1) */
   t_int    x_index;                 /* the number of elements to average */
-  t_float  x_input[MAX_ARG];        /* stores the input values we need for averaging */
+  t_float  *x_input;        		/* stores the input values we need for averaging */
   t_int    x_inpointer;             /* actual position in above array */
   t_float  x_average;               /* what do you guess ? */
   t_float  x_lastaverage;
@@ -91,7 +91,7 @@
 				x->x_average = x->x_average / (float)normalise(x->x_index - 1);
 		} else post("average: internal error!");
 	}
-	if(++x->x_inpointer > x->x_index)
+	if(++x->x_inpointer >= x->x_index)
 	{
 		x->x_inpointer = 0;
 		if(x->x_lastaverage < x->x_average)
@@ -111,15 +111,40 @@
 
 static void average_index(t_average *x, t_floatarg f)
 {
-	x->x_index = (t_int)f;
-	if(x->x_index > MAX_ARG)x->x_index = MAX_ARG;
+	if ((t_int)f > 0 && (t_int)f != x->x_index)
+	{
+		//fprintf(stderr,"average_index realloc old=%d new=%d\n", (int)x->x_index, (int)f);
+		int zero_out_new = 0;
+		int i = 0;
+
+		if ((t_int)f > x->x_index)
+			zero_out_new = x->x_index;
+		x->x_index = (t_int)f;
+		if (x->x_inpointer >= x->x_index)
+		{
+			x->x_inpointer = 0;
+		}
+		x->x_input = (t_float *)realloc(x->x_input, x->x_index * sizeof(t_float));
+		if (zero_out_new)
+		{
+			for (i = zero_out_new; i < x->x_index; i++)
+				x->x_input[i] = 0;			
+		}
+		
+		/* DEBUG:
+		printf("%d %d: ", (int)x->x_index, zero_out_new);
+		for (i=0; i<x->x_index; i++)
+			printf("%g ", x->x_input[i]);
+		printf("\n");
+		*/
+	}
 }
 
 static void average_reset(t_average *x)
 {
 	int i;
-		/* zeroe out the array */
-	for(i = 0; i < MAX_ARG; i++)x->x_input[i] = 0.0;
+		/* zero out the array */
+	for(i = 0; i < x->x_index; i++)x->x_input[i] = 0.0;
 	x->x_inpointer = 0;
 	x->x_average = 0;
 	x->x_lastaverage = 0;
@@ -146,28 +171,24 @@
 
 static void average_free(t_average *x)
 {
-	/* nothing to do */
+	free(x->x_input);
 }
 
 static t_class *average_class;
 
 static void *average_new(t_floatarg f)
 {
-	int i;
-
-    t_average *x = (t_average *)pd_new(average_class);
+	t_average *x = (t_average *)pd_new(average_class);
 	x->x_inindex = inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("float"), gensym("index"));
 	x->x_outfloat = outlet_new(&x->x_ob, gensym("float"));
 	x->x_outtendency = outlet_new(&x->x_ob, gensym("float"));
 
-		/* zeroe out the array */
-	for(i = 0; i < MAX_ARG; i++)x->x_input[i] = 0.0;
+		/* zero out the array */
 	x->x_index = (t_int)f;
-	if(x->x_index > MAX_ARG)
-	{
-		x->x_index = MAX_ARG;
-		post("average: set number of items to %d", x->x_index);
-	}
+	if (x->x_index < 1)
+		x->x_index = 1;
+	x->x_input = (t_float *)calloc(x->x_index,sizeof(t_float));
+
 	x->x_inpointer = 0;
 	x->x_average = 0;
 	x->x_mode = 0;
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to