latched rec-enable

git-svn-id: svn://localhost/trunk/ardour2@277 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-01-19 00:03:55 +00:00
parent 2a25079173
commit cd87dceb0f
14 changed files with 71 additions and 21 deletions

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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);

View File

@@ -1242,7 +1242,6 @@ Session::get_template()
disable_record ();
cerr << "STart get template\n";
return state(false);
}

View File

@@ -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()) {