Various fixes to multiple-2D panner signal handling. Should fix some or all of #1632.

git-svn-id: svn://localhost/ardour2/branches/3.0@7037 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-05-02 01:33:25 +00:00
parent 13003cd9d9
commit 0d0e32d8b3
5 changed files with 31 additions and 25 deletions

View File

@ -111,20 +111,11 @@ Panner2d::reset (uint32_t n_inputs)
case 1:
pucks[0]->set_text ("");
pucks[0]->x.set_value (0.0);
pucks[0]->y.set_value (0.5);
pucks[0]->visible = true;
break;
case 2:
pucks[0]->set_text ("R");
pucks[0]->visible = true;
pucks[1]->set_text ("L");
if (existing_pucks < 2) {
pucks[1]->x.set_value (0.25f);
pucks[1]->y.set_value (0.5f);
}
pucks[1]->visible = true;
break;
default:
@ -132,19 +123,18 @@ Panner2d::reset (uint32_t n_inputs)
char buf[64];
snprintf (buf, sizeof (buf), "%" PRIu32, i);
pucks[i]->set_text (buf);
if (existing_pucks < i) {
float x, y;
panner->streampanner (i).get_position (x, y);
pucks[i]->x.set_value (x);
pucks[i]->y.set_value (y);
}
pucks[i]->visible = true;
}
break;
}
for (uint32_t i = existing_pucks; i < n_inputs; ++i) {
float x, y;
panner->streampanner (i).get_position (x, y);
pucks[i]->x.set_value (x);
pucks[i]->y.set_value (y);
pucks[i]->visible = true;
}
/* add all outputs */
while (targets.size() < panner->nouts()) {

View File

@ -155,10 +155,6 @@ PannerUI::set_panner (boost::shared_ptr<Panner> p)
_panner->LinkStateChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::update_pan_linkage, this), gui_context());
_panner->StateChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::update_pan_state, this), gui_context());
for (uint32_t i = 0; i < _panner->npanners(); ++i) {
connect_to_pan_control (i);
}
setup_pan ();
pan_changed (0);
@ -334,6 +330,11 @@ PannerUI::setup_pan ()
return;
}
_pan_control_connections.drop_connections ();
for (uint32_t i = 0; i < _panner->npanners(); ++i) {
connect_to_pan_control (i);
}
_current_nouts = nouts;
_current_npans = npans;
@ -646,7 +647,17 @@ PannerUI::pan_value_changed (uint32_t which)
{
ENSURE_GUI_THREAD (*this, &PannerUI::pan_value_changed, which)
if (_panner->npanners() > 0 && which < _panner->npanners()) {
if (twod_panner) {
float x;
float y;
_panner->streampanner(which).get_position (x, y);
in_pan_update = true;
twod_panner->move_puck (which, x, y);
in_pan_update = false;
} else if (_panner->npanners() > 0 && which < _panner->npanners()) {
float xpos;
float val = pan_adjustments[which]->get_value ();
@ -891,5 +902,7 @@ PannerUI::set_mono (bool yn)
void
PannerUI::connect_to_pan_control (uint32_t i)
{
_panner->pan_control(i)->Changed.connect (connections, invalidator (*this), boost::bind (&PannerUI::pan_value_changed, this, i), gui_context ());
_panner->pan_control(i)->Changed.connect (
_pan_control_connections, invalidator (*this), boost::bind (&PannerUI::pan_value_changed, this, i), gui_context ()
);
}

View File

@ -83,6 +83,7 @@ class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
boost::shared_ptr<ARDOUR::Panner> _panner;
PBD::ScopedConnectionList connections;
PBD::ScopedConnectionList _pan_control_connections;
bool ignore_toggle;
bool in_pan_update;

View File

@ -267,7 +267,7 @@ public:
StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; }
uint32_t npanners() const { return _streampanners.size(); }
PBD::Signal0<void> Changed;
PBD::Signal0<void> Changed; /* panner and/or outputs count changed */
PBD::Signal0<void> LinkStateChanged;
PBD::Signal0<void> StateChanged; /* for bypass */

View File

@ -148,6 +148,7 @@ StreamPanner::set_position (float xpos, float ypos, bool link_call)
_y = ypos;
update ();
Changed ();
_control->Changed ();
}
}
@ -164,6 +165,7 @@ StreamPanner::set_position (float xpos, float ypos, float zpos, bool link_call)
_z = zpos;
update ();
Changed ();
_control->Changed ();
}
}