13
0

First stage of options rework.

- Split Configuration into RCConfiguration and SessionConfiguration;
the first for options which are saved to .rc files and the second
for options which are saved in a session file.

- Move some options from the old `master' Configuration object into
SessionConfiguration; this needs more refinement.

- Reflect many RCConfiguration options in an expanded Edit->Preferences
dialog; my intention is to remove the corresponding menu items
eventually.



git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-05-14 00:13:27 +00:00
parent 0569107ddc
commit 015fc7b39f
65 changed files with 848 additions and 2414 deletions

2
.gitignore vendored
View File

@ -29,6 +29,8 @@ gtk2_ardour/ergonomic-us.bindings
gtk2_ardour/mnemonic-us.bindings
gtk2_ardour/version.cc
gtk2_ardour/version.h
gtk2_ardour/test/*.cpp
gtk2_ardour/test/test_ui_config
libs/ardour/ardour/version.h
libs/ardour/svn_revision.cc
libs/ardour/version.cc

View File

@ -34,6 +34,7 @@
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
#include "ardour/rc_configuration.h"
#include "actions.h"
#include "i18n.h"
@ -359,7 +360,7 @@ ActionManager::uncheck_toggleaction (const char * name)
* @param Method to get the state of the Configuration setting.
*/
void
ActionManager::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const)
ActionManager::toggle_config_state (const char* group, const char* action, bool (RCConfiguration::*set)(bool), bool (RCConfiguration::*get)(void) const)
{
Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
if (act) {
@ -376,13 +377,16 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool
}
void
ActionManager::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot)
ActionManager::toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool> set, sigc::slot<bool> get)
{
Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
if (tact->get_active()) {
theSlot ();
bool const x = get ();
if (x != tact->get_active ()) {
set (x);
}
}
}
}
@ -394,7 +398,7 @@ ActionManager::toggle_config_state (const char* group, const char* action, sigc:
* @param get Method to obtain the state that the ToggleAction should have.
*/
void
ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const)
ActionManager::map_some_state (const char* group, const char* action, bool (RCConfiguration::*get)() const)
{
Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
if (act) {
@ -414,3 +418,21 @@ ActionManager::map_some_state (const char* group, const char* action, bool (Conf
cerr << group << ':' << action << " not an action\n";
}
}
void
ActionManager::map_some_state (const char* group, const char* action, sigc::slot<bool> get)
{
Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
if (tact) {
bool const x = get ();
if (tact->get_active() != x) {
tact->set_active (x);
}
}
}
}

View File

@ -27,7 +27,7 @@
#include <gtkmm/actiongroup.h>
#include <gtkmm/accelkey.h>
#include "ardour/configuration.h"
#include "ardour/rc_configuration.h"
namespace Gtk {
class UIManager;
@ -59,9 +59,10 @@ class ActionManager
static std::vector<Glib::RefPtr<Gtk::Action> > jack_opposite_sensitive_actions;
static std::vector<Glib::RefPtr<Gtk::Action> > edit_point_in_region_sensitive_actions;
static void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const);
static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::Configuration::*set)(bool), bool (ARDOUR::Configuration::*get)(void) const);
static void toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot);
static void map_some_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*get)() const);
static void map_some_state (const char* group, const char* action, sigc::slot<bool>);
static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*set)(bool), bool (ARDOUR::RCConfiguration::*get)(void) const);
static void toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool>, sigc::slot<bool>);
static void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);

View File

@ -198,7 +198,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
_will_create_new_session_automatically = false;
add_route_dialog = 0;
route_params = 0;
option_editor = 0;
rc_option_editor = 0;
location_ui = 0;
open_session_selector = 0;
have_configure_timeout = false;
@ -252,7 +252,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
}
setup_gtk_ardour_enums ();
Config->set_current_owner (ConfigVariableBase::Interface);
setup_profile ();
GainMeter::setup_slider_pix ();
@ -361,10 +360,6 @@ ARDOUR_UI::post_engine ()
blink_timeout_tag = -1;
/* the global configuration object is now valid */
use_config ();
/* this being a GUI and all, we want peakfiles */
AudioFileSource::set_build_peakfiles (true);
@ -655,6 +650,8 @@ ARDOUR_UI::startup ()
exit (1);
}
use_config ();
goto_editor_window ();
BootMessage (_("Ardour is ready for use"));
@ -2466,8 +2463,6 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
connect_to_session (new_session);
Config->set_current_owner (ConfigVariableBase::Interface);
session_loaded = true;
goto_editor_window ();
@ -3172,7 +3167,9 @@ ARDOUR_UI::use_config ()
{
Glib::RefPtr<Action> act;
switch (Config->get_native_file_data_format ()) {
assert (session);
switch (session->config.get_native_file_data_format ()) {
case FormatFloat:
act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
break;
@ -3189,7 +3186,7 @@ ARDOUR_UI::use_config ()
ract->set_active ();
}
switch (Config->get_native_file_header_format ()) {
switch (session->config.get_native_file_header_format ()) {
case BWF:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
break;

View File

@ -60,7 +60,6 @@
#include <gtkmm2ext/bindable_button.h>
#include "ardour/ardour.h"
#include "ardour/session.h"
#include "ardour/configuration.h"
#include "ardour/types.h"
#include "audio_clock.h"
@ -71,7 +70,7 @@
class AudioClock;
class PublicEditor;
class Keyboard;
class OptionEditor;
class RCOptionEditor;
class KeyEditor;
class Mixer_UI;
class ConnectionEditor;
@ -257,7 +256,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_session_auto_loop ();
void toggle_options_window ();
void toggle_rc_options_window ();
private:
ArdourStartup* _startup;
@ -597,9 +596,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
KeyEditor *key_editor;
/* Options window */
/* RC Options window */
OptionEditor *option_editor;
RCOptionEditor *rc_option_editor;
/* route dialog */

View File

@ -664,7 +664,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
shuttle_grabbed = false;
shuttle_box.remove_modal_grab ();
if (Config->get_shuttle_behaviour() == Sprung) {
if (Config->get_auto_play() || roll_button.get_visual_state()) {
if (session->config.get_auto_play() || roll_button.get_visual_state()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1;
session->request_transport_speed (1.0);
stop_button.set_visual_state (0);

View File

@ -29,7 +29,7 @@
#include "ardour_ui.h"
#include "location_ui.h"
#include "mixer_ui.h"
#include "option_editor.h"
#include "rc_option_editor.h"
#include "public_editor.h"
#include "route_params_ui.h"
#include "sfdb_ui.h"
@ -99,10 +99,6 @@ ARDOUR_UI::connect_to_session (Session *s)
route_params->set_session (s);
}
if (option_editor) {
option_editor->set_session (s);
}
setup_session_options ();
Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink));
@ -202,10 +198,6 @@ ARDOUR_UI::unload_session (bool hide_stuff)
preroll_clock.set_session (0);
postroll_clock.set_session (0);
if (option_editor) {
option_editor->set_session (0);
}
delete session;
session = 0;
@ -231,12 +223,12 @@ ARDOUR_UI::toggle_big_clock_window ()
}
void
ARDOUR_UI::toggle_options_window ()
ARDOUR_UI::toggle_rc_options_window ()
{
if (option_editor == 0) {
option_editor = new OptionEditor (*this, *editor, *mixer);
option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
option_editor->set_session (session);
if (rc_option_editor == 0) {
rc_option_editor = new RCOptionEditor;
rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
rc_option_editor->set_session (session);
}
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleOptionsEditor"));
@ -244,10 +236,10 @@ ARDOUR_UI::toggle_options_window ()
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
if (tact->get_active()) {
option_editor->show_all ();
option_editor->present ();
rc_option_editor->show_all ();
rc_option_editor->present ();
} else {
option_editor->hide ();
rc_option_editor->hide ();
}
}
}

View File

@ -202,7 +202,7 @@ ARDOUR_UI::install_actions ()
ActionManager::register_action (common_actions, X_("goto-editor"), _("Show Editor"), mem_fun(*this, &ARDOUR_UI::goto_editor_window));
ActionManager::register_action (common_actions, X_("goto-mixer"), _("Show Mixer"), mem_fun(*this, &ARDOUR_UI::goto_mixer_window));
ActionManager::register_action (common_actions, X_("toggle-editor-mixer-on-top"), _("Toggle Editor Mixer on Top"), mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer_on_top));
ActionManager::register_toggle_action (common_actions, X_("ToggleOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_options_window));
ActionManager::register_toggle_action (common_actions, X_("ToggleOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Track/Bus Inspector"), mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::session_sensitive_actions.push_back (act);
@ -425,8 +425,8 @@ ARDOUR_UI::install_actions ()
Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Percentage)));
shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Semitones)));
shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (bind (mem_fun (*Config, &RCConfiguration::set_shuttle_units), Percentage)));
shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (bind (mem_fun (*Config, &RCConfiguration::set_shuttle_units), Semitones)));
Glib::RefPtr<ActionGroup> option_actions = ActionGroup::create ("options");

View File

@ -46,55 +46,55 @@ using namespace sigc;
void
ARDOUR_UI::toggle_time_master ()
{
ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master);
ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &RCConfiguration::set_jack_time_master, &RCConfiguration::get_jack_time_master);
}
void
ARDOUR_UI::toggle_send_mtc ()
{
ActionManager::toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc);
ActionManager::toggle_config_state ("options", "SendMTC", &RCConfiguration::set_send_mtc, &RCConfiguration::get_send_mtc);
}
void
ARDOUR_UI::toggle_send_mmc ()
{
ActionManager::toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc);
ActionManager::toggle_config_state ("options", "SendMMC", &RCConfiguration::set_send_mmc, &RCConfiguration::get_send_mmc);
}
void
ARDOUR_UI::toggle_send_midi_clock ()
{
ActionManager::toggle_config_state ("options", "SendMidiClock", &Configuration::set_send_midi_clock, &Configuration::get_send_midi_clock);
ActionManager::toggle_config_state ("options", "SendMidiClock", &RCConfiguration::set_send_midi_clock, &RCConfiguration::get_send_midi_clock);
}
void
ARDOUR_UI::toggle_use_mmc ()
{
ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
ActionManager::toggle_config_state ("options", "UseMMC", &RCConfiguration::set_mmc_control, &RCConfiguration::get_mmc_control);
}
void
ARDOUR_UI::toggle_use_osc ()
{
ActionManager::toggle_config_state ("options", "UseOSC", &Configuration::set_use_osc, &Configuration::get_use_osc);
ActionManager::toggle_config_state ("options", "UseOSC", &RCConfiguration::set_use_osc, &RCConfiguration::get_use_osc);
}
void
ARDOUR_UI::toggle_send_midi_feedback ()
{
ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback);
ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &RCConfiguration::set_midi_feedback, &RCConfiguration::get_midi_feedback);
}
void
ARDOUR_UI::toggle_denormal_protection ()
{
ActionManager::toggle_config_state ("options", "DenormalProtection", &Configuration::set_denormal_protection, &Configuration::get_denormal_protection);
ActionManager::toggle_config_state ("options", "DenormalProtection", &RCConfiguration::set_denormal_protection, &RCConfiguration::get_denormal_protection);
}
void
ARDOUR_UI::toggle_only_copy_imported_files ()
{
ActionManager::toggle_config_state ("options", "OnlyCopyImportedFiles", &Configuration::set_only_copy_imported_files, &Configuration::get_only_copy_imported_files);
ActionManager::toggle_config_state ("options", "OnlyCopyImportedFiles", &RCConfiguration::set_only_copy_imported_files, &RCConfiguration::get_only_copy_imported_files);
}
@ -134,8 +134,8 @@ ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
Config->set_native_file_header_format (hf);
if (ract && ract->get_active() && session->config.get_native_file_header_format() != hf) {
session->config.set_native_file_header_format (hf);
}
}
}
@ -164,8 +164,8 @@ ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
Config->set_native_file_data_format (sf);
if (ract && ract->get_active() && session->config.get_native_file_data_format() != sf) {
session->config.set_native_file_data_format (sf);
}
}
}
@ -360,25 +360,25 @@ ARDOUR_UI::set_denormal_model (DenormalModel model)
void
ARDOUR_UI::toggle_auto_input ()
{
ActionManager::toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input);
ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", mem_fun (session->config, &SessionConfiguration::set_auto_input), mem_fun (session->config, &SessionConfiguration::get_auto_input));
}
void
ARDOUR_UI::toggle_auto_play ()
{
ActionManager::toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play);
ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", mem_fun (session->config, &SessionConfiguration::set_auto_play), mem_fun (session->config, &SessionConfiguration::get_auto_play));
}
void
ARDOUR_UI::toggle_auto_return ()
{
ActionManager::toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return);
ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", mem_fun (session->config, &SessionConfiguration::set_auto_return), mem_fun (session->config, &SessionConfiguration::get_auto_return));
}
void
ARDOUR_UI::toggle_click ()
{
ActionManager::toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking);
ActionManager::toggle_config_state ("Transport", "ToggleClick", &RCConfiguration::set_clicking, &RCConfiguration::get_clicking);
}
void
@ -446,13 +446,13 @@ ARDOUR_UI::toggle_punch ()
void
ARDOUR_UI::toggle_punch_in ()
{
ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
ActionManager::toggle_config_state_foo ("Transport", "TogglePunchIn", mem_fun (session->config, &SessionConfiguration::set_punch_in), mem_fun (session->config, &SessionConfiguration::get_punch_in));
}
void
ARDOUR_UI::toggle_punch_out ()
{
ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
ActionManager::toggle_config_state_foo ("Transport", "TogglePunchOut", mem_fun (session->config, &SessionConfiguration::set_punch_out), mem_fun (session->config, &SessionConfiguration::get_punch_out));
}
void
@ -482,139 +482,139 @@ ARDOUR_UI::toggle_editing_space()
void
ARDOUR_UI::toggle_new_plugins_active ()
{
ActionManager::toggle_config_state ("options", "NewPluginsActive", &Configuration::set_new_plugins_active, &Configuration::get_new_plugins_active);
ActionManager::toggle_config_state ("options", "NewPluginsActive", &RCConfiguration::set_new_plugins_active, &RCConfiguration::get_new_plugins_active);
}
void
ARDOUR_UI::toggle_StopPluginsWithTransport()
{
ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport);
ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &RCConfiguration::set_plugins_stop_with_transport, &RCConfiguration::get_plugins_stop_with_transport);
}
void
ARDOUR_UI::toggle_LatchedRecordEnable()
{
ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable);
ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &RCConfiguration::set_latched_record_enable, &RCConfiguration::get_latched_record_enable);
}
void
ARDOUR_UI::toggle_RegionEquivalentsOverlap()
{
ActionManager::toggle_config_state ("options", "RegionEquivalentsOverlap", &Configuration::set_use_overlap_equivalency, &Configuration::get_use_overlap_equivalency);
ActionManager::toggle_config_state ("options", "RegionEquivalentsOverlap", &RCConfiguration::set_use_overlap_equivalency, &RCConfiguration::get_use_overlap_equivalency);
}
void
ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording()
{
ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins);
ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &RCConfiguration::set_do_not_record_plugins, &RCConfiguration::get_do_not_record_plugins);
}
void
ARDOUR_UI::toggle_VerifyRemoveLastCapture()
{
ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &RCConfiguration::set_verify_remove_last_capture, &RCConfiguration::get_verify_remove_last_capture);
}
void
ARDOUR_UI::toggle_PeriodicSafetyBackups()
{
ActionManager::toggle_config_state ("options", "PeriodicSafetyBackups", &Configuration::set_periodic_safety_backups, &Configuration::get_periodic_safety_backups);
ActionManager::toggle_config_state ("options", "PeriodicSafetyBackups", &RCConfiguration::set_periodic_safety_backups, &RCConfiguration::get_periodic_safety_backups);
}
void
ARDOUR_UI::toggle_StopRecordingOnXrun()
{
ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun);
ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &RCConfiguration::set_stop_recording_on_xrun, &RCConfiguration::get_stop_recording_on_xrun);
}
void
ARDOUR_UI::toggle_CreateXrunMarker()
{
ActionManager::toggle_config_state ("options", "CreateXrunMarker", &Configuration::set_create_xrun_marker, &Configuration::get_create_xrun_marker);
ActionManager::toggle_config_state ("options", "CreateXrunMarker", &RCConfiguration::set_create_xrun_marker, &RCConfiguration::get_create_xrun_marker);
}
void
ARDOUR_UI::toggle_sync_order_keys ()
{
ActionManager::toggle_config_state ("options", "SyncEditorAndMixerTrackOrder", &Configuration::set_sync_all_route_ordering, &Configuration::get_sync_all_route_ordering);
ActionManager::toggle_config_state ("options", "SyncEditorAndMixerTrackOrder", &RCConfiguration::set_sync_all_route_ordering, &RCConfiguration::get_sync_all_route_ordering);
}
void
ARDOUR_UI::toggle_StopTransportAtEndOfSession()
{
ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end);
ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &RCConfiguration::set_stop_at_session_end, &RCConfiguration::get_stop_at_session_end);
}
void
ARDOUR_UI::toggle_GainReduceFastTransport()
{
ActionManager::toggle_config_state ("options", "GainReduceFastTransport", &Configuration::set_quieten_at_speed, &Configuration::get_quieten_at_speed);
ActionManager::toggle_config_state ("options", "GainReduceFastTransport", &RCConfiguration::set_quieten_at_speed, &RCConfiguration::get_quieten_at_speed);
}
void
ARDOUR_UI::toggle_LatchedSolo()
{
ActionManager::toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched);
ActionManager::toggle_config_state ("options", "LatchedSolo", &RCConfiguration::set_solo_latched, &RCConfiguration::get_solo_latched);
}
void
ARDOUR_UI::toggle_ShowSoloMutes()
{
ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes);
ActionManager::toggle_config_state ("options", "ShowSoloMutes", &RCConfiguration::set_show_solo_mutes, &RCConfiguration::get_show_solo_mutes);
}
void
ARDOUR_UI::toggle_SoloMuteOverride()
{
ActionManager::toggle_config_state ("options", "SoloMuteOverride", &Configuration::set_solo_mute_override, &Configuration::get_solo_mute_override);
ActionManager::toggle_config_state ("options", "SoloMuteOverride", &RCConfiguration::set_solo_mute_override, &RCConfiguration::get_solo_mute_override);
}
void
ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor()
{
ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::set_primary_clock_delta_edit_cursor, &Configuration::get_primary_clock_delta_edit_cursor);
ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &RCConfiguration::set_primary_clock_delta_edit_cursor, &RCConfiguration::get_primary_clock_delta_edit_cursor);
}
void
ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor()
{
ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::set_secondary_clock_delta_edit_cursor, &Configuration::get_secondary_clock_delta_edit_cursor);
ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &RCConfiguration::set_secondary_clock_delta_edit_cursor, &RCConfiguration::get_secondary_clock_delta_edit_cursor);
}
void
ARDOUR_UI::toggle_ShowTrackMeters()
{
ActionManager::toggle_config_state ("options", "ShowTrackMeters", &Configuration::set_show_track_meters, &Configuration::get_show_track_meters);
ActionManager::toggle_config_state ("options", "ShowTrackMeters", &RCConfiguration::set_show_track_meters, &RCConfiguration::get_show_track_meters);
}
void
ARDOUR_UI::toggle_TapeMachineMode ()
{
ActionManager::toggle_config_state ("options", "ToggleTapeMachineMode", &Configuration::set_tape_machine_mode, &Configuration::get_tape_machine_mode);
ActionManager::toggle_config_state ("options", "ToggleTapeMachineMode", &RCConfiguration::set_tape_machine_mode, &RCConfiguration::get_tape_machine_mode);
}
void
ARDOUR_UI::toggle_use_narrow_ms()
{
ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &Configuration::set_default_narrow_ms, &Configuration::get_default_narrow_ms);
ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &RCConfiguration::set_default_narrow_ms, &RCConfiguration::get_default_narrow_ms);
}
void
ARDOUR_UI::toggle_NameNewMarkers()
{
ActionManager::toggle_config_state ("options", "NameNewMarkers", &Configuration::set_name_new_markers, &Configuration::get_name_new_markers);
ActionManager::toggle_config_state ("options", "NameNewMarkers", &RCConfiguration::set_name_new_markers, &RCConfiguration::get_name_new_markers);
}
void
ARDOUR_UI::toggle_rubberbanding_snaps_to_grid ()
{
ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &Configuration::set_rubberbanding_snaps_to_grid, &Configuration::get_rubberbanding_snaps_to_grid);
ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &RCConfiguration::set_rubberbanding_snaps_to_grid, &RCConfiguration::get_rubberbanding_snaps_to_grid);
}
void
ARDOUR_UI::toggle_auto_analyse_audio ()
{
ActionManager::toggle_config_state ("options", "AutoAnalyseAudio", &Configuration::set_auto_analyse_audio, &Configuration::get_auto_analyse_audio);
ActionManager::toggle_config_state ("options", "AutoAnalyseAudio", &RCConfiguration::set_auto_analyse_audio, &RCConfiguration::get_auto_analyse_audio);
}
void
@ -784,7 +784,7 @@ ARDOUR_UI::map_file_header_format ()
{
const char* action = 0;
switch (Config->get_native_file_header_format()) {
switch (session->config.get_native_file_header_format()) {
case BWF:
action = X_("FileHeaderFormatBWF");
break;
@ -811,7 +811,7 @@ ARDOUR_UI::map_file_header_format ()
default:
fatal << string_compose (_("programming error: unknown file header format passed to ARDOUR_UI::map_file_data_format: %1"),
Config->get_native_file_header_format()) << endmsg;
session->config.get_native_file_header_format()) << endmsg;
/*NOTREACHED*/
}
@ -832,7 +832,7 @@ ARDOUR_UI::map_file_data_format ()
{
const char* action = 0;
switch (Config->get_native_file_data_format()) {
switch (session->config.get_native_file_data_format()) {
case FormatFloat:
action = X_("FileDataFormatFloat");
break;
@ -847,7 +847,7 @@ ARDOUR_UI::map_file_data_format ()
default:
fatal << string_compose (_("programming error: unknown file data format passed to ARDOUR_UI::map_file_data_format: %1"),
Config->get_native_file_data_format()) << endmsg;
session->config.get_native_file_data_format()) << endmsg;
/*NOTREACHED*/
}
@ -1100,11 +1100,11 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
} else if (PARAM_IS ("send-mtc")) {
ActionManager::map_some_state ("options", "SendMTC", &Configuration::get_send_mtc);
ActionManager::map_some_state ("options", "SendMTC", &RCConfiguration::get_send_mtc);
} else if (PARAM_IS ("send-mmc")) {
ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
ActionManager::map_some_state ("options", "SendMMC", &RCConfiguration::get_send_mmc);
} else if (PARAM_IS ("use-osc")) {
@ -1116,64 +1116,64 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
}
#endif
ActionManager::map_some_state ("options", "UseOSC", &Configuration::get_use_osc);
ActionManager::map_some_state ("options", "UseOSC", &RCConfiguration::get_use_osc);
} else if (PARAM_IS ("mmc-control")) {
ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
ActionManager::map_some_state ("options", "UseMMC", &RCConfiguration::get_mmc_control);
} else if (PARAM_IS ("midi-feedback")) {
ActionManager::map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback);
ActionManager::map_some_state ("options", "SendMIDIfeedback", &RCConfiguration::get_midi_feedback);
} else if (PARAM_IS ("do-not-record-plugins")) {
ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &RCConfiguration::get_do_not_record_plugins);
} else if (PARAM_IS ("latched-record-enable")) {
ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
} else if (PARAM_IS ("solo-latched")) {
ActionManager::map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
ActionManager::map_some_state ("options", "LatchedSolo", &RCConfiguration::get_solo_latched);
} else if (PARAM_IS ("show-solo-mutes")) {
ActionManager::map_some_state ("options", "ShowSoloMutes", &Configuration::get_show_solo_mutes);
ActionManager::map_some_state ("options", "ShowSoloMutes", &RCConfiguration::get_show_solo_mutes);
} else if (PARAM_IS ("solo-mute-override")) {
ActionManager::map_some_state ("options", "SoloMuteOverride", &Configuration::get_solo_mute_override);
ActionManager::map_some_state ("options", "SoloMuteOverride", &RCConfiguration::get_solo_mute_override);
} else if (PARAM_IS ("solo-model")) {
map_solo_model ();
} else if (PARAM_IS ("auto-play")) {
ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play);
ActionManager::map_some_state ("Transport", "ToggleAutoPlay", mem_fun (session->config, &SessionConfiguration::get_auto_play));
} else if (PARAM_IS ("auto-return")) {
ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return);
ActionManager::map_some_state ("Transport", "ToggleAutoReturn", mem_fun (session->config, &SessionConfiguration::get_auto_return));
} else if (PARAM_IS ("auto-input")) {
ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input);
ActionManager::map_some_state ("Transport", "ToggleAutoInput", mem_fun (session->config, &SessionConfiguration::get_auto_input));
} else if (PARAM_IS ("tape-machine-mode")) {
ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &Configuration::get_tape_machine_mode);
ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &RCConfiguration::get_tape_machine_mode);
} else if (PARAM_IS ("punch-out")) {
ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out);
if (!Config->get_punch_out()) {
ActionManager::map_some_state ("Transport", "TogglePunchOut", mem_fun (session->config, &SessionConfiguration::get_punch_out));
if (!session->config.get_punch_out()) {
unset_dual_punch ();
}
} else if (PARAM_IS ("punch-in")) {
ActionManager::map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in);
if (!Config->get_punch_in()) {
ActionManager::map_some_state ("Transport", "TogglePunchIn", mem_fun (session->config, &SessionConfiguration::get_punch_in));
if (!session->config.get_punch_in()) {
unset_dual_punch ();
}
} else if (PARAM_IS ("clicking")) {
ActionManager::map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking);
ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
} else if (PARAM_IS ("jack-time-master")) {
ActionManager::map_some_state ("Transport", "ToggleTimeMaster", &Configuration::get_jack_time_master);
ActionManager::map_some_state ("Transport", "ToggleTimeMaster", &RCConfiguration::get_jack_time_master);
} else if (PARAM_IS ("plugins-stop-with-transport")) {
ActionManager::map_some_state ("options", "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
ActionManager::map_some_state ("options", "StopPluginsWithTransport", &RCConfiguration::get_plugins_stop_with_transport);
} else if (PARAM_IS ("new-plugins-active")) {
ActionManager::map_some_state ("options", "NewPluginsActive", &Configuration::get_new_plugins_active);
ActionManager::map_some_state ("options", "NewPluginsActive", &RCConfiguration::get_new_plugins_active);
} else if (PARAM_IS ("latched-record-enable")) {
ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
} else if (PARAM_IS ("verify-remove-last-capture")) {
ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &RCConfiguration::get_verify_remove_last_capture);
} else if (PARAM_IS ("periodic-safety-backups")) {
ActionManager::map_some_state ("options", "PeriodicSafetyBackups", &Configuration::get_periodic_safety_backups);
ActionManager::map_some_state ("options", "PeriodicSafetyBackups", &RCConfiguration::get_periodic_safety_backups);
} else if (PARAM_IS ("stop-recording-on-xrun")) {
ActionManager::map_some_state ("options", "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
ActionManager::map_some_state ("options", "StopRecordingOnXrun", &RCConfiguration::get_stop_recording_on_xrun);
} else if (PARAM_IS ("create-xrun-marker")) {
ActionManager::map_some_state ("options", "CreateXrunMarker", &Configuration::get_create_xrun_marker);
ActionManager::map_some_state ("options", "CreateXrunMarker", &RCConfiguration::get_create_xrun_marker);
} else if (PARAM_IS ("sync-all-route-ordering")) {
ActionManager::map_some_state ("options", "SyncEditorAndMixerTrackOrder", &Configuration::get_sync_all_route_ordering);
ActionManager::map_some_state ("options", "SyncEditorAndMixerTrackOrder", &RCConfiguration::get_sync_all_route_ordering);
} else if (PARAM_IS ("stop-at-session-end")) {
ActionManager::map_some_state ("options", "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end);
ActionManager::map_some_state ("options", "StopTransportAtEndOfSession", &RCConfiguration::get_stop_at_session_end);
} else if (PARAM_IS ("monitoring-model")) {
map_monitor_model ();
} else if (PARAM_IS ("denormal-model")) {
@ -1183,9 +1183,9 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
} else if (PARAM_IS ("remote-model")) {
map_remote_model ();
} else if (PARAM_IS ("use-video-sync")) {
ActionManager::map_some_state ("Transport", "ToggleVideoSync", &Configuration::get_use_video_sync);
ActionManager::map_some_state ("Transport", "ToggleVideoSync", &RCConfiguration::get_use_video_sync);
} else if (PARAM_IS ("quieten-at-speed")) {
ActionManager::map_some_state ("options", "GainReduceFastTransport", &Configuration::get_quieten_at_speed);
ActionManager::map_some_state ("options", "GainReduceFastTransport", &RCConfiguration::get_quieten_at_speed);
} else if (PARAM_IS ("shuttle-behaviour")) {
switch (Config->get_shuttle_behaviour ()) {
@ -1236,20 +1236,20 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
secondary_clock.set (0, true);
}
} else if (PARAM_IS ("use-overlap-equivalency")) {
ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &Configuration::get_use_overlap_equivalency);
ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &RCConfiguration::get_use_overlap_equivalency);
} else if (PARAM_IS ("primary-clock-delta-edit-cursor")) {
ActionManager::map_some_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::get_primary_clock_delta_edit_cursor);
ActionManager::map_some_state ("options", "PrimaryClockDeltaEditCursor", &RCConfiguration::get_primary_clock_delta_edit_cursor);
} else if (PARAM_IS ("secondary-clock-delta-edit-cursor")) {
ActionManager::map_some_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::get_secondary_clock_delta_edit_cursor);
ActionManager::map_some_state ("options", "SecondaryClockDeltaEditCursor", &RCConfiguration::get_secondary_clock_delta_edit_cursor);
} else if (PARAM_IS ("only-copy-imported-files")) {
map_only_copy_imported_files ();
} else if (PARAM_IS ("show-track-meters")) {
ActionManager::map_some_state ("options", "ShowTrackMeters", &Configuration::get_show_track_meters);
ActionManager::map_some_state ("options", "ShowTrackMeters", &RCConfiguration::get_show_track_meters);
editor->toggle_meter_updating();
} else if (PARAM_IS ("default-narrow_ms")) {
ActionManager::map_some_state ("options", "DefaultNarrowMS", &Configuration::get_default_narrow_ms);
ActionManager::map_some_state ("options", "DefaultNarrowMS", &RCConfiguration::get_default_narrow_ms);
} else if (PARAM_IS ("rubberbanding-snaps-to-grid")) {
ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &Configuration::get_rubberbanding_snaps_to_grid);
ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &RCConfiguration::get_rubberbanding_snaps_to_grid);
}

View File

@ -200,7 +200,7 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
setup_fade_handle_positions ();
if (!Config->get_show_region_fades()) {
if (!trackview.session().config.get_show_region_fades()) {
set_fade_visibility (false);
}
@ -415,7 +415,7 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
fade_in_handle->hide();
fade_out_handle->hide();
} else {
if (Config->get_show_region_fades()) {
if (trackview.session().config.get_show_region_fades()) {
fade_in_handle->show();
fade_out_handle->show();
}
@ -575,7 +575,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
return;
}
if (Config->get_show_region_fades()) {
if (trackview.session().config.get_show_region_fades()) {
fade_in_shape->show();
}
@ -663,7 +663,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
return;
}
if (Config->get_show_region_fades()) {
if (trackview.session().config.get_show_region_fades()) {
fade_out_shape->show();
}

View File

@ -356,7 +356,7 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
cv->set_valid (true);
crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade));
crossfade_views.push_back (cv);
if (!Config->get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) {
if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) {
cv->hide ();
}
}

View File

@ -1036,7 +1036,7 @@ Editor::set_crossfade_model (CrossfadeModel model)
if (act) {
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active()) {
Config->set_xfade_model (model);
session->config.set_xfade_model (model);
}
}
}
@ -1046,7 +1046,7 @@ Editor::update_crossfade_model ()
{
RefPtr<Action> act;
switch (Config->get_xfade_model()) {
switch (session->config.get_xfade_model()) {
case FullCrossfade:
act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
break;
@ -1072,7 +1072,7 @@ Editor::update_smpte_mode ()
RefPtr<Action> act;
const char* action = 0;
switch (Config->get_smpte_format()) {
switch (session->config.get_smpte_format()) {
case smpte_23976:
action = X_("Smpte23976");
break;
@ -1160,7 +1160,9 @@ Editor::update_layering_model ()
{
RefPtr<Action> act;
switch (Config->get_layer_model()) {
assert (session);
switch (session->config.get_layer_model()) {
case LaterHigher:
act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
break;
@ -1188,6 +1190,8 @@ Editor::set_layer_model (LayerModel model)
active.
*/
assert (session);
RefPtr<Action> act;
switch (model) {
@ -1204,8 +1208,8 @@ Editor::set_layer_model (LayerModel model)
if (act) {
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active() && Config->get_layer_model() != model) {
Config->set_layer_model (model);
if (ract && ract->get_active() && session->config.get_layer_model() != model) {
session->config.set_layer_model (model);
}
}
}
@ -1668,7 +1672,7 @@ Editor::update_subframes_per_frame ()
RefPtr<Action> act;
const char* action = 0;
uint32_t sfpf = Config->get_subframes_per_frame();
uint32_t const sfpf = session->config.get_subframes_per_frame();
if (sfpf == 80) {
action = X_("Subframes80");
@ -1716,7 +1720,7 @@ Editor::subframes_per_frame_chosen (uint32_t sfpf)
if (act) {
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active()) {
Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
session->config.set_subframes_per_frame ((uint32_t) rint (sfpf));
}
} else {
@ -1727,43 +1731,43 @@ Editor::subframes_per_frame_chosen (uint32_t sfpf)
void
Editor::toggle_region_fades ()
{
ActionManager::toggle_config_state ("Editor", "toggle-region-fades", &Configuration::set_use_region_fades, &Configuration::get_use_region_fades);
ActionManager::toggle_config_state_foo ("Editor", "toggle-region-fades", mem_fun (session->config, &SessionConfiguration::set_use_region_fades), mem_fun (session->config, &SessionConfiguration::get_use_region_fades));
}
void
Editor::toggle_region_fades_visible ()
{
ActionManager::toggle_config_state ("Editor", "toggle-region-fades-visible", &Configuration::set_show_region_fades, &Configuration::get_show_region_fades);
ActionManager::toggle_config_state_foo ("Editor", "toggle-region-fades-visible", mem_fun (session->config, &SessionConfiguration::set_show_region_fades), mem_fun (session->config, &SessionConfiguration::get_show_region_fades));
}
void
Editor::toggle_auto_xfade ()
{
ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade);
ActionManager::toggle_config_state_foo ("Editor", "toggle-auto-xfades", mem_fun (session->config, &SessionConfiguration::set_auto_xfade), mem_fun (session->config, &SessionConfiguration::get_auto_xfade));
}
void
Editor::toggle_xfades_active ()
{
ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_xfades_active, &Configuration::get_xfades_active);
ActionManager::toggle_config_state_foo ("Editor", "toggle-xfades-active", mem_fun (session->config, &SessionConfiguration::set_xfades_active), mem_fun (session->config, &SessionConfiguration::get_xfades_active));
}
void
Editor::toggle_xfade_visibility ()
{
ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
ActionManager::toggle_config_state_foo ("Editor", "toggle-xfades-visible", mem_fun (session->config, &SessionConfiguration::set_xfades_visible), mem_fun (session->config, &SessionConfiguration::get_xfades_visible));
}
void
Editor::toggle_link_region_and_track_selection ()
{
ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &Configuration::set_link_region_and_track_selection, &Configuration::get_link_region_and_track_selection);
ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &RCConfiguration::set_link_region_and_track_selection, &RCConfiguration::get_link_region_and_track_selection);
}
void
Editor::toggle_automation_follows_regions ()
{
ActionManager::toggle_config_state ("Editor", "automation-follows-regions", &Configuration::set_automation_follows_regions, &Configuration::get_automation_follows_regions);
ActionManager::toggle_config_state ("Editor", "automation-follows-regions", &RCConfiguration::set_automation_follows_regions, &RCConfiguration::get_automation_follows_regions);
}
/** A Configuration parameter has changed.
@ -1790,17 +1794,17 @@ Editor::parameter_changed (const char* parameter_name)
} else if (PARAM_IS ("video-pullup")) {
update_video_pullup ();
} else if (PARAM_IS ("xfades-active")) {
ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
ActionManager::map_some_state ("Editor", "toggle-xfades-active", mem_fun (session->config, &SessionConfiguration::get_xfades_active));
} else if (PARAM_IS ("xfades-visible")) {
ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
ActionManager::map_some_state ("Editor", "toggle-xfades-visible", mem_fun (session->config, &SessionConfiguration::get_xfades_visible));
update_xfade_visibility ();
} else if (PARAM_IS ("show-region-fades")) {
ActionManager::map_some_state ("Editor", "toggle-region-fades-visible", &Configuration::get_show_region_fades);
ActionManager::map_some_state ("Editor", "toggle-region-fades-visible", mem_fun (session->config, &SessionConfiguration::get_show_region_fades));
update_region_fade_visibility ();
} else if (PARAM_IS ("use-region-fades")) {
ActionManager::map_some_state ("Editor", "toggle-region-fades", &Configuration::get_use_region_fades);
ActionManager::map_some_state ("Editor", "toggle-region-fades", mem_fun (session->config, &SessionConfiguration::get_use_region_fades));
} else if (PARAM_IS ("auto-xfade")) {
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", mem_fun (session->config, &SessionConfiguration::get_auto_xfade));
} else if (PARAM_IS ("xfade-model")) {
update_crossfade_model ();
} else if (PARAM_IS ("edit-mode")) {
@ -1811,9 +1815,9 @@ Editor::parameter_changed (const char* parameter_name)
} else if (PARAM_IS ("show-track-meters")) {
toggle_meter_updating();
} else if (PARAM_IS ("link-region-and-track-selection")) {
ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &Configuration::get_link_region_and_track_selection);
ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &RCConfiguration::get_link_region_and_track_selection);
} else if (PARAM_IS ("automation-follows-regions")) {
ActionManager::map_some_state ("Editor", "automation-follows-regions", &Configuration::get_automation_follows_regions);
ActionManager::map_some_state ("Editor", "automation-follows-regions", &RCConfiguration::get_automation_follows_regions);
}
#undef PARAM_IS

View File

@ -1140,15 +1140,15 @@ Editor::update_punch_range_view (bool visibility)
Location* tpl;
if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
if ((session->config.get_punch_in() || session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
guint track_canvas_width,track_canvas_height;
track_canvas->get_size(track_canvas_width,track_canvas_height);
if (Config->get_punch_in()) {
if (session->config.get_punch_in()) {
transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
} else {
transport_punch_range_rect->property_x1() = 0;
transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
}
if (visibility) {

View File

@ -5301,7 +5301,7 @@ Editor::toggle_selected_region_fades (int dir)
void
Editor::update_region_fade_visibility ()
{
bool _fade_visibility = Config->get_show_region_fades ();
bool _fade_visibility = session->config.get_show_region_fades ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
@ -5319,7 +5319,7 @@ Editor::update_region_fade_visibility ()
void
Editor::update_xfade_visibility ()
{
_xfade_visibility = Config->get_xfades_visible ();
_xfade_visibility = session->config.get_xfades_visible ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);

View File

@ -988,7 +988,7 @@ Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper)
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
smpte_ruler_scale = smpte_show_bits;
smpte_mark_modulo = 20;
smpte_nmarks = 2 + (2 * Config->get_subframes_per_frame());
smpte_nmarks = 2 + (2 * session->config.get_subframes_per_frame());
} else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
smpte_ruler_scale = smpte_show_frames;
smpte_mark_modulo = 1;
@ -1111,7 +1111,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
(*marks)[n].position = pos;
// Increment subframes by one
SMPTE::increment_subframes( smpte );
SMPTE::increment_subframes( smpte, session->config.get_subframes_per_frame() );
}
break;
case smpte_show_seconds:
@ -1138,7 +1138,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
}
(*marks)[n].label = g_strdup (buf);
SMPTE::increment_seconds( smpte );
SMPTE::increment_seconds( smpte, session->config.get_subframes_per_frame() );
}
break;
case smpte_show_minutes:
@ -1163,7 +1163,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
}
(*marks)[n].label = g_strdup (buf);
(*marks)[n].position = pos;
SMPTE::increment_minutes( smpte );
SMPTE::increment_minutes( smpte, session->config.get_subframes_per_frame() );
}
break;
@ -1186,7 +1186,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
(*marks)[n].label = g_strdup (buf);
(*marks)[n].position = pos;
SMPTE::increment_hours( smpte );
SMPTE::increment_hours( smpte, session->config.get_subframes_per_frame() );
}
break;
case smpte_show_frames:
@ -1212,7 +1212,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
}
(*marks)[n].label = g_strdup (buf);
SMPTE::increment( smpte );
SMPTE::increment( smpte, session->config.get_subframes_per_frame() );
}
break;

View File

@ -23,7 +23,6 @@
#include <vector>
#include <sigc++/signal.h>
#include <libgnomecanvasmm.h>
#include "ardour/configuration.h"
#include "canvas.h"
namespace Gnome {

View File

@ -39,8 +39,8 @@ MidiPortDialog::MidiPortDialog ()
port_name.signal_activate().connect (mem_fun (*this, &MidiPortDialog::entry_activated));
add_button (Stock::ADD, RESPONSE_ACCEPT);
add_button (Stock::CANCEL, RESPONSE_CANCEL);
add_button (Stock::ADD, RESPONSE_ACCEPT);
}
void

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,5 @@
#ifndef __gtk_ardour_option_editor_h__
#define __gtk_ardour_option_editor_h__
/*
Copyright (C) 2001 Paul Davis
Copyright (C) 2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,218 +17,307 @@
*/
#include <vector>
#ifndef __gtk_ardour_option_editor_h__
#define __gtk_ardour_option_editor_h__
#include <gtkmm/notebook.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/table.h>
#include <gtkmm/entry.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/scale.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/comboboxtext.h>
#include "ardour/session.h"
#include <gtkmm/spinbutton.h>
#include <gtkmm/table.h>
#include "ardour_dialog.h"
#include "editing.h"
#include "audio_clock.h"
class ARDOUR_UI;
class PublicEditor;
class Mixer_UI;
class IOSelector;
class GainMeter;
class PannerUI;
/** @file option_editor.h
* @brief Base class for option editing dialog boxes.
*
* Code to provided the basis for dialogs which allow the user to edit options
* from an ARDOUR::Configuration class.
*
* The idea is that we have an OptionEditor class which is the dialog box.
* This is essentially a GTK Notebook. OptionEditorComponent objects can
* then be added to the OptionEditor, and these components are arranged on
* the pages of the Notebook. There is also an OptionEditorComponent hierarchy
* here, providing things like boolean and combobox option components.
*
* It is intended that OptionEditor be subclassed to implement a particular
* options dialog.
*/
namespace ARDOUR {
class Configuration;
}
class OptionEditorPage;
/** Base class for components of an OptionEditor dialog */
class OptionEditorComponent
{
public:
/** Called when a configuration parameter's value has changed.
* @param p parameter name
*/
virtual void parameter_changed (std::string const & p) = 0;
/** Called to instruct the object to set its UI state from the configuration */
virtual void set_state_from_config () = 0;
/** Called to instruct the object to add itself to an OptionEditorPage */
virtual void add_to_page (OptionEditorPage *) = 0;
void add_widget_to_page (OptionEditorPage*, Gtk::Widget*);
void add_widgets_to_page (OptionEditorPage*, Gtk::Widget*, Gtk::Widget*);
};
/** A component which provides a subheading within the dialog */
class OptionEditorHeading : public OptionEditorComponent
{
public:
OptionEditorHeading (std::string const &);
void parameter_changed (std::string const &) {}
void set_state_from_config () {}
void add_to_page (OptionEditorPage *);
private:
Gtk::Label* _label; ///< the label used for the heading
};
/** A component which provides a box into which a subclass can put arbitrary widgets */
class OptionEditorBox : public OptionEditorComponent
{
public:
/** Construct an OpenEditorBox */
OptionEditorBox ()
{
_box = Gtk::manage (new Gtk::VBox);
_box->set_spacing (4);
}
void parameter_changed (std::string const &) = 0;
void set_state_from_config () = 0;
void add_to_page (OptionEditorPage *);
protected:
Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
};
/** Base class for components which provide UI to change an option */
class Option : public OptionEditorComponent {
public:
/** Construct an Option.
* @param i Option id (e.g. "plugins-stop-with-transport")
* @param n User-visible name (e.g. "Stop plugins when the transport is stopped")
*/
Option (std::string const & i,
std::string const & n
)
: _id (i),
_name (n)
{}
void parameter_changed (std::string const & p)
{
if (p == _id) {
set_state_from_config ();
}
}
virtual void set_state_from_config () = 0;
virtual void add_to_page (OptionEditorPage*) = 0;
std::string id () const {
return _id;
}
private:
std::string _id;
std::string _name;
};
/** Component which provides the UI to handle a boolean option using a GTK CheckButton */
class BoolOption : public Option {
public:
BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
void set_state_from_config ();
void toggled ();
void add_to_page (OptionEditorPage*);
private:
sigc::slot<bool> _get; ///< slot to get the configuration variable's value
sigc::slot<bool, bool> _set; ///< slot to set the configuration variable's value
Gtk::CheckButton* _button; ///< UI button
};
/** Component which provides the UI to handle an enumerated option using a GTK CheckButton.
* The template parameter is the enumeration.
*/
template <class T>
class ComboOption : public Option {
public:
/** Construct an ComboOption.
* @param i id
* @param n User-visible name.
* @param g Slot to get the variable's value.
* @param s Slot to set the variable's value.
*/
ComboOption (
std::string const & i,
std::string const & n,
sigc::slot<T> g,
sigc::slot<bool, T> s
)
: Option (i, n),
_get (g),
_set (s)
{
_label = manage (new Gtk::Label (n + ":"));
_label->set_alignment (1, 0.5);
_combo = manage (new Gtk::ComboBoxText);
_combo->signal_changed().connect (sigc::mem_fun (*this, &ComboOption::changed));
}
void set_state_from_config () {
uint32_t r = 0;
while (r < _options.size() && _get () != _options[r]) {
++r;
}
if (r < _options.size()) {
_combo->set_active (r);
}
}
void add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _combo);
}
/** Add an allowed value for this option.
* @param e Enumeration.
* @param o User-visible name for this value.
*/
void add (T e, std::string const & o) {
_options.push_back (e);
_combo->append_text (o);
}
void changed () {
uint32_t const r = _combo->get_active_row_number ();
if (r < _options.size()) {
_set (_options[r]);
}
}
private:
sigc::slot<T> _get;
sigc::slot<bool, T> _set;
Gtk::Label* _label;
Gtk::ComboBoxText* _combo;
std::vector<T> _options;
};
/** Component which provides the UI to handle an numeric option using a GTK SpinButton */
template <class T>
class SpinOption : public Option
{
public:
/** Construct an SpinOption.
* @param i id
* @param n User-visible name.
* @param g Slot to get the variable's value.
* @param s Slot to set the variable's value.
* @param min Variable minimum value.
* @param max Variable maximum value.
* @param step Step for the spin button.
* @param page Page step for the spin button.
*/
SpinOption (
std::string const & i,
std::string const & n,
sigc::slot<T> g,
sigc::slot<bool, T> s,
T min,
T max,
T step,
T page
)
: Option (i, n),
_get (g),
_set (s)
{
_label = manage (new Gtk::Label (n + ":"));
_label->set_alignment (1, 0.5);
_spin = manage (new Gtk::SpinButton);
_spin->set_range (min, max);
_spin->set_increments (step, page);
_spin->signal_value_changed().connect (sigc::mem_fun (*this, &SpinOption::changed));
}
void set_state_from_config ()
{
_spin->set_value (_get ());
}
void add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _spin);
}
void changed ()
{
_set (static_cast<T> (_spin->get_value ()));
}
private:
sigc::slot<T> _get;
sigc::slot<bool, T> _set;
Gtk::Label* _label;
Gtk::SpinButton* _spin;
};
/** 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.
*/
class OptionEditorPage
{
public:
OptionEditorPage (Gtk::Notebook&, std::string const &);
Gtk::VBox box;
Gtk::Table table;
std::list<OptionEditorComponent*> components;
};
/** The OptionEditor dialog base class */
class OptionEditor : public ArdourDialog
{
public:
OptionEditor (ARDOUR_UI&, PublicEditor&, Mixer_UI&);
public:
OptionEditor (ARDOUR::Configuration *, std::string const &);
~OptionEditor ();
void set_session (ARDOUR::Session *);
void save ();
void add (std::string const &, OptionEditorComponent *);
private:
ARDOUR::Session *session;
ARDOUR_UI& ui;
PublicEditor& editor;
Mixer_UI& mixer;
protected:
ARDOUR::Configuration* _config;
private:
void parameter_changed (std::string const &);
Gtk::Notebook notebook;
/* Generic */
gint wm_close (GdkEventAny *);
bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
void parameter_changed (const char* name);
/* paths */
Gtk::Table path_table;
Gtk::Entry session_raid_entry;
void setup_path_options();
void add_session_paths ();
void remove_session_paths ();
void raid_path_changed ();
/* misc */
Gtk::VBox misc_packer;
Gtk::Adjustment short_xfade_adjustment;
Gtk::HScale short_xfade_slider;
Gtk::Adjustment destructo_xfade_adjustment;
Gtk::HScale destructo_xfade_slider;
void setup_misc_options();
void short_xfade_adjustment_changed ();
void destructo_xfade_adjustment_changed ();
Gtk::Adjustment history_depth;
Gtk::Adjustment saved_history_depth;
Gtk::SpinButton history_depth_spinner;
Gtk::SpinButton saved_history_depth_spinner;
Gtk::CheckButton limit_history_button;
Gtk::CheckButton save_history_button;
void history_depth_changed();
void saved_history_depth_changed();
void save_history_toggled ();
void limit_history_toggled ();
/* Sync */
Gtk::VBox sync_packer;
Gtk::ComboBoxText slave_type_combo;
AudioClock smpte_offset_clock;
Gtk::CheckButton smpte_offset_negative_button;
Gtk::CheckButton synced_timecode_button;
void setup_sync_options ();
void smpte_offset_chosen ();
void smpte_offset_negative_clicked ();
void synced_timecode_toggled ();
/* MIDI */
Gtk::VBox midi_packer;
Gtk::RadioButton::Group mtc_button_group;
Gtk::RadioButton::Group mmc_button_group;
Gtk::RadioButton::Group midi_button_group;
Gtk::RadioButton::Group midi_clock_button_group;
Gtk::Table midi_port_table;
std::vector<Gtk::Widget*> midi_port_table_widgets;
Gtk::Adjustment mmc_receive_device_id_adjustment;
Gtk::SpinButton mmc_receive_device_id_spinner;
Gtk::Adjustment mmc_send_device_id_adjustment;
Gtk::SpinButton mmc_send_device_id_spinner;
Gtk::Button add_midi_port_button;
Gtk::Adjustment initial_program_change_adjustment;
Gtk::SpinButton initial_program_change_spinner;
void add_midi_port ();
void remove_midi_port (MIDI::Port*);
void redisplay_midi_ports ();
void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
void midi_clock_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
bool port_removable (MIDI::Port*);
void mmc_receive_device_id_adjusted ();
void mmc_send_device_id_adjusted ();
void initial_program_change_adjusted ();
void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
void setup_midi_options();
enum PortIndex {
MtcIndex = 0,
MmcIndex = 1,
MidiIndex = 2,
MidiClockIndex = 3
};
std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
/* Click */
IOSelector* click_io_selector;
GainMeter* click_gpm;
PannerUI* click_panner;
bool first_click_setup;
Gtk::HBox click_hpacker;
Gtk::VBox click_packer;
Gtk::Table click_table;
Gtk::Entry click_path_entry;
Gtk::Entry click_emphasis_path_entry;
Gtk::Button click_browse_button;
Gtk::Button click_emphasis_browse_button;
void setup_click_editor ();
void clear_click_editor ();
void click_chosen (const std::string & paths);
void click_emphasis_chosen (const std::string & paths);
void click_browse_clicked ();
void click_emphasis_browse_clicked ();
void click_sound_changed ();
void click_emphasis_sound_changed ();
/* Auditioner */
Gtk::VBox audition_packer;
Gtk::HBox audition_hpacker;
Gtk::Label audition_label;
IOSelector* auditioner_io_selector;
GainMeter* auditioner_gpm;
PannerUI* auditioner_panner;
void setup_auditioner_editor ();
void clear_auditioner_editor ();
void connect_audition_editor ();
/* keyboard/mouse */
Gtk::Table keyboard_mouse_table;
Gtk::ComboBoxText keyboard_layout_selector;
Gtk::ComboBoxText edit_modifier_combo;
Gtk::ComboBoxText delete_modifier_combo;
Gtk::ComboBoxText snap_modifier_combo;
Gtk::Adjustment delete_button_adjustment;
Gtk::SpinButton delete_button_spin;
Gtk::Adjustment edit_button_adjustment;
Gtk::SpinButton edit_button_spin;
std::map<std::string,std::string> bindings_files;
void setup_keyboard_options ();
void delete_modifier_chosen ();
void edit_modifier_chosen ();
void snap_modifier_chosen ();
void edit_button_changed ();
void delete_button_changed ();
void bindings_changed ();
Gtk::Notebook _notebook;
std::map<std::string, OptionEditorPage*> _pages;
};
#endif /* __gtk_ardour_option_editor_h__ */

View File

@ -23,6 +23,7 @@
#include "pbd/stacktrace.h"
#include "ardour/playlist.h"
#include "ardour/rc_configuration.h"
#include "region_view.h"
#include "selection.h"

View File

@ -262,7 +262,8 @@ SoundFileBox::setup_labels (const ustring& filename)
samplerate.set_name ("NewSessionSR2Label");
}
double src_coef = (double) _session->nominal_frame_rate() / sf_info.samplerate;
nframes_t const nfr = _session ? _session->nominal_frame_rate() : 25;
double src_coef = (double) nfr / sf_info.samplerate;
length_clock.set (sf_info.length * src_coef + 0.5, true);
timecode_clock.set (sf_info.timecode * src_coef + 0.5, true);

View File

@ -36,12 +36,14 @@
#include <gtkmm/filechooserwidget.h>
#include <gtkmm/frame.h>
#include <gtkmm/label.h>
#include <gtkmm/textview.h>
#include "ardour/session.h"
#include "ardour/audiofilesource.h"
#include "ardour_dialog.h"
#include "editing.h"
#include "audio_clock.h"
namespace ARDOUR {
class Session;

View File

@ -26,15 +26,14 @@
#include "pbd/stateful.h"
#include "pbd/xml++.h"
#include "ardour/configuration_variable.h"
template<class T>
class UIConfigVariable
class UIConfigVariable : public ARDOUR::ConfigVariableBase
{
public:
UIConfigVariable (std::string str) : _name (str) {}
UIConfigVariable (std::string str, T val) : _name (str), value(val) {}
std::string name() const { return _name; }
UIConfigVariable (std::string str) : ARDOUR::ConfigVariableBase (str) {}
UIConfigVariable (std::string str, T val) : ARDOUR::ConfigVariableBase (str), value (val) {}
bool set (T val) {
if (val == value) {
@ -48,54 +47,25 @@ class UIConfigVariable
return value;
}
void add_to_node (XMLNode& node) {
std::string get_as_string () const {
std::stringstream ss;
ss << std::hex;
ss.fill('0');
ss.width(8);
ss << value;
XMLNode* child = new XMLNode ("Option");
child->add_property ("name", _name);
child->add_property ("value", ss.str());
node.add_child_nocopy (*child);
return ss.str ();
}
bool set_from_node (const XMLNode& node) {
const XMLProperty* prop;
XMLNodeList nlist;
XMLNodeConstIterator niter;
XMLNode* child;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
child = *niter;
if (child->name() == "Option") {
if ((prop = child->property ("name")) != 0) {
if (prop->value() == _name) {
if ((prop = child->property ("value")) != 0) {
std::stringstream ss;
ss << std::hex;
ss << prop->value();
ss >> value;
return true;
}
}
}
}
}
return false;
void set_from_string (std::string const & s) {
std::stringstream ss;
ss << std::hex;
ss << s;
ss >> value;
}
protected:
T get_for_save() { return value; }
std::string _name;
T value;
};
class UIConfiguration : public PBD::Stateful

View File

@ -179,6 +179,7 @@ def build(bld):
processor_box.cc
prompter.cc
public_editor.cc
rc_option_editor.cc
region_gain_line.cc
region_selection.cc
region_view.cc

View File

@ -29,7 +29,6 @@
#include "pbd/error.h"
#include "pbd/failed_constructor.h"
#include "ardour/configuration.h"
#include "ardour/types.h"
// #include <jack/jack.h> need this to inline jack_get_microseconds

View File

@ -35,7 +35,6 @@
#include "pbd/rcu.h"
#include "ardour/ardour.h"
#include "ardour/configuration.h"
#include "ardour/utils.h"
#include "ardour/diskstream.h"
#include "ardour/audioplaylist.h"

View File

@ -68,7 +68,7 @@ class BroadcastInfo
void set_time_reference (int64_t when);
void set_origination_time (struct tm * now = 0); // if 0, use time generated at construction
void set_originator (std::string const & str = "");
void set_originator_ref (std::string const & str = "");
void set_originator_ref (Session const &, std::string const & str = "");
/* State info */

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 1999 Paul Davis
Copyright (C) 2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,16 +20,7 @@
#ifndef __ardour_configuration_h__
#define __ardour_configuration_h__
#include <map>
#include <vector>
#include <sys/types.h>
#include <string>
#include "pbd/stateful.h"
#include "ardour/types.h"
#include "ardour/utils.h"
#include "pbd/stateful.h"
#include "ardour/configuration_variable.h"
class XMLNode;
@ -42,65 +33,15 @@ class Configuration : public PBD::Stateful
Configuration();
virtual ~Configuration();
std::map<std::string,XMLNode> midi_ports;
void map_parameters (sigc::slot<void,const char*> theSlot);
int load_state ();
int save_state ();
/// calls Stateful::*instant_xml methods using
/// ARDOUR::user_config_directory for the directory argument
void add_instant_xml (XMLNode&);
XMLNode * instant_xml (const std::string& str);
int set_state (const XMLNode&);
XMLNode& get_state (void);
XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>, std::string which_node = "Config");
void set_variables (const XMLNode&, ConfigVariableBase::Owner owner);
void set_current_owner (ConfigVariableBase::Owner);
XMLNode* control_protocol_state () { return _control_protocol_state; }
virtual void map_parameters (sigc::slot<void, const char *> s) = 0;
virtual int set_state (XMLNode const &) = 0;
virtual XMLNode & get_state () = 0;
virtual XMLNode & get_variables () = 0;
virtual void set_variables (XMLNode const &) = 0;
sigc::signal<void,const char*> ParameterChanged;
/* define accessor methods */
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(Type,var,name,value) \
Type get_##var () const { return var.get(); } \
bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret; }
#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
Type get_##var () const { return var.get(); } \
bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret; }
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
private:
/* declare variables */
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var;
#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var;
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
ConfigVariableBase::Owner current_owner;
XMLNode* _control_protocol_state;
XMLNode& state (sigc::slot<bool,ConfigVariableBase::Owner>);
bool save_config_options_predicate (ConfigVariableBase::Owner owner);
};
extern Configuration *Config;
extern gain_t speed_quietning; /* see comment in configuration.cc */
} // namespace ARDOUR
#endif /* __ardour_configuration_h__ */

View File

@ -30,29 +30,23 @@ namespace ARDOUR {
class ConfigVariableBase {
public:
enum Owner {
Default = 0x1,
System = 0x2,
Config = 0x4,
Session = 0x8,
Interface = 0x10
};
ConfigVariableBase (std::string str) : _name (str), _owner (Default) {}
ConfigVariableBase (std::string str) : _name (str) {}
virtual ~ConfigVariableBase() {}
std::string name() const { return _name; }
Owner owner() const { return _owner; }
virtual void add_to_node (XMLNode& node) = 0;
virtual bool set_from_node (const XMLNode& node, Owner owner) = 0;
std::string name () const { return _name; }
void add_to_node (XMLNode&);
bool set_from_node (XMLNode const &);
virtual std::string get_as_string () const = 0;
virtual void set_from_string (std::string const &) = 0;
void show_stored_value (const std::string&);
static void set_show_stored_values (bool yn);
static void set_show_stored_values (bool);
protected:
std::string _name;
Owner _owner;
static bool show_stores;
void notify ();
@ -63,94 +57,34 @@ template<class T>
class ConfigVariable : public ConfigVariableBase
{
public:
ConfigVariable (std::string str) : ConfigVariableBase (str) {}
ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {}
virtual bool set (T val, Owner owner = ARDOUR::ConfigVariableBase::Config) {
if (val == value) {
miss ();
return false;
}
value = val;
_owner = (ConfigVariableBase::Owner)(_owner |owner);
notify ();
return true;
}
T get() const {
return value;
}
void add_to_node (XMLNode& node) {
std::string get_as_string () const {
std::stringstream ss;
ss << value;
show_stored_value (ss.str());
XMLNode* child = new XMLNode ("Option");
child->add_property ("name", _name);
child->add_property ("value", ss.str());
node.add_child_nocopy (*child);
return ss.str ();
}
bool set_from_node (const XMLNode& node, Owner owner) {
if (node.name() == "Config") {
/* ardour.rc */
const XMLProperty* prop;
XMLNodeList nlist;
XMLNodeConstIterator niter;
XMLNode* child;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
child = *niter;
if (child->name() == "Option") {
if ((prop = child->property ("name")) != 0) {
if (prop->value() == _name) {
if ((prop = child->property ("value")) != 0) {
std::stringstream ss;
ss << prop->value();
ss >> value;
_owner = (ConfigVariableBase::Owner)(_owner |owner);
return true;
}
}
}
}
}
} else if (node.name() == "Options") {
/* session file */
XMLNodeList olist;
XMLNodeConstIterator oiter;
XMLNode* option;
const XMLProperty* opt_prop;
olist = node.children();
for (oiter = olist.begin(); oiter != olist.end(); ++oiter) {
option = *oiter;
if (option->name() == _name) {
if ((opt_prop = option->property ("val")) != 0) {
std::stringstream ss;
ss << opt_prop->value();
ss >> value;
_owner = (ConfigVariableBase::Owner)(_owner |owner);
return true;
}
}
}
virtual bool set (T val) {
if (val == value) {
miss ();
return false;
}
value = val;
notify ();
return true;
}
return false;
void set_from_string (std::string const & s) {
std::stringstream ss;
ss << s;
ss >> value;
}
protected:
@ -165,10 +99,10 @@ class ConfigVariableWithMutation : public ConfigVariable<T>
ConfigVariableWithMutation (std::string name, T val, T (*m)(T))
: ConfigVariable<T> (name, val), mutator (m) {}
bool set (T val, ConfigVariableBase::Owner owner) {
bool set (T val) {
if (unmutated_value != val) {
unmutated_value = val;
return ConfigVariable<T>::set (mutator (val), owner);
return ConfigVariable<T>::set (mutator (val));
}
return false;
}

View File

@ -39,7 +39,6 @@
#include "pbd/statefuldestructible.h"
#include "ardour/ardour.h"
#include "ardour/configuration.h"
#include "ardour/location.h"
#include "ardour/session_object.h"
#include "ardour/types.h"

View File

@ -36,7 +36,6 @@
#include "pbd/ringbufferNPT.h"
#include "ardour/ardour.h"
#include "ardour/configuration.h"
#include "ardour/diskstream.h"
#include "ardour/midi_playlist.h"
#include "ardour/midi_ring_buffer.h"

View File

@ -51,7 +51,8 @@
#include "ardour/ardour.h"
#include "ardour/chan_count.h"
#include "ardour/configuration.h"
#include "ardour/rc_configuration.h"
#include "ardour/session_configuration.h"
#include "ardour/location.h"
#include "ardour/smpte.h"
@ -388,7 +389,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void goto_end () { request_locate (end_location->start(), false);}
void goto_start () { request_locate (start_location->start(), false); }
void set_session_start (nframes_t start) { start_location->set_start(start); }
void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; }
void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); }
void use_rf_shuttle_speed ();
void allow_auto_play (bool yn);
void request_transport_speed (double speed);
@ -967,6 +968,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
SessionMetadata & metadata () { return *_metadata; }
SessionConfiguration config;
protected:
friend class AudioEngine;
void set_block_size (nframes_t nframes);
@ -1038,7 +1041,6 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
bool _have_captured;
float _meter_hold;
float _meter_falloff;
bool _end_location_is_free;
void set_worst_io_latencies ();
void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) {
@ -1111,7 +1113,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
if (actively_recording()) {
return true;
} else {
if (Config->get_auto_input()) {
if (config.get_auto_input()) {
return false;
} else {
return true;
@ -1173,9 +1175,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void auto_save();
int load_options (const XMLNode&);
XMLNode& get_options () const;
int load_state (std::string snapshot_name);
bool save_config_options_predicate (ConfigVariableBase::Owner owner) const;
nframes_t _last_roll_location;
nframes_t _last_record_location;

View File

@ -27,7 +27,6 @@ namespace ARDOUR {
class Session;
/** An object associated with a Session.
*
* This is a few common things factored out of IO which weren't IO specific

View File

@ -57,7 +57,7 @@ class SndFileSource : public AudioFileSource {
bool one_of_several_channels () const;
static void setup_standard_crossfades (nframes_t sample_rate);
static void setup_standard_crossfades (Session const &, nframes_t sample_rate);
static const Source::Flag default_writable_flags;
static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, std::string& error_msg);

View File

@ -336,6 +336,7 @@ namespace ARDOUR {
};
enum AutoConnectOption {
ManualConnect = 0x0,
AutoConnectPhysical = 0x1,
AutoConnectMaster = 0x2
};

View File

@ -63,6 +63,20 @@ ARDOUR::SlaveSource string_to_slave_source (std::string str);
const char* edit_mode_to_string (ARDOUR::EditMode);
ARDOUR::EditMode string_to_edit_mode (std::string);
/* I don't really like hard-coding these falloff rates here
* Probably should use a map of some kind that could be configured
* These rates are db/sec.
*/
#define METER_FALLOFF_OFF 0.0f
#define METER_FALLOFF_SLOWEST 6.6f // BBC standard
#define METER_FALLOFF_SLOW 8.6f // BBC standard
#define METER_FALLOFF_MEDIUM 20.0f
#define METER_FALLOFF_FAST 32.0f
#define METER_FALLOFF_FASTER 46.0f
#define METER_FALLOFF_FASTEST 70.0f
float meter_falloff_to_float (ARDOUR::MeterFalloff);
ARDOUR::MeterFalloff meter_falloff_from_float (float);
float meter_falloff_to_db_per_sec (float);

View File

@ -438,7 +438,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram
if (_alignment_style == ExistingMaterial) {
if (!Config->get_punch_in()) {
if (!_session.config.get_punch_in()) {
/* manual punch in happens at the correct transport frame
because the user hit a button. but to get alignment correct
@ -467,7 +467,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram
} else {
if (Config->get_punch_in()) {
if (_session.config.get_punch_in()) {
first_recordable_frame += _roll_delay;
} else {
capture_start_frame -= _roll_delay;
@ -570,7 +570,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
(*chan)->current_playback_buffer = 0;
}
if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) {
OverlapType ot;
// Safeguard against situations where process() goes haywire when autopunching and last_recordable_frame < first_recordable_frame
@ -1867,7 +1867,7 @@ AudioDiskstream::engage_record_enable ()
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
if ((*chan)->source) {
(*chan)->source->ensure_monitor_input (!(Config->get_auto_input() && rolling));
(*chan)->source->ensure_monitor_input (!(_session.config.get_auto_input() && rolling));
}
capturing_sources.push_back ((*chan)->write_source);
(*chan)->write_source->mark_streaming_write_started ();
@ -1936,7 +1936,7 @@ AudioDiskstream::get_state ()
Location* pi;
if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
} else {
snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());

View File

@ -368,7 +368,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
}
if (!Config->get_auto_xfade()) {
if (!_session.config.get_auto_xfade()) {
return;
}
@ -450,19 +450,19 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
* [---- bottom -------------------]
*/
if (Config->get_xfade_model() == FullCrossfade) {
if (_session.config.get_xfade_model() == FullCrossfade) {
touched_regions = regions_touched (top->first_frame(), bottom->last_frame());
if (touched_regions->size() <= 2) {
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
add_crossfade (xfade);
}
} else {
touched_regions = regions_touched (top->first_frame(),
top->first_frame() + min ((nframes_t)Config->get_short_xfade_seconds() * _session.frame_rate(),
top->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(),
top->length()));
if (touched_regions->size() <= 2) {
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
add_crossfade (xfade);
}
}
@ -474,28 +474,28 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
* { ==== bottom ============ }
*/
if (Config->get_xfade_model() == FullCrossfade) {
if (_session.config.get_xfade_model() == FullCrossfade) {
touched_regions = regions_touched (bottom->first_frame(), top->last_frame());
if (touched_regions->size() <= 2) {
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other,
Config->get_xfade_model(), Config->get_xfades_active()));
_session.config.get_xfade_model(), _session.config.get_xfades_active()));
add_crossfade (xfade);
}
} else {
touched_regions = regions_touched (bottom->first_frame(),
bottom->first_frame() + min ((nframes_t)Config->get_short_xfade_seconds() * _session.frame_rate(),
bottom->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(),
bottom->length()));
if (touched_regions->size() <= 2) {
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
add_crossfade (xfade);
}
}
break;
default:
xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other,
Config->get_xfade_model(), Config->get_xfades_active()));
_session.config.get_xfade_model(), _session.config.get_xfades_active()));
add_crossfade (xfade);
}
}

View File

@ -509,7 +509,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
just_meter_input (start_frame, end_frame, nframes);
}
if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
if (diskstream->record_enabled() && !can_record && !_session.config.get_auto_input()) {
/* not actually recording, but we want to hear the input material anyway,
at least potentially (depending on monitoring options)

View File

@ -434,7 +434,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
/* fade in */
if ((_flags & FadeIn) && Config->get_use_region_fades()) {
if ((_flags & FadeIn) && _session.config.get_use_region_fades()) {
nframes_t fade_in_length = (nframes_t) _fade_in->back()->when;
@ -457,7 +457,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
/* fade out */
if ((_flags & FadeOut) && Config->get_use_region_fades()) {
if ((_flags & FadeOut) && _session.config.get_use_region_fades()) {
/* see if some part of this read is within the fade out */

View File

@ -41,8 +41,8 @@ using namespace PBD;
Auditioner::Auditioner (Session& s)
: AudioTrack (s, "auditioner", Route::Hidden)
{
string left = Config->get_auditioner_output_left();
string right = Config->get_auditioner_output_right();
string left = _session.config.get_auditioner_output_left();
string right = _session.config.get_auditioner_output_right();
if (left == "default") {
left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
@ -209,12 +209,12 @@ Auditioner::output_changed (IOChange change, void* src)
if (output (0)->get_connections (connections)) {
phys = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
if (phys != connections[0]) {
Config->set_auditioner_output_left (connections[0]);
_session.config.set_auditioner_output_left (connections[0]);
} else {
Config->set_auditioner_output_left ("default");
_session.config.set_auditioner_output_left ("default");
}
} else {
Config->set_auditioner_output_left ("");
_session.config.set_auditioner_output_left ("");
}
connections.clear ();
@ -222,12 +222,12 @@ Auditioner::output_changed (IOChange change, void* src)
if (output (1)->get_connections (connections)) {
phys = _session.engine().get_nth_physical_output (DataType::AUDIO, 1);
if (phys != connections[0]) {
Config->set_auditioner_output_right (connections[0]);
_session.config.set_auditioner_output_right (connections[0]);
} else {
Config->set_auditioner_output_right ("default");
_session.config.set_auditioner_output_right ("default");
}
} else {
Config->set_auditioner_output_right ("");
_session.config.set_auditioner_output_right ("");
}
}
}

View File

@ -77,7 +77,7 @@ BroadcastInfo::set_from_session (Session const & session, int64_t time_ref)
set_time_reference (time_ref);
set_origination_time ();
set_originator ();
set_originator_ref ();
set_originator_ref (session);
}
bool
@ -242,7 +242,7 @@ BroadcastInfo::set_originator (std::string const & str)
}
void
BroadcastInfo::set_originator_ref (std::string const & str)
BroadcastInfo::set_originator_ref (Session const & session, std::string const & str)
{
_has_info = true;
@ -261,8 +261,8 @@ BroadcastInfo::set_originator_ref (std::string const & str)
serial_number << "ARDOUR" << "r" << std::setfill('0') << std::right << std::setw(5) << svn_revision;
snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), "%2s%3s%12s%02d%02d%02d%9d",
Config->get_bwf_country_code().c_str(),
Config->get_bwf_organization_code().c_str(),
session.config.get_bwf_country_code().c_str(),
session.config.get_bwf_organization_code().c_str(),
serial_number.str().c_str(),
_time.tm_hour,
_time.tm_min,

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 1999-2006 Paul Davis
Copyright (C) 1999-2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -17,332 +17,90 @@
*/
#include <unistd.h>
#include <cstdio> /* for snprintf, grrr */
#include <glib.h>
#include <glib/gstdio.h> /* for g_stat() */
#include <glibmm/miscutils.h>
#include "pbd/failed_constructor.h"
#include "pbd/xml++.h"
#include "pbd/filesystem.h"
#include "pbd/file_utils.h"
#include "midi++/manager.h"
#include "ardour/ardour.h"
#include "ardour/configuration.h"
#include "ardour/audio_diskstream.h"
#include "ardour/control_protocol_manager.h"
#include "ardour/filesystem_paths.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace std;
using namespace PBD;
/* this is global so that we do not have to indirect through an object pointer
to reference it.
*/
namespace ARDOUR {
float speed_quietning = 0.251189; // -12dB reduction for ffwd or rewind
}
Configuration::Configuration ()
:
/* construct variables */
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
current_owner (ConfigVariableBase::Default)
{
_control_protocol_state = 0;
}
Configuration::~Configuration ()
{
}
void
Configuration::set_current_owner (ConfigVariableBase::Owner owner)
{
current_owner = owner;
}
int
Configuration::load_state ()
{
bool found = false;
sys::path system_rc_file;
struct stat statbuf;
/* load system configuration first */
if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
"ardour_system.rc", system_rc_file) )
{
XMLTree tree;
found = true;
string rcfile = system_rc_file.to_string();
/* stupid XML Parser hates empty files */
if (g_stat (rcfile.c_str(), &statbuf)) {
return -1;
}
if (statbuf.st_size != 0) {
cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile.c_str())) {
error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
return -1;
}
current_owner = ConfigVariableBase::System;
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
} else {
error << _("your system Ardour configuration file is empty. This probably means that there as an error installing Ardour") << endmsg;
}
}
/* now load configuration file for user */
sys::path user_rc_file;
if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
"ardour.rc", user_rc_file))
{
XMLTree tree;
found = true;
string rcfile = user_rc_file.to_string();
/* stupid XML parser hates empty files */
if (g_stat (rcfile.c_str(), &statbuf)) {
return -1;
}
if (statbuf.st_size != 0) {
cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile)) {
error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
return -1;
}
current_owner = ConfigVariableBase::Config;
if (set_state (*tree.root())) {
error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
} else {
warning << _("your Ardour configuration file is empty. This is not normal.") << endmsg;
}
}
if (!found)
error << "Ardour: could not find configuration file (ardour.rc), canvas will look broken." << endmsg;
return 0;
}
int
Configuration::save_state()
{
XMLTree tree;
try
{
sys::create_directories (user_config_directory ());
}
catch (const sys::filesystem_error& ex)
{
error << "Could not create user configuration directory" << endmsg;
return -1;
}
sys::path rcfile_path(user_config_directory());
rcfile_path /= "ardour.rc";
const string rcfile = rcfile_path.to_string();
// this test seems bogus?
if (rcfile.length()) {
tree.set_root (&get_state());
if (!tree.write (rcfile.c_str())){
error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
return -1;
}
}
return 0;
}
bool ConfigVariableBase::show_stores = false;
void
Configuration::add_instant_xml(XMLNode& node)
ConfigVariableBase::add_to_node (XMLNode& node)
{
Stateful::add_instant_xml (node, user_config_directory ());
std::string const v = get_as_string ();
show_stored_value (v);
XMLNode* child = new XMLNode ("Option");
child->add_property ("name", _name);
child->add_property ("value", v);
node.add_child_nocopy (*child);
}
XMLNode*
Configuration::instant_xml(const string& node_name)
{
return Stateful::instant_xml (node_name, user_config_directory ());
}
bool
Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner)
ConfigVariableBase::set_from_node (XMLNode const & node)
{
/* only save things that were in the config file to start with */
return owner & ConfigVariableBase::Config;
}
XMLNode&
Configuration::get_state ()
{
XMLNode* root;
LocaleGuard lg (X_("POSIX"));
root = new XMLNode("Ardour");
MIDI::Manager::PortMap::const_iterator i;
const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
for (i = ports.begin(); i != ports.end(); ++i) {
root->add_child_nocopy(i->second->get_state());
}
root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate), "Config"));
if (_extra_xml) {
root->add_child_copy (*_extra_xml);
}
root->add_child_nocopy (ControlProtocolManager::instance().get_state());
return *root;
}
XMLNode&
Configuration::get_variables (sigc::slot<bool,ConfigVariableBase::Owner> predicate, std::string which_node)
{
XMLNode* node;
LocaleGuard lg (X_("POSIX"));
node = new XMLNode(which_node);
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(type,var,Name,value) \
if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }}
#define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }}
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
return *node;
}
int
Configuration::set_state (const XMLNode& root)
{
if (root.name() != "Ardour") {
return -1;
}
XMLNodeList nlist = root.children();
XMLNodeConstIterator niter;
XMLNode *node;
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
node = *niter;
if (node->name() == "MIDI-port") {
try {
MIDI::Port::Descriptor desc (*node);
map<string,XMLNode>::iterator x;
if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
midi_ports.erase (x);
if (node.name() == "Config" || node.name() == "Canvas" || node.name() == "UI") {
/* ardour.rc */
const XMLProperty* prop;
XMLNodeList nlist;
XMLNodeConstIterator niter;
XMLNode* child;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
child = *niter;
if (child->name() == "Option") {
if ((prop = child->property ("name")) != 0) {
if (prop->value() == _name) {
if ((prop = child->property ("value")) != 0) {
set_from_string (prop->value());
return true;
}
}
}
midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
}
}
} else if (node.name() == "Options") {
catch (failed_constructor& err) {
warning << _("ill-formed MIDI port specification in ardour rcfile (ignored)") << endmsg;
/* session file */
XMLNodeList olist;
XMLNodeConstIterator oiter;
XMLNode* option;
const XMLProperty* opt_prop;
olist = node.children();
for (oiter = olist.begin(); oiter != olist.end(); ++oiter) {
option = *oiter;
if (option->name() == _name) {
if ((opt_prop = option->property ("val")) != 0) {
set_from_string (opt_prop->value());
return true;
}
}
} else if (node->name() == "Config") {
set_variables (*node, ConfigVariableBase::Config);
} else if (node->name() == "Extra") {
_extra_xml = new XMLNode (*node);
} else if (node->name() == ControlProtocolManager::state_node_name) {
_control_protocol_state = new XMLNode (*node);
}
}
Diskstream::set_disk_io_chunk_frames (minimum_disk_io_bytes.get() / sizeof (Sample));
return 0;
}
void
Configuration::set_variables (const XMLNode& node, ConfigVariableBase::Owner owner)
{
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(type,var,name,value) \
if (var.set_from_node (node, owner)) { \
ParameterChanged (name); \
}
#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
if (var.set_from_node (node, owner)) { \
ParameterChanged (name); \
}
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
}
void
Configuration::map_parameters (sigc::slot<void,const char*> theSlot)
{
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
#define CONFIG_VARIABLE(type,var,name,value) theSlot (name);
#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
#include "ardour/configuration_vars.h"
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL
return false;
}
bool ConfigVariableBase::show_stores = false;
void
ConfigVariableBase::set_show_stored_values (bool yn)

View File

@ -83,7 +83,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
_anchor_point = ap;
_follow_overlap = false;
_active = Config->get_xfades_active ();
_active = _session.config.get_xfades_active ();
_fixed = true;
initialize ();
@ -428,7 +428,7 @@ Crossfade::refresh ()
if (_follow_overlap) {
try {
compute (_in, _out, Config->get_xfade_model());
compute (_in, _out, _session.config.get_xfade_model());
}
catch (NoCrossfadeHere& err) {

View File

@ -56,7 +56,7 @@
#include "ardour/ardour.h"
#include "ardour/analyser.h"
#include "ardour/audio_library.h"
#include "ardour/configuration.h"
#include "ardour/rc_configuration.h"
#include "ardour/profile.h"
#include "ardour/plugin_manager.h"
#include "ardour/audiosource.h"
@ -76,7 +76,7 @@
#include "i18n.h"
ARDOUR::Configuration* ARDOUR::Config = 0;
ARDOUR::RCConfiguration* ARDOUR::Config = 0;
ARDOUR::RuntimeProfile* ARDOUR::Profile = 0;
ARDOUR::AudioLibrary* ARDOUR::Library = 0;
@ -303,7 +303,7 @@ ARDOUR::init (bool use_vst, bool try_optimization)
BootMessage (_("Loading configuration"));
Config = new Configuration;
Config = new RCConfiguration;
if (Config->load_state ()) {
return -1;

View File

@ -367,7 +367,7 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframe
if (_alignment_style == ExistingMaterial) {
if (!Config->get_punch_in()) {
if (!_session.config.get_punch_in()) {
/* manual punch in happens at the correct transport frame
because the user hit a button. but to get alignment correct
@ -396,7 +396,7 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframe
} else {
if (Config->get_punch_in()) {
if (_session.config.get_punch_in()) {
first_recordable_frame += _roll_delay;
} else {
capture_start_frame -= _roll_delay;
@ -634,7 +634,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
commit_should_unlock = true;
adjust_capture_position = 0;
if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) {
OverlapType ot;
ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
@ -1325,7 +1325,7 @@ MidiDiskstream::engage_record_enable ()
g_atomic_int_set (&_record_enabled, 1);
if (_source_port && Config->get_monitoring_model() == HardwareMonitoring) {
_source_port->request_monitor_input (!(Config->get_auto_input() && rolling));
_source_port->request_monitor_input (!(_session.config.get_auto_input() && rolling));
}
// FIXME: Why is this necessary? Isn't needed for AudioDiskstream...
@ -1387,7 +1387,7 @@ MidiDiskstream::get_state ()
Location* pi;
if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
} else {
snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());

View File

@ -414,7 +414,7 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
just_meter_input (start_frame, end_frame, nframes);
}
if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
if (diskstream->record_enabled() && !can_record && !_session.config.get_auto_input()) {
/* not actually recording, but we want to hear the input material anyway,
at least potentially (depending on monitoring options)

View File

@ -421,8 +421,7 @@ Playlist::flush_notifications ()
// pending_bounds.sort (cmp);
for (RegionList::iterator r = pending_bounds.begin(); r != pending_bounds.end(); ++r) {
if (Config->get_layer_model() == MoveAddHigher) {
if (_session.config.get_layer_model() == MoveAddHigher) {
timestamp_layer_op (*r);
}
@ -1277,7 +1276,7 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region>
if (holding_state ()) {
pending_bounds.push_back (region);
} else {
if (Config->get_layer_model() == MoveAddHigher) {
if (_session.config.get_layer_model() == MoveAddHigher) {
/* it moved or changed length, so change the timestamp */
timestamp_layer_op (region);
}
@ -1964,7 +1963,7 @@ Playlist::relayer ()
/* sort according to the model */
if (Config->get_layer_model() == MoveAddHigher || Config->get_layer_model() == AddHigher) {
if (_session.config.get_layer_model() == MoveAddHigher || _session.config.get_layer_model() == AddHigher) {
RegionSortByLastLayerOp cmp;
copy.sort (cmp);
}
@ -2054,8 +2053,8 @@ void
Playlist::raise_region_to_top (boost::shared_ptr<Region> region)
{
/* does nothing useful if layering mode is later=higher */
if ((Config->get_layer_model() == MoveAddHigher) ||
(Config->get_layer_model() == AddHigher)) {
if ((_session.config.get_layer_model() == MoveAddHigher) ||
(_session.config.get_layer_model() == AddHigher)) {
timestamp_layer_op (region);
relayer ();
}
@ -2065,8 +2064,8 @@ void
Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
{
/* does nothing useful if layering mode is later=higher */
if ((Config->get_layer_model() == MoveAddHigher) ||
(Config->get_layer_model() == AddHigher)) {
if ((_session.config.get_layer_model() == MoveAddHigher) ||
(_session.config.get_layer_model() == AddHigher)) {
region->set_last_layer_op (0);
relayer ();
}

View File

@ -18,6 +18,7 @@
*/
#include "pbd/error.h"
#include "pbd/xml++.h"
#include "ardour/playlist.h"
#include "ardour/audioplaylist.h"

View File

@ -325,7 +325,7 @@ Route::process_output_buffers (BufferSet& bufs,
declick = _pending_declick;
const bool recording_without_monitoring = no_monitor && record_enabled()
&& (!Config->get_auto_input() || _session.actively_recording());
&& (!_session.config.get_auto_input() || _session.actively_recording());
/* -------------------------------------------------------------------------------------------

View File

@ -865,7 +865,7 @@ Session::reset_input_monitor_state ()
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
(*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !Config->get_auto_input());
(*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
}
}
} else {
@ -885,7 +885,7 @@ Session::auto_punch_start_changed (Location* location)
{
replace_event (Event::PunchIn, location->start());
if (get_record_enabled() && Config->get_punch_in()) {
if (get_record_enabled() && config.get_punch_in()) {
/* capture start has been changed, so save new pending state */
save_state ("", true);
}
@ -1091,7 +1091,7 @@ Session::enable_record ()
_last_record_location = _transport_frame;
deliver_mmc(MIDI::MachineControl::cmdRecordStrobe, _last_record_location);
if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
@ -1125,7 +1125,7 @@ Session::disable_record (bool rt_context, bool force)
if (rt_context)
deliver_mmc (MIDI::MachineControl::cmdRecordExit, _transport_frame);
if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@ -1150,7 +1150,7 @@ Session::step_back_from_record ()
if (g_atomic_int_get (&_record_status) == Recording) {
g_atomic_int_set (&_record_status, Enabled);
if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@ -1175,7 +1175,7 @@ Session::maybe_enable_record ()
save_state ("", true);
if (_transport_speed) {
if (!Config->get_punch_in()) {
if (!config.get_punch_in()) {
enable_record ();
}
} else {
@ -3726,7 +3726,7 @@ Session::available_capture_duration ()
{
float sample_bytes_on_disk = 4.0; // keep gcc happy
switch (Config->get_native_file_data_format()) {
switch (config.get_native_file_data_format()) {
case FormatFloat:
sample_bytes_on_disk = 4.0;
break;

View File

@ -366,7 +366,7 @@ Session::process_event (Event* ev)
case Event::PunchIn:
// cerr << "PunchIN at " << transport_frame() << endl;
if (Config->get_punch_in() && record_status() == Enabled) {
if (config.get_punch_in() && record_status() == Enabled) {
enable_record ();
}
remove = false;
@ -375,7 +375,7 @@ Session::process_event (Event* ev)
case Event::PunchOut:
// cerr << "PunchOUT at " << transport_frame() << endl;
if (Config->get_punch_out()) {
if (config.get_punch_out()) {
step_back_from_record ();
}
remove = false;

View File

@ -801,7 +801,7 @@ Session::send_full_time_code(nframes_t nframes)
// I don't understand this bit yet.. [DR]
if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
// start MTC quarter frame transmission on an even frame
SMPTE::increment( transmitting_smpte_time );
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame;
}
@ -928,8 +928,8 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes)
// Wrap quarter frame counter
next_quarter_frame_to_send = 0;
// Increment smpte time twice
SMPTE::increment( transmitting_smpte_time );
SMPTE::increment( transmitting_smpte_time );
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
// Re-calculate timing of first quarter frame
//smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false );
outbound_mtc_smpte_frame += 8 * quarter_frame_duration;

View File

@ -508,7 +508,7 @@ Session::follow_slave (nframes_t nframes)
slave_speed = 0.0f;
}
if (_slave->is_always_synced() || Config->get_timecode_source_is_synced()) {
if (_slave->is_always_synced() || config.get_timecode_source_is_synced()) {
/* if the TC source is synced, then we assume that its
speed is binary: 0.0 or 1.0
@ -530,7 +530,7 @@ Session::follow_slave (nframes_t nframes)
track_slave_state(slave_speed, slave_transport_frame, this_delta, starting);
if (slave_state == Running && !_slave->is_always_synced() && !Config->get_timecode_source_is_synced()) {
if (slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) {
if (_transport_speed != 0.0f) {

View File

@ -163,7 +163,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_transport_frame = 0;
end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
_end_location_is_free = true;
g_atomic_int_set (&_record_status, Disabled);
loop_changing = false;
play_loop = false;
@ -214,8 +213,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
/* default short fade = 15ms */
Crossfade::set_short_xfade_length ((nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate()));
SndFileSource::setup_standard_crossfades (frame_rate());
Crossfade::set_short_xfade_length ((nframes_t) floor (config.get_short_xfade_seconds() * frame_rate()));
SndFileSource::setup_standard_crossfades (*this, frame_rate());
last_mmc_step.tv_sec = 0;
last_mmc_step.tv_usec = 0;
@ -363,11 +362,7 @@ Session::second_stage_init (bool new_session)
ControlProtocolManager::instance().set_session (*this);
if (new_session) {
_end_location_is_free = true;
} else {
_end_location_is_free = false;
}
config.set_end_marker_is_free (new_session);
_state_of_the_state = Clean;
@ -861,7 +856,7 @@ Session::load_options (const XMLNode& node)
XMLProperty* prop;
LocaleGuard lg (X_("POSIX"));
Config->set_variables (node, ConfigVariableBase::Session);
config.set_variables (node);
/* now reset MIDI ports because the session can have its own
MIDI configuration.
@ -869,38 +864,9 @@ Session::load_options (const XMLNode& node)
setup_midi ();
if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
if ((prop = child->property ("val")) != 0) {
_end_location_is_free = (prop->value() == "yes");
}
}
return 0;
}
bool
Session::save_config_options_predicate (ConfigVariableBase::Owner owner) const
{
const ConfigVariableBase::Owner modified_by_session_or_user = (ConfigVariableBase::Owner)
(ConfigVariableBase::Session|ConfigVariableBase::Interface);
return owner & modified_by_session_or_user;
}
XMLNode&
Session::get_options () const
{
XMLNode* child;
LocaleGuard lg (X_("POSIX"));
XMLNode& option_root = Config->get_variables (mem_fun (*this, &Session::save_config_options_predicate));
child = option_root.add_child ("end-marker-is-free");
child->add_property ("val", _end_location_is_free ? "yes" : "no");
return option_root;
}
XMLNode&
Session::get_state()
{
@ -976,7 +942,7 @@ Session::state(bool full_state)
/* various options */
node->add_child_nocopy (get_options());
node->add_child_nocopy (config.get_variables ());
node->add_child_nocopy (_metadata->get_state());
@ -3055,7 +3021,7 @@ Session::config_changed (const char* parameter_name)
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
(*i)->monitor_input (!Config->get_auto_input());
(*i)->monitor_input (!config.get_auto_input());
}
}
}
@ -3066,7 +3032,7 @@ Session::config_changed (const char* parameter_name)
if ((location = _locations.auto_punch_location()) != 0) {
if (Config->get_punch_in ()) {
if (config.get_punch_in ()) {
replace_event (Event::PunchIn, location->start());
} else {
remove_event (location->start(), Event::PunchIn);
@ -3079,7 +3045,7 @@ Session::config_changed (const char* parameter_name)
if ((location = _locations.auto_punch_location()) != 0) {
if (Config->get_punch_out()) {
if (config.get_punch_out()) {
replace_event (Event::PunchOut, location->end());
} else {
clear_events (Event::PunchOut);
@ -3120,7 +3086,7 @@ Session::config_changed (const char* parameter_name)
} else if (PARAM_IS ("raid-path")) {
setup_raid_path (Config->get_raid_path());
setup_raid_path (config.get_raid_path());
} else if (PARAM_IS ("smpte-format")) {

View File

@ -52,7 +52,7 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt)
float
Session::smpte_frames_per_second() const
{
switch (Config->get_smpte_format()) {
switch (config.get_smpte_format()) {
case smpte_23976:
return 23.976;
@ -101,7 +101,7 @@ Session::smpte_frames_per_second() const
bool
Session::smpte_drop_frames() const
{
switch (Config->get_smpte_format()) {
switch (config.get_smpte_format()) {
case smpte_23976:
return false;
@ -185,7 +185,7 @@ int
Session::set_smpte_format (SmpteFormat format)
{
/* this will trigger any other changes needed */
Config->set_smpte_format (format);
config.set_smpte_format (format);
return 0;
}
@ -272,7 +272,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset
}
if (use_subframes) {
sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / Config->get_subframes_per_frame());
sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame());
}
if (use_offset) {
@ -334,10 +334,10 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset,
// Calculate exact number of (exceeding) smpte frames and fractional frames
smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame;
smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact );
smpte.subframes = (long) rint(smpte_frames_fraction * Config->get_subframes_per_frame());
smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame());
// XXX Not sure if this is necessary anymore...
if (smpte.subframes == Config->get_subframes_per_frame()) {
if (smpte.subframes == config.get_subframes_per_frame()) {
// This can happen with 24 fps (and 29.97 fps ?)
smpte_frames_left_exact = ceil( smpte_frames_left_exact );
smpte.subframes = 0;

View File

@ -184,7 +184,7 @@ Session::realtime_stop (bool abort)
waiting_for_sync_offset = true;
}
transport_sub_state = ((Config->get_slave_source() == None && Config->get_auto_return()) ? AutoReturning : 0);
transport_sub_state = ((Config->get_slave_source() == None && config.get_auto_return()) ? AutoReturning : 0);
}
void
@ -345,7 +345,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
/* stopped recording before current end */
if (_end_location_is_free) {
if (config.get_end_marker_is_free()) {
/* first capture for this session, move end back to where we are */
@ -366,7 +366,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
add_command (new MementoCommand<Location>(*loc, &before, &after));
}
_end_location_is_free = false;
config.set_end_marker_is_free (false);
_have_captured = true;
}
@ -391,7 +391,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
}
bool const auto_return_enabled =
(Config->get_slave_source() == None && Config->get_auto_return());
(Config->get_slave_source() == None && config.get_auto_return());
if (auto_return_enabled ||
(post_transport_work & PostTransportLocate) ||
@ -705,7 +705,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
}
}
if (transport_rolling() && (!auto_play_legal || !Config->get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
if (transport_rolling() && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
realtime_stop (false);
}
@ -744,7 +744,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
(*i)->monitor_input (!Config->get_auto_input());
(*i)->monitor_input (!config.get_auto_input());
}
}
}
@ -851,7 +851,7 @@ Session::set_transport_speed (double speed, bool abort)
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (Config->get_auto_input() && (*i)->record_enabled ()) {
if (config.get_auto_input() && (*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
(*i)->monitor_input (false);
}
@ -969,7 +969,7 @@ Session::start_transport ()
switch (record_status()) {
case Enabled:
if (!Config->get_punch_in()) {
if (!config.get_punch_in()) {
enable_record ();
}
break;
@ -1022,7 +1022,7 @@ Session::post_transport ()
if (post_transport_work & PostTransportLocate) {
if (((Config->get_slave_source() == None && (auto_play_legal && Config->get_auto_play())) && !_exporting) || (post_transport_work & PostTransportRoll)) {
if (((Config->get_slave_source() == None && (auto_play_legal && config.get_auto_play())) && !_exporting) || (post_transport_work & PostTransportRoll)) {
start_transport ();
} else {

View File

@ -32,6 +32,8 @@
#include "ardour/sndfile_helpers.h"
#include "ardour/utils.h"
#include "ardour/version.h"
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#include "i18n.h"
@ -517,7 +519,7 @@ SndFileSource::setup_broadcast_info (sframes_t when, struct tm& now, time_t tnow
return 0;
}
_broadcast_info->set_originator_ref ();
_broadcast_info->set_originator_ref (_session);
_broadcast_info->set_origination_time (&now);
/* now update header position taking header offset into account */
@ -773,13 +775,13 @@ SndFileSource::handle_header_position_change ()
}
void
SndFileSource::setup_standard_crossfades (nframes_t rate)
SndFileSource::setup_standard_crossfades (Session const & s, nframes_t rate)
{
/* This static method is assumed to have been called by the Session
before any DFS's are created.
*/
xfade_frames = (nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate);
xfade_frames = (nframes_t) floor ((s.config.get_destructive_xfade_msecs () / 1000.0) * rate);
delete [] out_coefficient;
delete [] in_coefficient;

View File

@ -26,8 +26,9 @@
#include "ardour/source_factory.h"
#include "ardour/sndfilesource.h"
#include "ardour/silentfilesource.h"
#include "ardour/configuration.h"
#include "ardour/rc_configuration.h"
#include "ardour/smf_source.h"
#include "ardour/session.h"
#ifdef HAVE_COREAUDIO
#define USE_COREAUDIO_FOR_FILES
@ -246,8 +247,8 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
if (type == DataType::AUDIO) {
boost::shared_ptr<Source> ret (new SndFileSource (s, path, embedded,
Config->get_native_file_data_format(),
Config->get_native_file_header_format(),
s.config.get_native_file_data_format(),
s.config.get_native_file_header_format(),
rate,
(destructive
? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)

View File

@ -275,7 +275,7 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
they monitor input always when stopped.and auto-input is engaged.
*/
if ((Config->get_monitoring_model() == SoftwareMonitoring)
&& (Config->get_auto_input () || _diskstream->record_enabled())) {
&& (_session.config.get_auto_input () || _diskstream->record_enabled())) {
send_silence = false;
} else {
send_silence = true;

View File

@ -378,19 +378,6 @@ slave_source_to_string (SlaveSource src)
}
}
/* I don't really like hard-coding these falloff rates here
* Probably should use a map of some kind that could be configured
* These rates are db/sec.
*/
#define METER_FALLOFF_OFF 0.0f
#define METER_FALLOFF_SLOWEST 6.6f // BBC standard
#define METER_FALLOFF_SLOW 8.6f // BBC standard
#define METER_FALLOFF_MEDIUM 20.0f
#define METER_FALLOFF_FAST 32.0f
#define METER_FALLOFF_FASTER 46.0f
#define METER_FALLOFF_FASTEST 70.0f
float
meter_falloff_to_float (MeterFalloff falloff)
{

View File

@ -171,6 +171,7 @@ def build(bld):
port_set.cc
processor.cc
quantize.cc
rc_configuration.cc
recent_sessions.cc
region.cc
region_factory.cc
@ -184,6 +185,7 @@ def build(bld):
session_butler.cc
session_click.cc
session_command.cc
session_configuration.cc
session_directory.cc
session_events.cc
session_export.cc

View File

@ -220,13 +220,13 @@ BasicUI::toggle_all_rec_enables ()
void
BasicUI::toggle_punch_in ()
{
Config->set_punch_in (!Config->get_punch_in());
session->config.set_punch_in (!session->config.get_punch_in());
}
void
BasicUI::toggle_punch_out ()
{
Config->set_punch_out (!Config->get_punch_out());
session->config.set_punch_out (!session->config.get_punch_out());
}
bool

View File

@ -53,13 +53,13 @@ struct Time {
}
};
Wrap increment( Time& smpte );
Wrap decrement( Time& smpte );
Wrap increment_subframes( Time& smpte );
Wrap decrement_subframes( Time& smpte );
Wrap increment_seconds( Time& smpte );
Wrap increment_minutes( Time& smpte );
Wrap increment_hours( Time& smpte );
Wrap increment( Time& smpte, uint32_t );
Wrap decrement( Time& smpte, uint32_t );
Wrap increment_subframes( Time& smpte, uint32_t );
Wrap decrement_subframes( Time& smpte, uint32_t );
Wrap increment_seconds( Time& smpte, uint32_t );
Wrap increment_minutes( Time& smpte, uint32_t );
Wrap increment_hours( Time& smpte, uint32_t );
void frames_floor( Time& smpte );
void seconds_floor( Time& smpte );
void minutes_floor( Time& smpte );

View File

@ -19,8 +19,8 @@
#define SMPTE_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours)
#define SMPTE_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes))
#include <control_protocol/smpte.h>
#include <ardour/configuration.h>
#include "control_protocol/smpte.h"
#include "ardour/rc_configuration.h"
namespace SMPTE {
@ -32,20 +32,20 @@ float Time::default_rate = 30.0;
* @return true if seconds wrap.
*/
Wrap
increment( Time& smpte )
increment( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
if (smpte.negative) {
if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
// We have a zero transition involving only subframes
smpte.subframes = ARDOUR::Config->get_subframes_per_frame() - smpte.subframes;
smpte.subframes = subframes_per_frame - smpte.subframes;
smpte.negative = false;
return SECONDS;
}
smpte.negative = false;
wrap = decrement( smpte );
wrap = decrement( smpte, subframes_per_frame );
if (!SMPTE_IS_ZERO( smpte )) {
smpte.negative = true;
}
@ -118,19 +118,19 @@ increment( Time& smpte )
* Realtime safe.
* @return true if seconds wrap. */
Wrap
decrement( Time& smpte )
decrement( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
if (smpte.negative || SMPTE_IS_ZERO(smpte)) {
smpte.negative = false;
wrap = increment( smpte );
wrap = increment( smpte, subframes_per_frame );
smpte.negative = true;
return wrap;
} else if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
// We have a zero transition involving only subframes
smpte.subframes = ARDOUR::Config->get_subframes_per_frame() - smpte.subframes;
smpte.subframes = subframes_per_frame - smpte.subframes;
smpte.negative = true;
return SECONDS;
}
@ -215,13 +215,13 @@ frames_floor( Time& smpte )
/** Increment @a smpte by one subframe */
Wrap
increment_subframes( Time& smpte )
increment_subframes( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
if (smpte.negative) {
smpte.negative = false;
wrap = decrement_subframes( smpte );
wrap = decrement_subframes( smpte, subframes_per_frame );
if (!SMPTE_IS_ZERO(smpte)) {
smpte.negative = true;
}
@ -229,9 +229,9 @@ increment_subframes( Time& smpte )
}
smpte.subframes++;
if (smpte.subframes >= ARDOUR::Config->get_subframes_per_frame()) {
if (smpte.subframes >= subframes_per_frame) {
smpte.subframes = 0;
increment( smpte );
increment( smpte, subframes_per_frame );
return FRAMES;
}
return NONE;
@ -240,13 +240,13 @@ increment_subframes( Time& smpte )
/** Decrement @a smpte by one subframe */
Wrap
decrement_subframes( Time& smpte )
decrement_subframes( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
if (smpte.negative) {
smpte.negative = false;
wrap = increment_subframes( smpte );
wrap = increment_subframes( smpte, subframes_per_frame );
smpte.negative = true;
return wrap;
}
@ -258,7 +258,7 @@ decrement_subframes( Time& smpte )
smpte.subframes = 1;
return FRAMES;
} else {
decrement( smpte );
decrement( smpte, subframes_per_frame );
smpte.subframes = 79;
return FRAMES;
}
@ -274,7 +274,7 @@ decrement_subframes( Time& smpte )
/** Go to next whole second (frames == 0 or frames == 2) */
Wrap
increment_seconds( Time& smpte )
increment_seconds( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
@ -283,7 +283,7 @@ increment_seconds( Time& smpte )
if (smpte.negative) {
// Wrap second if on second boundary
wrap = increment(smpte);
wrap = increment(smpte, subframes_per_frame);
// Go to lowest absolute frame value
seconds_floor( smpte );
if (SMPTE_IS_ZERO(smpte)) {
@ -307,7 +307,7 @@ increment_seconds( Time& smpte )
}
// Increment by one frame
wrap = increment( smpte );
wrap = increment( smpte, subframes_per_frame );
}
return wrap;
@ -349,7 +349,7 @@ seconds_floor( Time& smpte )
/** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
Wrap
increment_minutes( Time& smpte )
increment_minutes( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
@ -358,14 +358,14 @@ increment_minutes( Time& smpte )
if (smpte.negative) {
// Wrap if on minute boundary
wrap = increment_seconds( smpte );
wrap = increment_seconds( smpte, subframes_per_frame );
// Go to lowest possible value in this minute
minutes_floor( smpte );
} else {
// Go to highest possible second
smpte.seconds = 59;
// Wrap minute by incrementing second
wrap = increment_seconds( smpte );
wrap = increment_seconds( smpte, subframes_per_frame );
}
return wrap;
@ -389,7 +389,7 @@ minutes_floor( Time& smpte )
/** Go to next whole hour (minute = 0, second = 0, frame = 0) */
Wrap
increment_hours( Time& smpte )
increment_hours( Time& smpte, uint32_t subframes_per_frame )
{
Wrap wrap = NONE;
@ -398,12 +398,12 @@ increment_hours( Time& smpte )
if (smpte.negative) {
// Wrap if on hour boundary
wrap = increment_minutes( smpte );
wrap = increment_minutes( smpte, subframes_per_frame );
// Go to lowest possible value in this hour
hours_floor( smpte );
} else {
smpte.minutes = 59;
wrap = increment_minutes( smpte );
wrap = increment_minutes( smpte, subframes_per_frame );
}
return wrap;