+
+
+RouteExportChannel::RouteExportChannel(boost::shared_ptr<CapturingProcessor> processor, size_t channel,
+ boost::shared_ptr<ProcessorRemover> remover)
+ : processor (processor)
+ , channel (channel)
+ , remover (remover)
+{
+}
+
+RouteExportChannel::~RouteExportChannel()
+{
+}
+
+void
+RouteExportChannel::create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route)
+{
+ boost::shared_ptr<CapturingProcessor> processor = route->add_export_point();
+ uint32_t channels = processor->input_streams().n_audio();
+
+ boost::shared_ptr<ProcessorRemover> remover (new ProcessorRemover (route, processor));
+ result.clear();
+ for (uint32_t i = 0; i < channels; ++i) {
+ result.push_back (ExportChannelPtr (new RouteExportChannel (processor, i, remover)));
+ }
+}
+
+void
+RouteExportChannel::set_max_buffer_size(framecnt_t frames)
+{
+ if (processor) {
+ processor->set_block_size (frames);
+ }
+}
+
+void
+RouteExportChannel::read (Sample const *& data, framecnt_t frames) const
+{
+ assert(processor);
+ AudioBuffer const & buffer = processor->get_capture_buffers().get_audio (channel);
+ assert (frames <= (framecnt_t) buffer.size());
+ data = buffer.data();
+}
+
+void
+RouteExportChannel::get_state (XMLNode *) const
+{
+ // TODO
+}
+
+void
+RouteExportChannel::set_state (XMLNode *, Session &)
+{
+ // TODO
+}
+
+bool
+RouteExportChannel::operator< (ExportChannel const & other) const
+{
+ RouteExportChannel const * rec;
+ if ((rec = dynamic_cast<RouteExportChannel const *>(&other)) == 0) {
+ return this < &other;
+ }
+
+ if (processor.get() == rec->processor.get()) {
+ return channel < rec->channel;
+ }
+ return processor.get() < rec->processor.get();
+}
+
+RouteExportChannel::ProcessorRemover::~ProcessorRemover()
+{
+ route->remove_processor (processor);
+}