- if (_panner->empty()) {
- return;
- }
-
- switch (_panner->nouts()) {
- case 0:
- case 1:
- /* relax */
- break;
-
- case 2:
- update_pan_bars (true);
- break;
-
- default:
- //panner->move_puck (pan_value (v, right), 0.5);
- break;
- }
-}
-
-void
-PannerUI::pan_adjustment_changed (uint32_t which)
-{
- if (!in_pan_update && which < _panner->npanners()) {
-
- float val = pan_adjustments[which]->get_value ();
- float const xpos = _panner->pan_control(which)->get_value();
-
- /* add a kinda-sorta detent for the middle */
-
- if (val != 0.5 && Panner::equivalent (val, 0.5)) {
- /* this is going to be reentrant, so just
- return after it.
- */
-
- in_pan_update = true;
- pan_adjustments[which]->set_value (0.5);
- in_pan_update = false;
- return;
- }
-
- if (!Panner::equivalent (val, xpos)) {
-
- _panner->pan_control(which)->set_value (val);
- /* XXX
- the panner objects have no access to the session,
- so do this here. ick.
- */
- _session->set_dirty();
- }
- }
-}
-
-void
-PannerUI::pan_value_changed (uint32_t which)
-{
- ENSURE_GUI_THREAD (*this, &PannerUI::pan_value_changed, which)
-
- if (twod_panner) {
-
- in_pan_update = true;
- twod_panner->move_puck (which, _panner->streampanner(which).get_position());
- in_pan_update = false;
-
- } else if (_panner->npanners() > 0 && which < _panner->npanners()) {
- AngularVector model = _panner->streampanner(which).get_position();
- double fract = pan_adjustments[which]->get_value();
- AngularVector view (BaseStereoPanner::lr_fract_to_azimuth (fract), 0.0);
-
- if (!Panner::equivalent (model, view)) {
- in_pan_update = true;
- pan_adjustments[which]->set_value (BaseStereoPanner::azimuth_to_lr_fract (model.azi));
- in_pan_update = false;
- }
- }
-}
-
-void
-PannerUI::update_pan_bars (bool only_if_aplay)
-{
- uint32_t n;
- vector<Adjustment*>::iterator i;
-
- in_pan_update = true;
-
- /* this runs during automation playback, and moves the bar controllers
- and/or pucks around.
- */
-
- for (i = pan_adjustments.begin(), n = 0; i != pan_adjustments.end(); ++i, ++n) {
-
- if (only_if_aplay) {
- boost::shared_ptr<AutomationList> alist (_panner->streampanner(n).pan_control()->alist());
-
- if (!alist->automation_playback()) {
- continue;
- }
- }
-
- AngularVector model = _panner->streampanner(n).get_effective_position();
- double fract = (*i)->get_value();
- AngularVector view (BaseStereoPanner::lr_fract_to_azimuth (fract), 0.0);
-
- if (!Panner::equivalent (model, view)) {
- (*i)->set_value (BaseStereoPanner::azimuth_to_lr_fract (model.azi));
- }