From a406d9183adc67075a4e802fd8254c2560df9964 Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Sun, 16 Jan 2011 19:41:11 +0000 Subject: Make stem export export from right before any processors. The dialog does not support exporting from the outputs anymore, sorry. Will add options later... git-svn-id: svn://localhost/ardour2/branches/3.0@8520 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/buffer_set.h | 6 +++ libs/ardour/ardour/capturing_processor.h | 53 +++++++++++++++++++++++ libs/ardour/ardour/export_channel.h | 52 ++++++++++++++++++++-- libs/ardour/ardour/export_channel_configuration.h | 5 +++ libs/ardour/ardour/route.h | 2 + 5 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 libs/ardour/ardour/capturing_processor.h (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index fc5ef96449..f5ac1aee61 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -97,10 +97,16 @@ public: AudioBuffer& get_audio(size_t i) { return (AudioBuffer&)get(DataType::AUDIO, i); } + const AudioBuffer& get_audio(size_t i) const { + return (const AudioBuffer&)get(DataType::AUDIO, i); + } MidiBuffer& get_midi(size_t i) { return (MidiBuffer&)get(DataType::MIDI, i); } + const MidiBuffer& get_midi(size_t i) const { + return (const MidiBuffer&)get(DataType::MIDI, i); + } #ifdef HAVE_SLV2 /** Get a MIDI buffer translated into an LV2 MIDI buffer for use with plugins. diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h new file mode 100644 index 0000000000..2e2db78091 --- /dev/null +++ b/libs/ardour/ardour/capturing_processor.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2011 Paul Davis + Author: Sakari Bergen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __ardour_capturing_processor_h__ +#define __ardour_capturing_processor_h__ + +#include "ardour/processor.h" + +namespace ARDOUR { + +class CapturingProcessor : public Processor +{ + public: + CapturingProcessor (Session & session); + ~CapturingProcessor(); + + public: // main interface + BufferSet const & get_capture_buffers() const { return capture_buffers; } + + public: // Processor overrides + bool display_to_user() const { return false; } + int set_block_size (pframes_t nframes); + void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool result_required); + bool configure_io (ChanCount in, ChanCount out); + bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; + + private: + + void realloc_buffers(); + + framecnt_t block_size; + BufferSet capture_buffers; +}; + +} // namespace ARDOUR + +#endif // __ardour_capturing_processor_h__ diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h index 34d6263976..5e42956cdb 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -38,6 +38,7 @@ class Session; class AudioTrack; class AudioPort; class AudioRegion; +class CapturingProcessor; /// Export channel base class interface for different source types class ExportChannel : public boost::less_than_comparable @@ -48,7 +49,7 @@ class ExportChannel : public boost::less_than_comparable virtual void set_max_buffer_size(framecnt_t frames) { } - virtual void read (Sample *& data, framecnt_t frames) const = 0; + virtual void read (Sample const *& data, framecnt_t frames) const = 0; virtual bool empty () const = 0; /// Adds state to node passed @@ -81,7 +82,7 @@ class PortExportChannel : public ExportChannel PortExportChannel (); void set_max_buffer_size(framecnt_t frames); - void read (Sample *& data, framecnt_t frames) const; + void read (Sample const *& data, framecnt_t frames) const; bool empty () const { return ports.empty(); } void get_state (XMLNode * node) const; @@ -112,7 +113,7 @@ class RegionExportChannelFactory ~RegionExportChannelFactory (); ExportChannelPtr create (uint32_t channel); - void read (uint32_t channel, Sample *& data, framecnt_t frames_to_read); + void read (uint32_t channel, Sample const *& data, framecnt_t frames_to_read); private: @@ -142,7 +143,7 @@ class RegionExportChannel : public ExportChannel friend class RegionExportChannelFactory; public: - void read (Sample *& data, framecnt_t frames_to_read) const { factory.read (channel, data, frames_to_read); } + void read (Sample const *& data, framecnt_t frames_to_read) const { factory.read (channel, data, frames_to_read); } void get_state (XMLNode * /*node*/) const {}; void set_state (XMLNode * /*node*/, Session & /*session*/) {}; bool empty () const { return false; } @@ -160,6 +161,49 @@ class RegionExportChannel : public ExportChannel uint32_t channel; }; +/// Export channel for exporting from different positions in a route +class RouteExportChannel : public ExportChannel +{ + class ProcessorRemover; // fwd declaration + + public: + RouteExportChannel(boost::shared_ptr processor, size_t channel, + boost::shared_ptr remover); + ~RouteExportChannel(); + + static void create_from_route(std::list & result, Route & route); + + public: // ExportChannel interface + void set_max_buffer_size(framecnt_t frames); + + void read (Sample const *& data, framecnt_t frames) 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 (Route & route, boost::shared_ptr processor) + : route (route), processor (processor) {} + ~ProcessorRemover(); + private: + Route & route; + boost::shared_ptr processor; + }; + + boost::shared_ptr 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 remover; +}; + } // namespace ARDOUR #endif diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index b5b9b65bf7..5701be576b 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -23,6 +23,8 @@ #include #include +#include + #include #include "ardour/export_channel.h" @@ -70,6 +72,9 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this add_export_point(/* Add some argument for placement later */); /** A record of the stream configuration at some point in the processor list. * Used to return where and why an processor list configuration request failed. -- cgit v1.2.3