_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;
_npan_buffers = 0;
pending_abort = false;
destructive_index = 0;
- current_trans = 0;
first_file_data_format_reset = true;
first_file_header_format_reset = true;
butler_thread = (pthread_t) 0;
/* 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;
/* handle this one in a different way than all others, so that its clear what happened */
catch (AudioEngine::PortRegistrationFailure& err) {
- error << _("Unable to create all required ports")
- << endmsg;
+ error << err.what() << endmsg;
return -1;
}
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;
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.
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()
{
/* various options */
- node->add_child_nocopy (get_options());
+ node->add_child_nocopy (config.get_variables ());
node->add_child_nocopy (_metadata->get_state());
DataType type = DataType::AUDIO;
const XMLProperty* prop = node.property("default-type");
- if (prop)
+
+ if (prop) {
type = DataType(prop->value());
+ }
assert(type != DataType::NIL);
}
void
-Session::begin_reversible_command (const string& name)
+Session::begin_reversible_command(const string& name)
{
- current_trans = new UndoTransaction;
- current_trans->set_name (name);
+ UndoTransaction* trans = new UndoTransaction();
+ trans->set_name(name);
+ if (!_current_trans.empty()) {
+ _current_trans.top()->add_command(trans);
+ }
+ _current_trans.push(trans);
}
void
-Session::commit_reversible_command (Command *cmd)
+Session::commit_reversible_command(Command *cmd)
{
+ assert(!_current_trans.empty());
struct timeval now;
if (cmd) {
- current_trans->add_command (cmd);
+ _current_trans.top()->add_command(cmd);
}
- if (current_trans->empty()) {
+ if (_current_trans.top()->empty()) {
+ _current_trans.pop();
return;
}
- gettimeofday (&now, 0);
- current_trans->set_timestamp (now);
+ gettimeofday(&now, 0);
+ _current_trans.top()->set_timestamp(now);
- _history.add (current_trans);
+ _history.add(_current_trans.top());
+ _current_trans.pop();
}
Session::GlobalRouteBooleanState
set_global_route_boolean (s, &Route::set_record_enable, src);
}
-#if 0
-UndoAction
-Session::global_mute_memento (void* src)
-{
- return sigc::bind (mem_fun (*this, &Session::set_global_mute), get_global_route_boolean (&Route::muted), src);
-}
-
-UndoAction
-Session::global_metering_memento (void* src)
-{
- return sigc::bind (mem_fun (*this, &Session::set_global_route_metering), get_global_route_metering (), src);
-}
-
-UndoAction
-Session::global_solo_memento (void* src)
-{
- return sigc::bind (mem_fun (*this, &Session::set_global_solo), get_global_route_boolean (&Route::soloed), src);
-}
-
-UndoAction
-Session::global_record_enable_memento (void* src)
-{
- return sigc::bind (mem_fun (*this, &Session::set_global_record_enable), get_global_route_boolean (&Route::record_enabled), src);
-}
-#endif
-
static bool
accept_all_non_peak_files (const string& path, void *arg)
{
Session::set_deletion_in_progress ()
{
_state_of_the_state = StateOfTheState (_state_of_the_state | Deletion);
+}
+void
+Session::clear_deletion_in_progress ()
+{
+ _state_of_the_state = StateOfTheState (_state_of_the_state & (~Deletion));
}
void
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());
}
}
}
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);
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);
} 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")) {