diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-01-19 00:03:55 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-01-19 00:03:55 +0000 |
commit | cd87dceb0fda44d7c8fcc2b7844f65def25edb23 (patch) | |
tree | 36ca3ef004a12e9edb3f41e708128188d54613c0 /libs/ardour | |
parent | 2a25079173c9614049457ec28cd2ed260f503b3f (diff) |
latched rec-enable
git-svn-id: svn://localhost/trunk/ardour2@277 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/configuration.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 5 | ||||
-rw-r--r-- | libs/ardour/configuration.cc | 21 | ||||
-rw-r--r-- | libs/ardour/session.cc | 25 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 1 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 14 |
7 files changed, 57 insertions, 16 deletions
diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index fd44d27329..c0a1301318 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -64,6 +64,9 @@ class Configuration : public Stateful XMLNode * get_keys() const; void set_keys(XMLNode *); + void set_latched_record_enable (bool yn); + bool get_latched_record_enable(); + void set_use_vst (bool yn); bool get_use_vst(); @@ -243,6 +246,8 @@ class Configuration : public Stateful bool quieten_at_speed_is_user; uint32_t midi_feedback_interval_ms; bool midi_feedback_interval_ms_is_user; + bool latched_record_enable; + bool latched_record_enable_is_user; XMLNode *key_node; bool user_configuration; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 2bdd99c614..297ce0d94a 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -317,7 +317,7 @@ class Session : public sigc::trackable, public Stateful bool record_enabling_legal () const; void maybe_enable_record (); - void disable_record (); + void disable_record (bool force = false); void step_back_from_record (); sigc::signal<void> going_away; @@ -332,8 +332,7 @@ class Session : public sigc::trackable, public Stateful /* Record status signals */ - sigc::signal<void> RecordEnabled; - sigc::signal<void> RecordDisabled; + sigc::signal<void> RecordStateChanged; /* Transport mechanism signals */ diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index 28f13aabb8..61d288ab51 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -291,6 +291,9 @@ Configuration::state (bool user_only) snprintf (buf, sizeof (buf), "%f", speed_quietning); node->add_child_nocopy(option_node("quieten-at-speed", buf)); } + if (!user_only || latched_record_enable_is_user) { + node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no")); + } /* use-vst is always per-user */ node->add_child_nocopy (option_node ("use-vst", use_vst?"yes":"no")); @@ -431,6 +434,8 @@ Configuration::set_state (const XMLNode& root) } } else if (option_name == "midi-feedback-interval-ms") { set_midi_feedback_interval_ms (atoi (option_value.c_str())); + } else if (option_name == "latched-record-enable") { + set_latched_record_enable (option_value == "yes"); } } @@ -526,6 +531,7 @@ Configuration::set_defaults () timecode_source_is_synced_is_user = false; quieten_at_speed_is_user = false; midi_feedback_interval_ms_is_user = false; + latched_record_enable_is_user = false; } Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node) @@ -1130,3 +1136,18 @@ Configuration::set_quieten_at_speed (float gain_coefficient) quieten_at_speed_is_user = true; } } + +void +Configuration::set_latched_record_enable (bool yn) +{ + latched_record_enable = yn; + if (user_configuration) { + latched_record_enable_is_user = true; + } +} + +bool +Configuration::get_latched_record_enable () +{ + return latched_record_enable; +} diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index bcc7c13bb5..90458fa2fd 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1249,21 +1249,30 @@ Session::enable_record () for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) { if ((*i)->record_enabled ()) { - //cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl; (*i)->monitor_input (true); } } } - RecordEnabled (); + RecordStateChanged (); } } void -Session::disable_record () +Session::disable_record (bool force) { - if (atomic_read (&_record_status) != Disabled) { - atomic_set (&_record_status, Disabled); + RecordState rs; + + if ((rs = (RecordState) atomic_read (&_record_status)) != Disabled) { + + if (!Config->get_latched_record_enable () || force) { + atomic_set (&_record_status, Disabled); + } else { + if (rs == Recording) { + atomic_set (&_record_status, Enabled); + } + } + send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordExit); if (Config->get_use_hardware_monitoring() && auto_input) { @@ -1275,15 +1284,13 @@ Session::disable_record () for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) { if ((*i)->record_enabled ()) { - //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl; (*i)->monitor_input (false); } } } - RecordDisabled (); + RecordStateChanged (); /* emit signal */ remove_pending_capture_state (); - } } @@ -1321,7 +1328,7 @@ Session::maybe_enable_record () } } else { send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordPause); - RecordEnabled (); /* EMIT SIGNAL */ + RecordStateChanged (); /* EMIT SIGNAL */ } set_dirty(); diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index f793dba956..2b7afa354a 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -623,7 +623,7 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc) save_state ("", true); atomic_set (&_record_status, Enabled); - RecordEnabled (); /* EMIT SIGNAL */ + RecordStateChanged (); /* EMIT SIGNAL */ request_transport_speed (1.0); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d580680f63..09834fa27a 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1242,7 +1242,6 @@ Session::get_template() disable_record (); - cerr << "STart get template\n"; return state(false); } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 096267d0dd..e2a9f23890 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -386,8 +386,18 @@ Session::non_realtime_stop (bool abort) deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame); if (did_record) { - atomic_set (&_record_status, Disabled); - RecordDisabled (); /* EMIT SIGNAL */ + + /* XXX its a little odd that we're doing this here + when realtime_stop(), which has already executed, + will have done this. + */ + + if (!Config->get_latched_record_enable()) { + atomic_set (&_record_status, Disabled); + } else { + atomic_set (&_record_status, Enabled); + } + RecordStateChanged (); /* emit signal */ } if ((post_transport_work & PostTransportLocate) && get_record_enabled()) { |