diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-21 12:34:29 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-10-21 12:34:29 +0000 |
commit | 56da993d83cc2e27cd4575becdefcefecf926f16 (patch) | |
tree | 649a124afea0dc6757cd4cec6e284cb491d19b02 /libs | |
parent | 96dcffcb222bc920cef9bfbaffb0548138352d65 (diff) |
save&restore for track monitor state
git-svn-id: svn://localhost/ardour2/branches/3.0@10263 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/track.h | 5 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 4 | ||||
-rw-r--r-- | libs/ardour/midi_track.cc | 10 | ||||
-rw-r--r-- | libs/ardour/track.cc | 43 |
4 files changed, 54 insertions, 8 deletions
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 9aefc4f403..b467ffb316 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -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; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 64e83ddb0d..99217cfc0e 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -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]; diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index fe2dc74b72..fb323e12dc 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -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) diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 218120a924..fdb1665a31 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -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())); +} |