A few cleanups and rearrangements in the RC options. Add options for default mute-affects-* settings, and make routes obey them.

git-svn-id: svn://localhost/ardour2/branches/3.0@7122 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-05-20 01:30:35 +00:00
parent ed74a89820
commit 84a801a791
4 changed files with 210 additions and 143 deletions

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 2001-2009 Paul Davis
This program is free software; you can redistribute it and/or modify
@ -19,13 +19,18 @@
#include <gtkmm/box.h>
#include <gtkmm/alignment.h>
#include "gtkmm2ext/utils.h"
#include "ardour/configuration.h"
#include "ardour/utils.h"
#include "ardour/dB.h"
#include "option_editor.h"
#include "gui_thread.h"
#include "utils.h"
#include "i18n.h"
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR;
void
@ -127,6 +132,65 @@ EntryOption::activated ()
_set (_entry->get_text ());
}
FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t> g, sigc::slot<bool, gain_t> s)
: Option (i, n)
// 0.781787 is the value needed for gain to be set to 0.
, _db_adjustment (0.781787, 0, 1, 0.01, 0.1)
, _get (g)
, _set (s)
{
_pix = ::get_icon (X_("fader_belt_h"));
if (_pix == 0) {
throw failed_constructor ();
}
_db_slider = manage (new HSliderController (_pix,
&_db_adjustment,
115,
false));
_label.set_text (n + ":");
_label.set_name (X_("OptionsLabel"));
_box.set_spacing (4);
_box.pack_start (*_db_slider, false, false);
_box.pack_start (_db_display, false, false);
_box.show_all ();
set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12);
_db_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &FaderOption::db_changed));
}
void
FaderOption::set_state_from_config ()
{
gain_t const val = _get ();
_db_adjustment.set_value (gain_to_slider_position (val));
char buf[16];
if (val == 0.0) {
snprintf (buf, sizeof (buf), "-inf");
} else {
snprintf (buf, sizeof (buf), "%.2f", accurate_coefficient_to_dB (val));
}
_db_display.set_text (buf);
}
void
FaderOption::db_changed ()
{
_set (slider_position_to_gain (_db_adjustment.get_value ()));
}
void
FaderOption::add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, &_label, &_box);
}
OptionEditorPage::OptionEditorPage (Gtk::Notebook& n, std::string const & t)
: table (1, 3)
{
@ -203,6 +267,8 @@ OptionEditor::add_option (std::string const & pn, OptionEditorComponent* o)
_pages[pn] = new OptionEditorPage (_notebook, pn);
}
cout << "add thing to " << pn << "\n";
OptionEditorPage* p = _pages[pn];
p->components.push_back (o);

View File

@ -25,7 +25,9 @@
#include <gtkmm/comboboxtext.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/table.h>
#include "gtkmm2ext/slider_controller.h"
#include "ardour_dialog.h"
#include "ardour/types.h"
/** @file option_editor.h
* @brief Base class for option editing dialog boxes.
@ -106,8 +108,8 @@ protected:
};
/** Base class for components which provide UI to change an option */
class Option : public OptionEditorComponent {
class Option : public OptionEditorComponent
{
public:
/** Construct an Option.
* @param i Option id (e.g. "plugins-stop-with-transport")
@ -141,8 +143,8 @@ private:
};
/** Component which provides the UI to handle a boolean option using a GTK CheckButton */
class BoolOption : public Option {
class BoolOption : public Option
{
public:
BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
@ -159,8 +161,8 @@ private:
};
/** Component which provides the UI to handle a string option using a GTK Entry */
class EntryOption : public Option {
class EntryOption : public Option
{
public:
EntryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>);
@ -182,8 +184,8 @@ private:
* The template parameter is the enumeration.
*/
template <class T>
class ComboOption : public Option {
class ComboOption : public Option
{
public:
/** Construct an ComboOption.
@ -334,6 +336,27 @@ private:
Gtk::SpinButton* _spin;
};
class FaderOption : public Option
{
public:
FaderOption (std::string const &, std::string const &, sigc::slot<ARDOUR::gain_t> g, sigc::slot<bool, ARDOUR::gain_t> s);
void set_state_from_config ();
void add_to_page (OptionEditorPage *);
private:
void db_changed ();
Gtk::Adjustment _db_adjustment;
Gtkmm2ext::HSliderController* _db_slider;
Glib::RefPtr<Gdk::Pixbuf> _pix;
Gtk::Entry _db_display;
Gtk::Label _label;
Gtk::HBox _box;
sigc::slot<ARDOUR::gain_t> _get;
sigc::slot<bool, ARDOUR::gain_t> _set;
};
/** Class to represent a single page in an OptionEditor's notebook.
* Pages are laid out using a 3-column table; the 1st column is used
* to indent non-headings, and the 2nd and 3rd for actual content.

View File

@ -713,82 +713,6 @@ private:
HScale _dpi_slider;
};
class SoloMuteOptions : public OptionEditorBox
{
public:
SoloMuteOptions (RCConfiguration* c) :
_rc_config (c),
// 0.781787 is the value needed for gain to be set to 0.
_db_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
{
if ((pix = ::get_icon ("fader_belt_h")) == 0) {
throw failed_constructor();
}
_db_slider = manage (new HSliderController (pix,
&_db_adjustment,
115,
false));
parameter_changed ("solo-mute-gain");
Label* l = manage (new Label (_("Solo mute cut (dB):")));
l->set_name ("OptionsLabel");
HBox* h = manage (new HBox);
h->set_spacing (4);
h->pack_start (*l, false, false);
h->pack_start (*_db_slider, false, false);
h->pack_start (_db_display, false, false);
h->show_all ();
set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12);
_box->pack_start (*h, false, false);
_db_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &SoloMuteOptions::db_changed));
}
void parameter_changed (string const & p)
{
if (p == "solo-mute-gain") {
gain_t val = _rc_config->get_solo_mute_gain();
_db_adjustment.set_value (gain_to_slider_position (val));
char buf[16];
if (val == 0.0) {
snprintf (buf, sizeof (buf), "-inf");
} else {
snprintf (buf, sizeof (buf), "%.2f", accurate_coefficient_to_dB (val));
}
_db_display.set_text (buf);
}
}
void set_state_from_config ()
{
parameter_changed ("solo-mute-gain");
}
private:
void db_changed ()
{
_rc_config->set_solo_mute_gain (slider_position_to_gain (_db_adjustment.get_value()));
}
RCConfiguration* _rc_config;
Adjustment _db_adjustment;
Gtkmm2ext::HSliderController* _db_slider;
Glib::RefPtr<Gdk::Pixbuf> pix;
Entry _db_display;
};
class ControlSurfacesOptions : public OptionEditorBox
{
public:
@ -1024,6 +948,10 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_name_new_markers)
));
add_option (_("Misc"), new OptionEditorHeading (_("Click")));
add_option (_("Misc"), new ClickOptions (_rc_config, this));
/* TRANSPORT */
add_option (_("Transport"),
@ -1174,53 +1102,6 @@ RCOptionEditor::RCOptionEditor ()
/* AUDIO */
add_option (_("Audio"), new OptionEditorHeading (_("Solo")));
add_option (_("Audio"),
new BoolOption (
"solo-control-is-listen-control",
_("Solo controls are Listen controls"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_control_is_listen_control),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_control_is_listen_control)
));
ComboOption<ListenPosition>* lp = new ComboOption<ListenPosition> (
"listen-position",
_("Listen Position"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_listen_position),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_listen_position)
);
lp->add (AfterFaderListen, _("after-fader listen"));
lp->add (PreFaderListen, _("pre-fader listen"));
add_option (_("Audio"), lp);
add_option (_("Audio"), new SoloMuteOptions (_rc_config));
add_option (_("Audio"),
new BoolOption (
"exclusive-solo",
_("Exclusive solo"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_exclusive_solo),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_exclusive_solo)
));
add_option (_("Audio"),
new BoolOption (
"show-solo-mutes",
_("Show solo muting"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_solo_mutes),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_solo_mutes)
));
add_option (_("Audio"),
new BoolOption (
"solo-mute-override",
_("Soloing overrides muting"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_override),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_override)
));
add_option (_("Audio"), new OptionEditorHeading (_("Monitoring")));
add_option (_("Audio"),
@ -1361,6 +1242,96 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
));
/* SOLO AND MUTE */
cout << "FUCK: " << _rc_config->get_solo_mute_gain() << "\n";
add_option (_("Solo / mute"),
new FaderOption (
"solo-mute-gain",
_("Solo mute cut (dB)"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_gain),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_gain)
));
add_option (_("Solo / mute"),
new BoolOption (
"solo-control-is-listen-control",
_("Solo controls are Listen controls"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_control_is_listen_control),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_control_is_listen_control)
));
ComboOption<ListenPosition>* lp = new ComboOption<ListenPosition> (
"listen-position",
_("Listen Position"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_listen_position),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_listen_position)
);
lp->add (AfterFaderListen, _("after-fader listen"));
lp->add (PreFaderListen, _("pre-fader listen"));
add_option (_("Solo / mute"), lp);
add_option (_("Solo / mute"),
new BoolOption (
"exclusive-solo",
_("Exclusive solo"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_exclusive_solo),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_exclusive_solo)
));
add_option (_("Solo / mute"),
new BoolOption (
"show-solo-mutes",
_("Show solo muting"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_solo_mutes),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_solo_mutes)
));
add_option (_("Solo / mute"),
new BoolOption (
"solo-mute-override",
_("Soloing overrides muting"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_override),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_override)
));
add_option (_("Solo / mute"), new OptionEditorHeading (_("Default track / bus muting options")));
add_option (_("Solo / mute"),
new BoolOption (
"mute-affects-pre-fader",
_("Mute affects pre-fader sends"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_pre_fader),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_pre_fader)
));
add_option (_("Solo / mute"),
new BoolOption (
"mute-affects-post-fader",
_("Mute affects post-fader sends"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_post_fader),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_post_fader)
));
add_option (_("Solo / mute"),
new BoolOption (
"mute-affects-control-outs",
_("Mute affects control outputs"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_control_outs),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_control_outs)
));
add_option (_("Solo / mute"),
new BoolOption (
"mute-affects-main-outs",
_("Mute affects main outputs"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_main_outs),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_main_outs)
));
/* MIDI CONTROL */
list<ComboOption<string>* > midi_combos;
@ -1476,10 +1447,6 @@ RCOptionEditor::RCOptionEditor ()
add_option (_("Control surfaces"), rm);
/* CLICK */
add_option (_("Click"), new ClickOptions (_rc_config, this));
/* KEYBOARD */
add_option (_("Keyboard"), new KeyboardOptions);

View File

@ -30,18 +30,29 @@
using namespace ARDOUR;
using namespace std;
const MuteMaster::MutePoint MuteMaster::AllPoints = MutePoint (MuteMaster::PreFader|
MuteMaster::PostFader|
MuteMaster::Listen|
MuteMaster::Main);
MuteMaster::MuteMaster (Session& s, const std::string&)
: SessionHandleRef (s)
, _mute_point (AllPoints)
: SessionHandleRef (s)
, _mute_point (MutePoint (0))
, _muted_by_self (false)
, _soloed (false)
, _solo_ignore (false)
{
if (Config->get_mute_affects_pre_fader ()) {
_mute_point = MutePoint (_mute_point | PreFader);
}
if (Config->get_mute_affects_post_fader ()) {
_mute_point = MutePoint (_mute_point | PostFader);
}
if (Config->get_mute_affects_control_outs ()) {
_mute_point = MutePoint (_mute_point | Listen);
}
if (Config->get_mute_affects_main_outs ()) {
_mute_point = MutePoint (_mute_point | Main);
}
}
void