save&restore for track monitor state

git-svn-id: svn://localhost/ardour2/branches/3.0@10263 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-10-21 12:34:29 +00:00
parent 96dcffcb22
commit 56da993d83
4 changed files with 54 additions and 8 deletions

View file

@ -89,7 +89,7 @@ class Track : public Route, public PublicDiskstream
XMLNode& get_state();
XMLNode& get_template();
virtual int set_state (const XMLNode&, int version) = 0;
int set_state (const XMLNode&, int version);
static void zero_diskstream_id_in_xml (XMLNode&);
boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
@ -162,7 +162,8 @@ class Track : public Route, public PublicDiskstream
PBD::Signal0<void> AlignmentStyleChanged;
protected:
virtual XMLNode& state (bool full) = 0;
XMLNode& state (bool full);
int _set_state (const XMLNode&, int version, bool);
boost::shared_ptr<Diskstream> _diskstream;
MeterPoint _saved_meter_point;

View file

@ -212,7 +212,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
XMLNode *child;
if (call_base) {
if (Route::_set_state (node, version, call_base)) {
if (Track::_set_state (node, version, call_base)) {
return -1;
}
}
@ -263,7 +263,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
XMLNode&
AudioTrack::state (bool full_state)
{
XMLNode& root (Route::state(full_state));
XMLNode& root (Track::state(full_state));
XMLNode* freeze_node;
char buf[64];

View file

@ -145,8 +145,10 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
const XMLProperty *prop;
XMLNodeConstIterator iter;
if (Route::_set_state (node, version, call_base)) {
return -1;
if (call_base) {
if (Track::_set_state (node, version, call_base)) {
return -1;
}
}
// No destructive MIDI tracks (yet?)
@ -209,7 +211,7 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
XMLNode&
MidiTrack::state(bool full_state)
{
XMLNode& root (Route::state(full_state));
XMLNode& root (Track::state(full_state));
XMLNode* freeze_node;
char buf[64];
@ -355,7 +357,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
_input->process_input (_meter, start_frame, end_frame, nframes);
}
if (diskstream->record_enabled() && !can_record && !_session.config.get_auto_input()) {
if (should_monitor_input ()) {
/* not actually recording, but we want to hear the input material anyway,
at least potentially (depending on monitoring options)

View file

@ -64,13 +64,46 @@ Track::init ()
return 0;
}
XMLNode&
Track::get_state ()
{
return state (true);
}
XMLNode&
Track::state (bool full)
{
XMLNode& root (Route::state (full));
root.add_property (X_("monitoring"), enum_2_string (_monitoring));
return root;
}
int
Track::set_state (const XMLNode& node, int version)
{
return _set_state (node, version, true);
}
int
Track::_set_state (const XMLNode& node, int version, bool call_base)
{
if (call_base) {
if (Route::_set_state (node, version, call_base)) {
return -1;
}
}
const XMLProperty* prop;
if ((prop = node.property (X_("monitoring"))) != 0) {
_monitoring = MonitorChoice (string_2_enum (prop->value(), _monitoring));
} else {
_monitoring = MonitorAuto;
}
return 0;
}
XMLNode&
Track::get_template ()
@ -740,3 +773,13 @@ Track::set_monitoring (MonitorChoice mc)
MonitoringChanged (); /* EMIT SIGNAL */
}
}
bool
Track::should_monitor_input ()
{
return (_monitoring & MonitorInput) ||
(!(_monitoring & MonitorDisk) &&
(diskstream->record_enabled() &&
!can_record &&
!_session.config.get_auto_input()));
}