aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-24 04:32:28 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-24 04:32:28 +0000
commitd0f4249b5da71f9d2453a2e099cfe138df82402d (patch)
treece5cc135f8acccf48110c8ab5682577991fb4478
parent9751d365f8b023aab6964d618a232cba6afb02ab (diff)
made this object a good citizen by declaring as much as possible as 'static'
svn path=/trunk/externals/vbap/; revision=11112
-rw-r--r--define_loudspeakers.c26
-rwxr-xr-xdefine_loudspeakers.h44
-rw-r--r--vbap.c49
3 files changed, 60 insertions, 59 deletions
diff --git a/define_loudspeakers.c b/define_loudspeakers.c
index ce064f1..2ce8457 100644
--- a/define_loudspeakers.c
+++ b/define_loudspeakers.c
@@ -39,7 +39,7 @@ void main(void)
# endif /* PD */
#endif /* ! VBAP_OBJECT */
-void def_ls_bang(t_def_ls *x) /* x = reference to this instance of the object */
+static void def_ls_bang(t_def_ls *x) /* x = reference to this instance of the object */
{ // calculate and print out chosen loudspeaker sets and corresponding matrices
if(x->x_ls_read == 1)
@@ -87,7 +87,7 @@ void def_ls_int(t_def_ls *x, long n) // x = the instance of the object, n = the
}
*/
-void def_ls_read_triplets(t_def_ls *x, t_symbol *s, int ac, Atom *av)
+static void def_ls_read_triplets(t_def_ls *x, t_symbol *s, int ac, Atom *av)
// when loudspeaker triplets come in a message
{
t_ls_set *trip_ptr, *tmp_ptr, *prev;
@@ -143,7 +143,7 @@ void def_ls_read_triplets(t_def_ls *x, t_symbol *s, int ac, Atom *av)
-void def_ls_read_directions(t_def_ls *x, t_symbol *s, int ac, Atom *av)
+static void def_ls_read_directions(t_def_ls *x, t_symbol *s, int ac, Atom *av)
// when loudspeaker directions come in a message
{
if (x->x_ls_read)
@@ -164,7 +164,7 @@ void def_ls_read_directions(t_def_ls *x, t_symbol *s, int ac, Atom *av)
/*--------------------------------------------------------------------------*/
-void ls_angles_to_cart(t_ls *ls)
+static void ls_angles_to_cart(t_ls *ls)
// convert angular direction to cartesian
{
float azi = ls->azi;
@@ -175,7 +175,7 @@ void ls_angles_to_cart(t_ls *ls)
}
/* create new instance of object... MUST send it an int even if you do nothing with this int!! */
-void *def_ls_new(t_symbol *s, int ac, Atom *av)
+static void *def_ls_new(t_symbol *s, int ac, Atom *av)
{
// s is object name (we ignore it)
t_def_ls *x = (t_def_ls *)newobject(def_ls_class);
@@ -199,7 +199,7 @@ void vbap_def_ls(t_def_ls *x, t_symbol *s, int ac, Atom *av)
}
/** Initialize the object content from parameters : ls-directions list */
-void initContent_ls_directions(t_def_ls *x,int ac,Atom*av)
+static void initContent_ls_directions(t_def_ls *x,int ac,Atom*av)
{
x->x_ls_read = 0;
@@ -260,7 +260,7 @@ void initContent_ls_directions(t_def_ls *x,int ac,Atom*av)
x->x_ls_set = NULL;
}
-void choose_ls_triplets(t_def_ls *x)
+static void choose_ls_triplets(t_def_ls *x)
/* Selects the loudspeaker triplets, and
calculates the inversion matrices for each selected triplet.
A line (connection) is drawn between each loudspeaker. The lines
@@ -451,7 +451,7 @@ int any_ls_inside_triplet(int a, int b, int c,t_ls lss[MAX_LS_AMOUNT],int ls_amo
return any_ls_inside;
}
-void add_ldsp_triplet(int i, int j, int k, t_def_ls *x)
+static void add_ldsp_triplet(int i, int j, int k, t_def_ls *x)
/* adds i,j,k triplet to structure*/
{
struct t_ls_set *trip_ptr, *prev;
@@ -520,7 +520,7 @@ float vol_p_side_lgth(int i, int j,int k, t_ls lss[MAX_LS_AMOUNT] )
return 0.0;
}
-void ls_cross_prod(t_ls v1,t_ls v2,
+static void ls_cross_prod(t_ls v1,t_ls v2,
t_ls *res)
// vector cross product
{
@@ -536,7 +536,7 @@ void ls_cross_prod(t_ls v1,t_ls v2,
}
-int lines_intersect(int i,int j,int k,int l,t_ls lss[MAX_LS_AMOUNT])
+static int lines_intersect(int i,int j,int k,int l,t_ls lss[MAX_LS_AMOUNT])
/* checks if two lines intersect on 3D sphere
*/
{
@@ -584,7 +584,7 @@ int lines_intersect(int i,int j,int k,int l,t_ls lss[MAX_LS_AMOUNT])
}
}
-void calculate_3x3_matrixes(t_def_ls *x)
+static void calculate_3x3_matrixes(t_def_ls *x)
/* Calculates the inverse matrices for 3D */
{
float invdet;
@@ -663,7 +663,7 @@ void calculate_3x3_matrixes(t_def_ls *x)
-void choose_ls_tuplets(t_def_ls *x)
+static void choose_ls_tuplets(t_def_ls *x)
/* selects the loudspeaker pairs, calculates the inversion
matrices and stores the data to a global array*/
{
@@ -803,7 +803,7 @@ for (i=0;i<ls_amount;i++)
}
-int calc_2D_inv_tmatrix(float azi1,float azi2, float inv_mat[4],float mat[4])
+static int calc_2D_inv_tmatrix(float azi1,float azi2, float inv_mat[4],float mat[4])
// calculate inverse 2x2 matrix
{
float x1,x2,x3,x4; /* x1 x3 */
diff --git a/define_loudspeakers.h b/define_loudspeakers.h
index 52a8e88..2b124cc 100755
--- a/define_loudspeakers.h
+++ b/define_loudspeakers.h
@@ -10,28 +10,28 @@ See copyright in file with name COPYRIGHT */
#include "vbap.h"
static t_class *def_ls_class; /* so max can identify your object */
-void def_ls_bang(t_def_ls *x);
-void def_ls_int(t_def_ls *x, long n);
-void def_ls_read_directions(t_def_ls *x, t_symbol *s, int ac, Atom *av);
-void def_ls_read_triplets(t_def_ls *x, t_symbol *s, int ac, Atom *av);
-void *def_ls_new(t_symbol *s, int ac, Atom *av);
-void def_ls(float g[3], long ls[3], t_def_ls *x);
-void ls_angles_to_cart(t_ls *ls);
-void choose_ls_triplets(t_def_ls *x);
-int any_ls_inside_triplet(int a, int b, int c,t_ls lss[MAX_LS_AMOUNT],int ls_amount);
-void add_ldsp_triplet(int i, int j, int k, t_def_ls *x);
-float vec_angle(t_ls v1, t_ls v2);
-float vec_length(t_ls v1);
-float vec_prod(t_ls v1, t_ls v2);
-float vec_prod(t_ls v1, t_ls v2);
-float vol_p_side_lgth(int i, int j,int k, t_ls lss[MAX_LS_AMOUNT] );
-void ls_cross_prod(t_ls v1,t_ls v2, t_ls *res);
-int lines_intersect(int i,int j,int k,int l,t_ls lss[MAX_LS_AMOUNT]);
-void calculate_3x3_matrixes(t_def_ls *x);
-void choose_ls_tuplets(t_def_ls *x);
-int calc_2D_inv_tmatrix(float azi1,float azi2, float inv_mat[4],float mat[4]);
-void sort_2D_lss(t_ls lss[MAX_LS_AMOUNT], int sorted_lss[MAX_LS_AMOUNT],
+static void def_ls_bang(t_def_ls *x);
+//static void def_ls_int(t_def_ls *x, long n);
+static void def_ls_read_directions(t_def_ls *x, t_symbol *s, int ac, Atom *av);
+static void def_ls_read_triplets(t_def_ls *x, t_symbol *s, int ac, Atom *av);
+static void *def_ls_new(t_symbol *s, int ac, Atom *av);
+//static void def_ls(float g[3], long ls[3], t_def_ls *x);
+static void ls_angles_to_cart(t_ls *ls);
+static void choose_ls_triplets(t_def_ls *x);
+static int any_ls_inside_triplet(int a, int b, int c,t_ls lss[MAX_LS_AMOUNT],int ls_amount);
+static void add_ldsp_triplet(int i, int j, int k, t_def_ls *x);
+static float vec_angle(t_ls v1, t_ls v2);
+static float vec_length(t_ls v1);
+static float vec_prod(t_ls v1, t_ls v2);
+static float vec_prod(t_ls v1, t_ls v2);
+static float vol_p_side_lgth(int i, int j,int k, t_ls lss[MAX_LS_AMOUNT] );
+static void ls_cross_prod(t_ls v1,t_ls v2, t_ls *res);
+static int lines_intersect(int i,int j,int k,int l,t_ls lss[MAX_LS_AMOUNT]);
+static void calculate_3x3_matrixes(t_def_ls *x);
+static void choose_ls_tuplets(t_def_ls *x);
+static int calc_2D_inv_tmatrix(float azi1,float azi2, float inv_mat[4],float mat[4]);
+static void sort_2D_lss(t_ls lss[MAX_LS_AMOUNT], int sorted_lss[MAX_LS_AMOUNT],
int ls_amount);
-void initContent_ls_directions(t_def_ls *x,int ac,Atom*av);
+static void initContent_ls_directions(t_def_ls *x,int ac,Atom*av);
void vbap_def_ls(t_def_ls *x, t_symbol *s, int ac, Atom *av);
diff --git a/vbap.c b/vbap.c
index f60f331..ef84219 100644
--- a/vbap.c
+++ b/vbap.c
@@ -14,24 +14,25 @@ See copyright in file with name COPYRIGHT */
#include "s_stuff.h"
// Function prototypes
-void new_spread_dir(t_vbap *x, float spreaddir[3], float vscartdir[3], float spread_base[3]);
-void new_spread_base(t_vbap *x, float spreaddir[3], float vscartdir[3]);
+static void new_spread_dir(t_vbap *x, float spreaddir[3], float vscartdir[3], float spread_base[3]);
+static void new_spread_base(t_vbap *x, float spreaddir[3], float vscartdir[3]);
static void *vbap_class;
-void vect_cross_prod(float v1[3], float v2[3],float v3[3]);
-void additive_vbap(float *final_gs, float cartdir[3], t_vbap *x);
-void vbap_bang(t_vbap *x);
-void vbap_matrix(t_vbap *x, Symbol *s, int ac, Atom *av);
-/* these are for getting data from a cold inlet on Max/MSP, in Pd you use floatinlet_new() in new()
+static void vect_cross_prod(float v1[3], float v2[3],float v3[3]);
+static void additive_vbap(float *final_gs, float cartdir[3], t_vbap *x);
+static void vbap_bang(t_vbap *x);
+static void vbap_matrix(t_vbap *x, Symbol *s, int ac, Atom *av);
+#ifndef PD /* Max */
+/* these are for getting data from a cold inlet on Max/MSP, in Pd you use floatinlet_new() in new() */
void vbap_ft1(t_vbap *x, double n);
void vbap_ft2(t_vbap *x, double n);
void vbap_in3(t_vbap *x, long n);
void vbap_ft4(t_vbap *x, double g);
-*/
-void spread_it(t_vbap *x, float *final_gs);
-void *vbap_new(float azi, float ele, float spread);
-void vbap(float g[3], long ls[3], t_vbap *x);
-void angle_to_cart(float azi, float ele, float res[3]);
-void cart_to_angle(float cvec[3], float avec[3]);
+#endif
+static void spread_it(t_vbap *x, float *final_gs);
+static void *vbap_new(float azi, float ele, float spread);
+static void vbap(float g[3], long ls[3], t_vbap *x);
+static void angle_to_cart(float azi, float ele, float res[3]);
+static void cart_to_angle(float cvec[3], float avec[3]);
/*****************************************************
INCLUDE ALL define_loudspeakers functions directly into VBAP
@@ -139,7 +140,7 @@ void vbap_ft4(t_vbap *x, double g) { x->x_gain = g; }
/*--------------------------------------------------------------------------*/
// create new instance of object...
#ifdef PD
-void *vbap_new(t_float azi, t_float ele, t_float spread)
+static void *vbap_new(t_float azi, t_float ele, t_float spread)
{
t_vbap *x = (t_vbap *)newobject(vbap_class);
@@ -181,7 +182,7 @@ void *vbap_new(float azi,float ele)
}
-void angle_to_cart(float azi, float ele, float res[3])
+static void angle_to_cart(float azi, float ele, float res[3])
// converts angular coordinates to cartesian
{
res[0] = cos(azi * atorad) * cos( ele * atorad);
@@ -189,7 +190,7 @@ void angle_to_cart(float azi, float ele, float res[3])
res[2] = sin( ele * atorad);
}
-void cart_to_angle(float cvec[3], float avec[3])
+static void cart_to_angle(float cvec[3], float avec[3])
// converts cartesian coordinates to angular
{
//float tmp, tmp2, tmp3, tmp4;
@@ -224,7 +225,7 @@ void cart_to_angle(float cvec[3], float avec[3])
}
-void vbap(float g[3], long ls[3], t_vbap *x)
+static void vbap(float g[3], long ls[3], t_vbap *x)
{
/* calculates gain factors using loudspeaker setup and given direction */
float power;
@@ -335,7 +336,7 @@ void vbap(float g[3], long ls[3], t_vbap *x)
}
-void vect_cross_prod(float v1[3], float v2[3],
+static void vect_cross_prod(float v1[3], float v2[3],
float v3[3])
// vector cross product
{
@@ -350,7 +351,7 @@ void vect_cross_prod(float v1[3], float v2[3],
v3[2] /= length;
}
-void additive_vbap(float *final_gs, float cartdir[3], t_vbap *x)
+static void additive_vbap(float *final_gs, float cartdir[3], t_vbap *x)
// calculates gains to be added to previous gains, used in
// multiple direction panning (source spreading)
{
@@ -416,7 +417,7 @@ void additive_vbap(float *final_gs, float cartdir[3], t_vbap *x)
}
-void new_spread_dir(t_vbap *x, float spreaddir[3], float vscartdir[3], float spread_base[3])
+static void new_spread_dir(t_vbap *x, float spreaddir[3], float vscartdir[3], float spread_base[3])
// subroutine for spreading
{
float beta,gamma;
@@ -446,7 +447,7 @@ void new_spread_dir(t_vbap *x, float spreaddir[3], float vscartdir[3], float spr
spreaddir[2] /= power;
}
-void new_spread_base(t_vbap *x, float spreaddir[3], float vscartdir[3])
+static void new_spread_base(t_vbap *x, float spreaddir[3], float vscartdir[3])
// subroutine for spreading
{
float d;
@@ -463,7 +464,7 @@ void new_spread_base(t_vbap *x, float spreaddir[3], float vscartdir[3])
x->x_spread_base[2] /= power;
}
-void spread_it(t_vbap *x, float *final_gs)
+static void spread_it(t_vbap *x, float *final_gs)
// apply the sound signal to multiple panning directions
// that causes some spreading.
// See theory in paper V. Pulkki "Uniform spreading of amplitude panned
@@ -538,7 +539,7 @@ void spread_it(t_vbap *x, float *final_gs)
}
-void vbap_bang(t_vbap *x)
+static void vbap_bang(t_vbap *x)
// top level, vbap gains are calculated and outputted
{
Atom at[MAX_LS_AMOUNT];
@@ -585,7 +586,7 @@ void vbap_bang(t_vbap *x)
/*--------------------------------------------------------------------------*/
-void vbap_matrix(t_vbap *x, Symbol *s, int ac, Atom *av)
+static void vbap_matrix(t_vbap *x, Symbol *s, int ac, Atom *av)
// read in loudspeaker matrices
{
int datapointer = 0;