turn Pan & Gain sliders off

In another thread we touched on disabling the Pan and Gain sliders in a Wavetrack:

Peter 22Nov11: I tansfrerred the FR referenced above to the Wiki Pending Feature Requests - retaining a link there to this page.

So, I pulled just this code out and applied it to today’s SVN HEAD (r11277) and hereafter follows the result…
First, we add two checkboxes to Preferences, add this code after line 92 of GUIPrefs.cpp:

      S.TieCheckBox(_("Disable Gain Slider by default"),
                    wxT("/GUI/DisableGainSlider"),
                    false);
      S.TieCheckBox(_("Disable Pan Slider by default"),
                    wxT("/GUI/DisablePanSlider"),
                    false);

The result is:
newPrefs.png
and the audacity.cfg file has two new lines:
[GUI]
ShowSplashScreen=0
[…]

DisableGainSlider=1
DisablePanSlider=0

[GUI/ToolBars]

If these lines do not exist in the config file the sliders will default to ON contrary to waxcylinder’s desire (that which would result in a regression IMHO).

The rest of the code is in TrackPanel.cpp & TrackPanel.h, in TrackPanel.h after line 426 we add two function definitions:

   void OnToggleGain(wxCommandEvent &event);
   void OnTogglePan(wxCommandEvent &event);

in TrackPanel.cpp we have a few additions and changes; first after line 315 we add:

   OnToggleGainID,
   OnTogglePanID,

and after what is now line 342 we add:

    EVT_MENU(OnToggleGainID, TrackPanel::OnToggleGain)
    EVT_MENU(OnTogglePanID, TrackPanel::OnTogglePan)

then after what is now line 646 we add:

   mWaveTrackMenu->Append(OnToggleGainID, _("Toggle Gain Slider State"));
   mWaveTrackMenu->Append(OnTogglePanID, _("Toggle Pan Slider State"));

Now at what is now line 8196 we completely change these two functions:

LWSlider * TrackInfo::GainSlider(int trackIndex)
{
   LWSlider * returnSlider = mGains[trackIndex - mSliderOffset];
   bool disable;
   gPrefs->Read(wxT("/GUI/DisableGainSlider"), &disable, false);
   returnSlider->SetEnabled(!disable);
   return returnSlider;
}

LWSlider * TrackInfo::PanSlider(int trackIndex)
{
   LWSlider * returnSlider = mPans[trackIndex - mSliderOffset];
   bool disable;
   gPrefs->Read(wxT("/GUI/DisablePanSlider"), &disable, false);
   returnSlider->SetEnabled(!disable);
   return returnSlider;
}

and add two additional (currently broken) functions:

//the following two functions should toggle the active state of the Pan/Gain sliders in responce to 
//the menu items but they do not work as-is
void TrackPanel::OnToggleGain(wxCommandEvent &event)
{
   wxMessageBox(wxT("debug OnToggleGain()"));
   Track * t = GetFocusedTrack();
   if (!t || (t->GetKind() != Track::Wave)) {
      return;
   }
   LWSlider * slider = mTrackInfo.GainSlider(t->GetIndex());
   if (slider->GetEnabled()) slider->SetEnabled(false);
   else slider->SetEnabled(true);
   slider->Refresh();
}

void TrackPanel::OnTogglePan(wxCommandEvent &event)
{
   wxMessageBox(wxT("debug OnTogglePan()"));
   Track * t = GetFocusedTrack();
   if (!t || (t->GetKind() != Track::Wave)) {
      return;
   }
   LWSlider * slider = mTrackInfo.PanSlider(t->GetIndex());
   if (slider->GetEnabled()) slider->SetEnabled(false);
   else slider->SetEnabled(true);
   slider->Refresh();
}

These two last functions are giving me grief! I cannot figure out how to refresh the state of these sliders. The wxMessageBox in each proves we are entering the function. Right now I must change the global state in prefs then do do a copy&paste into a new track. It works but is clunky. Personally, I almost always leave the sliders OFF so the problem does not impact my usage.

Here is the result of turning one slider off in prefs:
combo.png
After looking at these graphics I see I should reverse the order of the checkboxes to reflect the order of the sliders in the panel. I did so in the above example code but did not bother to change the picture. Now everything is “gain on top, pan on bottom”.

Tickle the pan control on a mono show so you now have a Virtual Stereo Show. Now go in and turn panning off, does the show snap back to mono?

If you do have Panning off and start a new show, then that Virtual Stereo business goes away, right?

Koz

I transferred the original FR to the Wiki - but retained this thread here for reference.

WC

I think that is an important consideration. It should not be possible to have an off-centre mono track with no pan slider.