From d0f4249b5da71f9d2453a2e099cfe138df82402d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 24 Apr 2009 04:32:28 +0000 Subject: made this object a good citizen by declaring as much as possible as 'static' svn path=/trunk/externals/vbap/; revision=11112 --- define_loudspeakers.c | 26 +++++++++++++------------- define_loudspeakers.h | 44 ++++++++++++++++++++++---------------------- vbap.c | 49 +++++++++++++++++++++++++------------------------ 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;ix_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; -- cgit v1.2.1