Move some code up from {Midi,Audio}Track to Track.

git-svn-id: svn://localhost/ardour2/branches/3.0@10303 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2011-10-24 22:54:25 +00:00
parent 24056f055f
commit 60978b5bc4
6 changed files with 47 additions and 62 deletions

View File

@@ -70,6 +70,9 @@ class AudioTrack : public Track
int _set_state (const XMLNode&, int);
private:
boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &);
int deprecated_use_diskstream_connections ();
void set_state_part_two ();
void set_state_part_three ();

View File

@@ -118,6 +118,9 @@ protected:
bool send_silence () const;
private:
virtual boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &);
boost::shared_ptr<MidiDiskstream> midi_diskstream () const;
void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes);

View File

@@ -217,6 +217,9 @@ class Track : public Route, public PublicDiskstream
framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&);
private:
virtual boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &) = 0;
void diskstream_playlist_changed ();
void diskstream_record_enable_changed ();
void diskstream_speed_changed ();

View File

@@ -208,8 +208,6 @@ int
AudioTrack::_set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
XMLNodeConstIterator iter;
XMLNode *child;
if (Track::_set_state (node, version)) {
return -1;
@@ -221,32 +219,6 @@ AudioTrack::_set_state (const XMLNode& node, int version)
_mode = Normal;
}
if (version >= 3000) {
if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, *child));
ds->do_refill_with_alloc ();
set_diskstream (ds);
}
}
/* set rec-enable control *AFTER* setting up diskstream, because it may want to operate
on the diskstream as it sets its own state
*/
XMLNodeList nlist;
XMLNodeConstIterator niter;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
@@ -285,8 +257,6 @@ AudioTrack::state (bool full_state)
}
root.add_property (X_("mode"), enum_2_string (_mode));
root.add_child_nocopy (_rec_enable_control->get_state());
root.add_child_nocopy (_diskstream->get_state ());
return root;
}
@@ -729,4 +699,8 @@ AudioTrack::bounceable () const
return n_inputs().n_audio() >= n_outputs().n_audio();
}
boost::shared_ptr<Diskstream>
AudioTrack::diskstream_factory (XMLNode const & node)
{
return boost::shared_ptr<Diskstream> (new AudioDiskstream (_session, node));
}

View File

@@ -143,7 +143,6 @@ int
MidiTrack::_set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
XMLNodeConstIterator iter;
if (Track::_set_state (node, version)) {
return -1;
@@ -166,34 +165,6 @@ MidiTrack::_set_state (const XMLNode& node, int version)
set_input_active (string_is_affirmative (prop->value()));
}
XMLNodeList nlist;
XMLNodeConstIterator niter;
XMLNode *child;
nlist = node.children();
if (version >= 3000) {
if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
boost::shared_ptr<MidiDiskstream> ds (new MidiDiskstream (_session, *child));
ds->do_refill_with_alloc ();
set_diskstream (ds);
}
}
/* set rec-enable control *AFTER* setting up diskstream, because it may
want to operate on the diskstream as it sets its own state
*/
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
@@ -233,8 +204,6 @@ MidiTrack::state(bool full_state)
}
root.add_property (X_("note-mode"), enum_2_string (_note_mode));
root.add_child_nocopy (_rec_enable_control->get_state());
root.add_child_nocopy (_diskstream->get_state ());
root.add_property ("step-editing", (_step_editing ? "yes" : "no"));
root.add_property ("note-mode", enum_2_string (_note_mode));
@@ -736,3 +705,8 @@ MidiTrack::track_input_active (IOChange change, void* /* src */)
}
}
boost::shared_ptr<Diskstream>
MidiTrack::diskstream_factory (XMLNode const & node)
{
return boost::shared_ptr<Diskstream> (new MidiDiskstream (_session, node));
}

View File

@@ -76,6 +76,8 @@ Track::state (bool full)
{
XMLNode& root (Route::state (full));
root.add_property (X_("monitoring"), enum_2_string (_monitoring));
root.add_child_nocopy (_rec_enable_control->get_state());
root.add_child_nocopy (_diskstream->get_state ());
return root;
}
@@ -92,6 +94,32 @@ Track::_set_state (const XMLNode& node, int version)
return -1;
}
XMLNode* child;
if (version >= 3000) {
if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
boost::shared_ptr<Diskstream> ds = diskstream_factory (*child);
ds->do_refill_with_alloc ();
set_diskstream (ds);
}
}
/* set rec-enable control *AFTER* setting up diskstream, because it may
want to operate on the diskstream as it sets its own state
*/
XMLNodeList nlist = node.children();
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
child = *niter;
XMLProperty* prop;
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
const XMLProperty* prop;
if ((prop = node.property (X_("monitoring"))) != 0) {