Package: pd-vbap
Version: 1.0.3.1-1
Severity: normal
Tags: upstream

We are using a speaker setup which includes, among others, a "front left",
"front right", "center", "top center", and a "floor center" speaker. We
observed that a sound source panned slightly right beside the "center" is
almost solely played back via the "center" while a sound source panned slightly
left beside the "center" is played back by the "front left", the "top center",
and the "floor center" speaker. This has the effect that the auditory source-
width jumps, if we move the panned sound source from right to left. The reason
is as follows: for the measured azimuth/elevation angles of our speaker
positions (e.g., 3 elevated center speakers at 2°, 2°, and 3° azimuth
angle), define_loudspeakers() returns intersecting triangles. The attached
patch solves this issue.


-- System Information:
Debian Release: squeeze/sid
  APT prefers natty-updates
  APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-8-generic (SMP w/8 CPU cores)
--- define_loudspeakers.c.orig	2010-11-23 23:52:47.000000000 +0100
+++ define_loudspeakers.c	2011-11-24 13:56:33.406066763 +0100
@@ -546,6 +546,7 @@ static int lines_intersect(int i,int j,i
   //float angle;
   float dist_ij,dist_kl,dist_iv3,dist_jv3,dist_inv3,dist_jnv3;
   float dist_kv3,dist_lv3,dist_knv3,dist_lnv3;
+  float epsilon = 1e-9;
 
   ls_cross_prod(lss[i],lss[j],&v1);
   ls_cross_prod(lss[k],lss[l],&v2);
@@ -567,17 +568,17 @@ static int lines_intersect(int i,int j,i
   dist_lnv3 = (vec_angle(neg_v3,lss[l]));
 
   /* if one of loudspeakers is close to crossing point, don't do anything*/
-  if(fabsf(dist_iv3) <= 0.01 || fabsf(dist_jv3) <= 0.01 || 
-		 fabsf(dist_kv3) <= 0.01 || fabsf(dist_lv3) <= 0.01 ||
-     fabsf(dist_inv3) <= 0.01 || fabsf(dist_jnv3) <= 0.01 || 
-     fabsf(dist_knv3) <= 0.01 || fabsf(dist_lnv3) <= 0.01 )
+  if(fabsf(dist_iv3)  <= epsilon || fabsf(dist_jv3)  <= epsilon || 
+     fabsf(dist_kv3)  <= epsilon || fabsf(dist_lv3)  <= epsilon ||
+     fabsf(dist_inv3) <= epsilon || fabsf(dist_jnv3) <= epsilon || 
+     fabsf(dist_knv3) <= epsilon || fabsf(dist_lnv3) <= epsilon )
     return(0);
 
   // if crossing point is on line between both loudspeakers return 1
-  if (((fabsf(dist_ij - (dist_iv3 + dist_jv3)) <= 0.01 ) &&
-       (fabsf(dist_kl - (dist_kv3 + dist_lv3))  <= 0.01)) ||
-      ((fabsf(dist_ij - (dist_inv3 + dist_jnv3)) <= 0.01)  &&
-       (fabsf(dist_kl - (dist_knv3 + dist_lnv3)) <= 0.01 ))) {
+  if (((fabsf(dist_ij - (dist_iv3 + dist_jv3))   <= epsilon)  &&
+       (fabsf(dist_kl - (dist_kv3 + dist_lv3))   <= epsilon)) ||
+      ((fabsf(dist_ij - (dist_inv3 + dist_jnv3)) <= epsilon)  &&
+       (fabsf(dist_kl - (dist_knv3 + dist_lnv3)) <= epsilon))) {
     return (1);
   } else {
     return (0);

Reply via email to