13
0

mechanism to allow Track (or other Route-derived type) to add its own processors at the right time

This commit is contained in:
Paul Davis 2017-07-21 17:03:04 -04:00
parent e5ea6d81d8
commit 4bfc5ddf71
4 changed files with 29 additions and 17 deletions

View File

@ -741,6 +741,7 @@ private:
void setup_invisible_processors ();
virtual void setup_invisible_processors_oh_children_of_mine (ProcessorList&) {}
virtual void add_processors_oh_children_of_mine () {}
void unpan ();

View File

@ -256,6 +256,7 @@ class LIBARDOUR_API Track : public Route, public Recordable
private:
void parameter_changed (std::string const & p);
void setup_invisible_processors_oh_children_of_mine (ProcessorList&);
void add_processors_oh_children_of_mine ();
std::string _diskstream_name;
};

View File

@ -239,6 +239,10 @@ Route::init ()
_monitor_control->activate ();
}
/* give derived classes a chance to add processors before we configure */
add_processors_oh_children_of_mine ();
/* now that we have _meter, its safe to connect to this */
{

View File

@ -85,26 +85,10 @@ Track::init ()
return -1;
}
DiskIOProcessor::Flag dflags = DiskIOProcessor::Recordable;
if (_mode == Destructive && !Profile->get_trx()) {
dflags = DiskIOProcessor::Flag (dflags | DiskIOProcessor::Destructive);
} else if (_mode == NonLayered){
dflags = DiskIOProcessor::Flag(dflags | DiskIOProcessor::NonLayered);
}
_disk_reader.reset (new DiskReader (_session, name(), dflags));
_disk_reader->set_block_size (_session.get_block_size ());
_disk_reader->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
_disk_writer.reset (new DiskWriter (_session, name(), dflags));
_disk_writer->set_block_size (_session.get_block_size ());
_disk_writer->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
use_new_playlist ();
/* disk writer and reader processors will be added when Route calls
* setup_invisible_processors_oh_children_of_mine ().
* add_processors_oh_children_of_mine ().
*/
boost::shared_ptr<Route> rp (boost::dynamic_pointer_cast<Route> (shared_from_this()));
@ -130,6 +114,28 @@ Track::init ()
return 0;
}
void
Track::add_processors_oh_children_of_mine ()
{
cerr << name() << " ::apocom(), create DW + DR\n";
DiskIOProcessor::Flag dflags = DiskIOProcessor::Recordable;
if (_mode == Destructive && !Profile->get_trx()) {
dflags = DiskIOProcessor::Flag (dflags | DiskIOProcessor::Destructive);
} else if (_mode == NonLayered){
dflags = DiskIOProcessor::Flag(dflags | DiskIOProcessor::NonLayered);
}
_disk_reader.reset (new DiskReader (_session, name(), dflags));
_disk_reader->set_block_size (_session.get_block_size ());
_disk_reader->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
_disk_writer.reset (new DiskWriter (_session, name(), dflags));
_disk_writer->set_block_size (_session.get_block_size ());
_disk_writer->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
}
void
Track::input_changed ()
{