+/// Export channel for exporting from different positions in a route
+class LIBARDOUR_API RouteExportChannel : public ExportChannel
+{
+ class ProcessorRemover; // fwd declaration
+
+ public:
+ RouteExportChannel(boost::shared_ptr<CapturingProcessor> processor, size_t channel,
+ boost::shared_ptr<ProcessorRemover> remover);
+ ~RouteExportChannel();
+
+ static void create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route);
+
+ public: // ExportChannel interface
+ void set_max_buffer_size(samplecnt_t samples);
+
+ void read (Sample const *& data, samplecnt_t samples) const;
+ bool empty () const { return false; }
+
+ void get_state (XMLNode * node) const;
+ void set_state (XMLNode * node, Session & session);
+
+ bool operator< (ExportChannel const & other) const;
+
+ private:
+
+ // Removes the processor from the track when deleted
+ class ProcessorRemover {
+ public:
+ ProcessorRemover (boost::shared_ptr<Route> route, boost::shared_ptr<CapturingProcessor> processor)
+ : route (route), processor (processor) {}
+ ~ProcessorRemover();
+ private:
+ boost::shared_ptr<Route> route;
+ boost::shared_ptr<CapturingProcessor> processor;
+ };
+
+ boost::shared_ptr<CapturingProcessor> processor;
+ size_t channel;
+ // Each channel keeps a ref to the remover. Last one alive
+ // will cause the processor to be removed on deletion.
+ boost::shared_ptr<ProcessorRemover> remover;
+};
+