aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzacksettel <zacksettel@users.sourceforge.net>2014-08-14 22:26:23 +0000
committerzacksettel <zacksettel@users.sourceforge.net>2014-08-14 22:26:23 +0000
commit41c98252741e53bac9cab291e57f87f40a24d9bc (patch)
tree62c859aa7ea0caa466bdc0115b4af00cab345308
parent33cfd66d36e9ec07b80fc0a4675c5073494ced27 (diff)
cleaned up code to compile and run on Linux i686 32bitHEADsvn2git-headexternals/vbap
svn path=/trunk/externals/vbap/; revision=17332
-rw-r--r--CHANGELOG.txt4
-rw-r--r--define_loudspeakers.c2
-rw-r--r--vbap-meta.pd9
-rw-r--r--vbap.c21
-rw-r--r--vbap.h5
5 files changed, 25 insertions, 16 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 132c66d..9956b0f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,5 @@
-from version 1.0.3.2 to version 1.0.3.3
+14 Aug. 2014 update from version 1.0.3.2 to version 1.1
-- changed vbap to allocate memory dynamically, to eliminate crash-producing memory overwrites when larger speaker configurations were defined (e.g. on OSX for speakers > 13 in 3D)
+- changed vbap to allocate memory dynamically, to eliminate crash-producing memory overwrites when larger speaker configurations were defined (e.g. on OSX for speakers > 13 in 3D) z.settel
- eliminated a post to the console reporting azimuth updates
diff --git a/define_loudspeakers.c b/define_loudspeakers.c
index 2d826c0..16c5b62 100644
--- a/define_loudspeakers.c
+++ b/define_loudspeakers.c
@@ -608,7 +608,7 @@ static void calculate_3x3_matrixes(t_def_ls *x)
//t_float *ptr;
struct t_ls_set *tr_ptr = x->x_ls_set;
- unsigned long triplet_amount = 0, /*ftable_size,*/i,pointer,list_length=0; // zack
+ unsigned long triplet_amount = 0, /*ftable_size,*/i,pointer,list_length=0;
Atom *at;
diff --git a/vbap-meta.pd b/vbap-meta.pd
index d95168b..8077fd7 100644
--- a/vbap-meta.pd
+++ b/vbap-meta.pd
@@ -1,7 +1,8 @@
-#N canvas 10 10 200 200 10;
-#N canvas 20 20 420 300 META 0;
+#N canvas 140 22 200 200 10;
+#N canvas 20 22 420 300 META 0;
#X text 10 30 NAME vbap;
#X text 10 50 AUTHOR Ville Pulkki;
-#X text 10 70 DESCRIPTION spatialization using Vector Based Amplitude Panning;
-#X text 10 90 VERSION 1.0.3.2;
+#X text 10 70 DESCRIPTION spatialization using Vector Based Amplitude
+Panning;
+#X text 10 107 VERSION 1.1;
#X restore 10 10 pd META;
diff --git a/vbap.c b/vbap.c
index d83fe02..f1e4052 100644
--- a/vbap.c
+++ b/vbap.c
@@ -200,6 +200,8 @@ static int vbap_getmem(t_vbap *x, int lsSetCount )
{
#ifdef PD
+
+ int i;
if ( x->x_ls_setCount ) vbap_free(x);
@@ -208,7 +210,7 @@ static int vbap_getmem(t_vbap *x, int lsSetCount )
if(!x->x_set_inv_matx) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof( t_float* ) * lsSetCount); return(0);}
- for (int i = 0; i < lsSetCount; i++)
+ for (i = 0; i < lsSetCount; i++)
{
x->x_set_inv_matx[i] = getbytes( sizeof(t_float) * MATRIX_DIM );
if(!x->x_set_inv_matx[i]) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof(t_float) * MATRIX_DIM ); return(0);}
@@ -220,7 +222,7 @@ static int vbap_getmem(t_vbap *x, int lsSetCount )
if(!x->x_set_matx) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof( t_float* ) * lsSetCount); return(0);}
- for (int i = 0; i < lsSetCount; i++)
+ for (i = 0; i < lsSetCount; i++)
{
x->x_set_matx[i] = getbytes( sizeof(t_float) * MATRIX_DIM );
if(!x->x_set_matx[i]) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof(t_float) * MATRIX_DIM ); return(0);}
@@ -232,7 +234,7 @@ static int vbap_getmem(t_vbap *x, int lsSetCount )
if(!x->x_lsset) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof( long * ) * lsSetCount); return(0);}
- for (int i = 0; i < lsSetCount; i++)
+ for (i = 0; i < lsSetCount; i++)
{
x->x_lsset[i] = getbytes( sizeof( long ) * SPEAKER_SET_DIM );
if(!x->x_lsset[i]) {error("vbap_getmem: can't allocate additional %ld bytes", sizeof(long) * SPEAKER_SET_DIM ); return(0);}
@@ -253,9 +255,11 @@ static int vbap_getmem(t_vbap *x, int lsSetCount )
// free any allocated memory for instance
static void vbap_free(t_vbap *x)
{
+ int i;
+
if (! x->x_ls_setCount) return;
- for (int i = 0; i < x->x_ls_setCount; i++)
+ for (i = 0; i < x->x_ls_setCount; i++)
{
freebytes( x->x_set_inv_matx[i], (sizeof(t_float) * MATRIX_DIM )); // = getbytes( sizeof(t_float) * MATRIX_DIM );
freebytes( x->x_set_matx[i], sizeof(t_float) * MATRIX_DIM);
@@ -265,7 +269,7 @@ static void vbap_free(t_vbap *x)
freebytes(x->x_set_matx, sizeof( t_float* ) * x->x_ls_setCount);
- for (int i = 0; i < x->x_ls_setCount; i++)
+ for (i = 0; i < x->x_ls_setCount; i++)
{
freebytes(x->x_lsset[i], sizeof( long ) * SPEAKER_SET_DIM );
}
@@ -653,7 +657,8 @@ static void vbap_bang(t_vbap *x)
final_gs[i]=0.0;
for(i=0;i<x->x_dimension;i++)
{
- final_gs[ls[i]-1]=g[i];
+ final_gs[ls[i]-1]=g[i];
+ //post("VBAP: PRE_SPREAD: %f", (t_float)final_gs[i]);
}
if(x->x_spread != 0)
{
@@ -662,7 +667,9 @@ static void vbap_bang(t_vbap *x)
for(i=0;i<x->x_ls_amount;i++)
{
#ifdef PD
- SETFLOAT(&at[0], (t_float)i);
+
+
+ SETFLOAT(&at[0], (t_float)i);
SETFLOAT(&at[1], (t_float)final_gs[i]);
outlet_list(x->x_obj.ob_outlet, &s_list, 2, at);
#else /* Max */
diff --git a/vbap.h b/vbap.h
index 57146ac..ecd388c 100644
--- a/vbap.h
+++ b/vbap.h
@@ -11,8 +11,9 @@
#endif
#ifdef PD
+// Revised by Z. Settel to dynamically allocate memory
#define MAX_LS_SETS 745 // maximum number of loudspeaker sets (triplets or pairs) allowed -- allows for up to 44 speakers in 3D config
-//#define MAX_LS_SETS 100 // former maximum value, allowed for up to 13 speakers in 3D config
+//#define MAX_LS_SETS 100 // former maximum value crashed for 3D speaker configurations with more than 13 speakers
//#define MAX_LS_SETS 571 // example: for up to 32 speakers in 3D config
#else // Max
@@ -27,7 +28,7 @@
#define MAX_LS_AMOUNT 55 // maximum amount of loudspeakers, can be increased, but see comments next to MAX_LS_SETS above
#define MIN_VOL_P_SIDE_LGTH 0.01
-#define VBAP_VERSION "pdsheefa_vbap - v1.0.3.3 - 15 May 2014 - (c) Ville Pulkki 1999-2006 (Pd port by HCS, updated by ZS)"
+#define VBAP_VERSION "vbap - v1.1 - 14 Aug. 2014 - (c) Ville Pulkki 1999-2006 (Pd port by HCS)"
#define DFLS_VERSION "define_loudspeakers - v1.0.3.2 - 20 Nov 2010 - (c) Ville Pulkki 1999-2006"
static t_float rad2ang = 360.0 / ( 2.0f * M_PI );