diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-08 01:52:06 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-08 01:52:06 +0000 |
commit | cbfb77cd8e95eba773a8a9ffbef9cc41efab2309 (patch) | |
tree | af2432fe58966b3c6cc0f4d374f0808be9e76080 /libs/ardour | |
parent | ab1e2bfaea1157f520f1dfd286df31a20f50b1f0 (diff) |
in compute_gains in case _speakers.n_tuples is 0. Prevent NaN gains if total power is 0 in the same method. Mark initially dirty so that the first call to do_distribute sets up desired_outputs.
git-svn-id: svn://localhost/ardour2/branches/3.0@8218 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/vbap.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libs/ardour/vbap.cc b/libs/ardour/vbap.cc index d727293b05..96fc1336fb 100644 --- a/libs/ardour/vbap.cc +++ b/libs/ardour/vbap.cc @@ -56,7 +56,7 @@ string VBAPanner::name = X_("VBAP"); VBAPanner::VBAPanner (Panner& parent, Evoral::Parameter param, Speakers& s) : StreamPanner (parent, param) - , _dirty (false) + , _dirty (true) , _speakers (VBAPSpeakers::instance (s)) { } @@ -66,12 +66,6 @@ VBAPanner::~VBAPanner () } void -VBAPanner::mark_dirty () -{ - _dirty = true; -} - -void VBAPanner::update () { /* force 2D for now */ @@ -94,13 +88,16 @@ VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele) azi_ele_to_cart (azi,ele, cartdir[0], cartdir[1], cartdir[2]); big_sm_g = -100000.0; + gains[0] = gains[1] = gains[2] = 0; + speaker_ids[0] = speaker_ids[1] = speaker_ids[2] = 0; + for (i = 0; i < _speakers.n_tuples(); i++) { small_g = 10000000.0; for (j = 0; j < _speakers.dimension(); j++) { - gtmp[j]=0.0; + gtmp[j] = 0.0; for (k = 0; k < _speakers.dimension(); k++) { gtmp[j] += cartdir[k] * _speakers.matrix(i)[j*_speakers.dimension()+k]; @@ -133,9 +130,11 @@ VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele) power = sqrt (gains[0]*gains[0] + gains[1]*gains[1] + gains[2]*gains[2]); - gains[0] /= power; - gains[1] /= power; - gains[2] /= power; + if (power > 0) { + gains[0] /= power; + gains[1] /= power; + gains[2] /= power; + } _dirty = false; } |