summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2009-12-27 14:46:23 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2009-12-27 14:46:23 +0000
commitdde0848a984e06cbc1d4117d9cffa75c191f3b39 (patch)
tree11f3a5fe94ac792e753297e16e4e80dd7e296aea /libs/ardour/ardour
parent35c72a53b4c6bbc61b4b86db9de629e18362b48d (diff)
Re-integrate export-optimization branch.
Export now happens directly to file (unless normalizing is required), and can be easily optimized even further. The Session process connection is still broken during export (as it was before this commit also). git-svn-id: svn://localhost/ardour2/branches/3.0@6401 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audioengine.h8
-rw-r--r--libs/ardour/ardour/export.h100
-rw-r--r--libs/ardour/ardour/export_channel.h4
-rw-r--r--libs/ardour/ardour/export_channel_configuration.h52
-rw-r--r--libs/ardour/ardour/export_file_io.h177
-rw-r--r--libs/ardour/ardour/export_format_base.h12
-rw-r--r--libs/ardour/ardour/export_format_specification.h3
-rw-r--r--libs/ardour/ardour/export_graph_builder.h225
-rw-r--r--libs/ardour/ardour/export_handler.h76
-rw-r--r--libs/ardour/ardour/export_processor.h127
-rw-r--r--libs/ardour/ardour/export_profile_manager.h3
-rw-r--r--libs/ardour/ardour/export_timespan.h19
-rw-r--r--libs/ardour/ardour/export_utilities.h146
-rw-r--r--libs/ardour/ardour/gdither.h92
-rw-r--r--libs/ardour/ardour/gdither_types.h48
-rw-r--r--libs/ardour/ardour/gdither_types_internal.h74
-rw-r--r--libs/ardour/ardour/graph.h101
17 files changed, 285 insertions, 982 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index b22ca9790f..cf0eafe288 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -74,8 +74,8 @@ class AudioEngine : public SessionHandlePtr
Glib::Mutex& process_lock() { return _process_lock; }
- nframes_t frame_rate();
- nframes_t frames_per_cycle();
+ nframes_t frame_rate() const;
+ nframes_t frames_per_cycle() const;
size_t raw_buffer_size(DataType t);
@@ -230,9 +230,9 @@ _ the regular process() call to session->process() is not made.
bool session_remove_pending;
bool _running;
bool _has_run;
- nframes_t _buffer_size;
+ mutable nframes_t _buffer_size;
std::map<DataType,size_t> _raw_buffer_sizes;
- nframes_t _frame_rate;
+ mutable nframes_t _frame_rate;
/// number of frames between each check for changes in monitor input
nframes_t monitor_check_interval;
/// time of the last monitor check in frames
diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h
deleted file mode 100644
index ee533d4c6d..0000000000
--- a/libs/ardour/ardour/export.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- Copyright (C) 2000-2007 Paul Davis
-
- 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_export_h__
-#define __ardour_export_h__
-
-#include <map>
-#include <vector>
-#include <string>
-
-
-#include <sndfile.h>
-#include <samplerate.h>
-
-#include "ardour/ardour.h"
-#include "ardour/gdither.h"
-
-namespace ARDOUR
-{
- class Port;
-
- typedef std::pair<Port *, uint32_t> PortChannelPair;
- typedef std::map<uint32_t, std::vector<PortChannelPair> > ExportPortMap;
-
- struct ExportSpecification : public SF_INFO, public PBD::ScopedConnectionList {
-
- ExportSpecification();
- ~ExportSpecification ();
-
- void init ();
- void clear ();
-
- int prepare (nframes_t blocksize, nframes_t frame_rate);
-
- int process (nframes_t nframes);
-
- /* set by the user */
-
- std::string path;
- nframes_t sample_rate;
-
- int src_quality;
- SNDFILE* out;
- uint32_t channels;
- ExportPortMap port_map;
- nframes_t start_frame;
- nframes_t end_frame;
- GDitherType dither_type;
- bool do_freewheel;
-
- /* used exclusively during export */
-
- nframes_t frame_rate;
- GDither dither;
- float* dataF;
- float* dataF2;
- float* leftoverF;
- nframes_t leftover_frames;
- nframes_t max_leftover_frames;
- void* output_data;
- nframes_t out_samples_max;
- uint32_t sample_bytes;
- uint32_t data_width;
-
- nframes_t total_frames;
- SF_INFO sfinfo;
- SRC_DATA src_data;
- SRC_STATE* src_state;
- nframes_t pos;
-
- PBD::ScopedConnection freewheel_connection;
-
- /* shared between UI thread and audio thread */
-
- volatile float progress; /* audio thread sets this */
- volatile bool stop; /* UI sets this */
- volatile bool running; /* audio thread sets to false when export is done */
-
- int status;
- };
-
-} // namespace ARDOUR
-
-#endif /* __ardour_export_h__ */
diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h
index 73e3406869..51ecabee25 100644
--- a/libs/ardour/ardour/export_channel.h
+++ b/libs/ardour/ardour/export_channel.h
@@ -25,6 +25,7 @@
#include <boost/signals2.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/operators.hpp>
#include "ardour/audioregion.h"
#include "ardour/buffer_set.h"
@@ -36,7 +37,7 @@ class AudioTrack;
class AudioPort;
/// Export channel base class interface for different source types
-class ExportChannel
+class ExportChannel : public boost::less_than_comparable<ExportChannel>
{
public:
@@ -57,6 +58,7 @@ class ExportChannel
/// Safe pointer for storing ExportChannels in ordered STL containers
class ExportChannelPtr : public boost::shared_ptr<ExportChannel>
+ , public boost::less_than_comparable<ExportChannel>
{
public:
ExportChannelPtr () {}
diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h
index 9ca49f452d..4b027cc020 100644
--- a/libs/ardour/ardour/export_channel_configuration.h
+++ b/libs/ardour/ardour/export_channel_configuration.h
@@ -45,34 +45,15 @@ class Session;
class ExportChannelConfiguration
{
- private:
- typedef boost::shared_ptr<ExportProcessor> ProcessorPtr;
- typedef boost::shared_ptr<ExportTimespan> TimespanPtr;
- typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr;
- typedef boost::shared_ptr<ExportFilename> FilenamePtr;
-
- typedef std::pair<FormatPtr, FilenamePtr> FileConfig;
- typedef std::list<FileConfig> FileConfigList;
-
- /// Struct for threading, acts like a pointer to a ExportChannelConfiguration
- struct WriterThread {
- WriterThread (ExportChannelConfiguration & channel_config) :
- channel_config (channel_config), running (false) {}
-
- ExportChannelConfiguration * operator-> () { return &channel_config; }
- ExportChannelConfiguration & operator* () { return channel_config; }
-
- ExportChannelConfiguration & channel_config;
-
- pthread_t thread;
- bool running;
- };
private:
friend class ExportElementFactory;
ExportChannelConfiguration (Session & session);
public:
+ bool operator== (ExportChannelConfiguration const & other) const { return channels == other.channels; }
+ bool operator!= (ExportChannelConfiguration const & other) const { return channels != other.channels; }
+
XMLNode & get_state ();
int set_state (const XMLNode &);
@@ -89,40 +70,13 @@ class ExportChannelConfiguration
uint32_t get_n_chans () const { return channels.size(); }
void register_channel (ExportChannelPtr channel) { channels.push_back (channel); }
- void register_file_config (FormatPtr format, FilenamePtr filename) { file_configs.push_back (FileConfig (format, filename)); }
-
void clear_channels () { channels.clear (); }
- /// Writes all files for this channel config @return true if a new thread was spawned
- bool write_files (boost::shared_ptr<ExportProcessor> new_processor);
- PBD::Signal0<void> FilesWritten;
-
- // Tells the handler the necessary information for it to handle tempfiles
- void register_with_timespan (TimespanPtr timespan);
-
- void unregister_all ();
-
private:
- typedef boost::shared_ptr<ExportStatus> ExportStatusPtr;
-
Session & session;
- // processor has to be prepared before doing this.
- void write_file ();
-
- /// The actual write files, needed for threading
- static void * _write_files (void *arg);
- WriterThread writer_thread;
- ProcessorPtr processor;
- ExportStatusPtr status;
-
- bool files_written;
-
- TimespanPtr timespan;
ChannelList channels;
- FileConfigList file_configs;
-
bool split; // Split to mono files
Glib::ustring _name;
};
diff --git a/libs/ardour/ardour/export_file_io.h b/libs/ardour/ardour/export_file_io.h
deleted file mode 100644
index 48d5984f78..0000000000
--- a/libs/ardour/ardour/export_file_io.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- Copyright (C) 2008 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_export_file_io_h__
-#define __ardour_export_file_io_h__
-
-#include <stdint.h>
-#include <utility>
-
-#include <boost/shared_ptr.hpp>
-#include <glibmm/ustring.h>
-#include "ardour/sndfile_helpers.h"
-
-#include "ardour/graph.h"
-#include "ardour/types.h"
-#include "ardour/ardour.h"
-#include "ardour/export_format_specification.h"
-#include "ardour/export_utilities.h"
-
-namespace ARDOUR
-{
-
-/// Common part for all export file writers
-class ExportFileWriter
-{
- public:
- virtual ~ExportFileWriter () {}
-
- std::string filename () const { return _filename; }
- nframes_t position () const { return _position; }
-
- void set_position (nframes_t position) { _position = position; }
-
- protected:
- ExportFileWriter (std::string filename) : _filename (filename) {}
-
- std::string _filename;
- nframes_t _position;
-};
-
-/// Common interface for templated libsndfile writers
-class SndfileWriterBase : public ExportFileWriter
-{
- public:
-
- SNDFILE * get_sndfile () const { return sndfile; }
-
- protected:
- SndfileWriterBase (int channels, nframes_t samplerate, int format, std::string const & path);
- virtual ~SndfileWriterBase ();
-
- SF_INFO sf_info;
- SNDFILE * sndfile;
-};
-
-
-/// Template parameter specific parts of sndfile writer
-template <typename T>
-class SndfileWriter : public SndfileWriterBase, public GraphSink<T>
-{
- // FIXME: having this protected doesn't work with Apple's gcc
- // Should only be created vie ExportFileFactory and derived classes
- public: // protected
- friend class ExportFileFactory;
- SndfileWriter (int channels, nframes_t samplerate, int format, std::string const & path);
-
- public:
- nframes_t write (T * data, nframes_t frames);
- virtual ~SndfileWriter () {}
-
- protected:
-
- sf_count_t (*write_func)(SNDFILE *, const T *, sf_count_t);
-
- private:
- void init (); // Inits write function
-};
-
-/// Writes and reads a RAW tempfile (file aquired with tmpfile())
-class ExportTempFile : public SndfileWriter<float>, public GraphSource<float>
-{
- public:
- ExportTempFile (uint32_t channels, nframes_t samplerate);
- ~ExportTempFile () {}
-
- /// Causes the file to be read from the beginning again
- void reset_read () { reading = false; }
- nframes_t read (float * data, nframes_t frames);
-
- /* Silence management */
-
- nframes_t trim_beginning (bool yn = true);
- nframes_t trim_end (bool yn = true);
-
- void set_silence_beginning (nframes_t frames);
- void set_silence_end (nframes_t frames);
-
- private:
- /* File access */
-
- sf_count_t get_length ();
- sf_count_t get_position ();
- sf_count_t get_read_position (); // get position seems to default to the write pointer
- sf_count_t locate_to (nframes_t frames);
- sf_count_t _read (float * data, nframes_t frames);
-
- uint32_t channels;
- bool reading;
-
- /* Silence related */
-
- /* start and end are used by read() */
-
- nframes_t start;
- nframes_t end;
-
- /* these are the silence processing results and state */
-
- void process_beginning ();
- void process_end ();
-
- bool beginning_processed;
- bool end_processed;
-
- nframes_t silent_frames_beginning;
- nframes_t silent_frames_end;
-
- /* Silence to add to start and end */
-
- nframes_t silence_beginning;
- nframes_t silence_end;
-
- /* Takes care that the end postion gets set at some stage */
-
- bool end_set;
-
-};
-
-class ExportFileFactory
-{
- public:
- typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr;
- typedef GraphSink<float> FloatSink;
- typedef boost::shared_ptr<FloatSink> FloatSinkPtr;
- typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr;
-
- typedef std::pair<FloatSinkPtr, FileWriterPtr> FilePair;
-
- static FilePair create (FormatPtr format, uint32_t channels, Glib::ustring const & filename);
- static bool check (FormatPtr format, uint32_t channels);
-
- private:
-
- static FilePair create_sndfile (FormatPtr format, unsigned int channels, Glib::ustring const & filename);
- static bool check_sndfile (FormatPtr format, unsigned int channels);
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_export_file_io_h__ */
diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h
index dceb943e62..08bcbfb2bd 100644
--- a/libs/ardour/ardour/export_format_base.h
+++ b/libs/ardour/ardour/export_format_base.h
@@ -28,9 +28,11 @@
#include <sndfile.h>
#include <samplerate.h>
-#include "ardour/gdither_types.h"
+
#include "ardour/ardour.h"
+#include "audiographer/sample_format_converter.h"
+
namespace ARDOUR
{
@@ -76,10 +78,10 @@ class ExportFormatBase {
};
enum DitherType {
- D_None = GDitherNone,
- D_Rect = GDitherRect,
- D_Tri = GDitherTri,
- D_Shaped = GDitherShaped
+ D_None = AudioGrapher::D_None,
+ D_Rect = AudioGrapher::D_Rect,
+ D_Tri = AudioGrapher::D_Tri,
+ D_Shaped = AudioGrapher::D_Shaped
};
enum Quality {
diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h
index 628c70d25a..3b9382237c 100644
--- a/libs/ardour/ardour/export_format_specification.h
+++ b/libs/ardour/ardour/export_format_specification.h
@@ -126,6 +126,9 @@ class ExportFormatSpecification : public ExportFormatBase {
nframes_t silence_beginning () const { return _silence_beginning.get_frames (sample_rate()); }
nframes_t silence_end () const { return _silence_end.get_frames (sample_rate()); }
+ nframes_t silence_beginning (nframes_t samplerate) const { return _silence_beginning.get_frames (samplerate); }
+ nframes_t silence_end (nframes_t samplerate) const { return _silence_end.get_frames (samplerate); }
+
AnyTime silence_beginning_time () const { return _silence_beginning; }
AnyTime silence_end_time () const { return _silence_end; }
diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h
new file mode 100644
index 0000000000..1244afd647
--- /dev/null
+++ b/libs/ardour/ardour/export_graph_builder.h
@@ -0,0 +1,225 @@
+/*
+ Copyright (C) 2009 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_export_graph_builder_h__
+#define __ardour_export_graph_builder_h__
+
+#include "ardour/ardour.h"
+#include "ardour/export_handler.h"
+#include "ardour/export_channel.h"
+#include "ardour/export_format_base.h"
+
+#include "audiographer/identity_vertex.h"
+
+#include <glibmm/threadpool.h>
+
+namespace AudioGrapher {
+ class SampleRateConverter;
+ class PeakReader;
+ class Normalizer;
+ template <typename T> class SampleFormatConverter;
+ template <typename T> class Interleaver;
+ template <typename T> class SndfileWriter;
+ template <typename T> class SilenceTrimmer;
+ template <typename T> class TmpFile;
+ template <typename T> class Threader;
+ template <typename T> class AllocatingProcessContext;
+}
+
+namespace ARDOUR
+{
+
+class ExportGraphBuilder
+{
+ private:
+ typedef ExportHandler::FileSpec FileSpec;
+ typedef ExportElementFactory::FilenamePtr FilenamePtr;
+
+ typedef boost::shared_ptr<AudioGrapher::Sink<Sample> > FloatSinkPtr;
+ typedef boost::shared_ptr<AudioGrapher::IdentityVertex<Sample> > IdentityVertexPtr;
+ typedef std::map<ExportChannelPtr, IdentityVertexPtr> ChannelMap;
+
+ public:
+
+ ExportGraphBuilder (Session const & session);
+ ~ExportGraphBuilder ();
+
+ int process (nframes_t frames, bool last_cycle);
+
+ void reset ();
+ void add_config (FileSpec const & config);
+
+ private:
+
+ class Encoder : public sigc::trackable {
+ public:
+ template <typename T> boost::shared_ptr<AudioGrapher::Sink<T> > init (FileSpec const & new_config);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ static int get_real_format (FileSpec const & config);
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::SndfileWriter<Sample> > FloatWriterPtr;
+ typedef boost::shared_ptr<AudioGrapher::SndfileWriter<int> > IntWriterPtr;
+ typedef boost::shared_ptr<AudioGrapher::SndfileWriter<short> > ShortWriterPtr;
+
+ template<typename T> void init_writer (boost::shared_ptr<AudioGrapher::SndfileWriter<T> > & writer);
+ void copy_files (std::string orig_path);
+
+ FileSpec config;
+ std::list<FilenamePtr> filenames;
+
+ // Only one of these should be available at a time
+ FloatWriterPtr float_writer;
+ IntWriterPtr int_writer;
+ ShortWriterPtr short_writer;
+ };
+
+ // sample format converter
+ class SFC {
+ public:
+ // This constructor so that this can be constructed like a Normalizer
+ SFC (ExportGraphBuilder &) {}
+ FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<Sample> > FloatConverterPtr;
+ typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<int> > IntConverterPtr;
+ typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<short> > ShortConverterPtr;
+
+ FileSpec config;
+ std::list<Encoder> children;
+ int data_width;
+
+ // Only one of these should be available at a time
+ FloatConverterPtr float_converter;
+ IntConverterPtr int_converter;
+ ShortConverterPtr short_converter;
+ };
+
+ class Normalizer : public sigc::trackable {
+ public:
+ Normalizer (ExportGraphBuilder & parent) : parent (parent) {}
+ FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::PeakReader> PeakReaderPtr;
+ typedef boost::shared_ptr<AudioGrapher::Normalizer> NormalizerPtr;
+ typedef boost::shared_ptr<AudioGrapher::TmpFile<Sample> > TmpFilePtr;
+ typedef boost::shared_ptr<AudioGrapher::Threader<Sample> > ThreaderPtr;
+ typedef boost::shared_ptr<AudioGrapher::AllocatingProcessContext<Sample> > BufferPtr;
+
+ void start_post_processing();
+ void do_post_processing();
+
+ ExportGraphBuilder & parent;
+
+ FileSpec config;
+ nframes_t max_frames_out;
+
+ BufferPtr buffer;
+ PeakReaderPtr peak_reader;
+ TmpFilePtr tmp_file;
+ NormalizerPtr normalizer;
+ ThreaderPtr threader;
+ std::list<SFC> children;
+ };
+
+ // sample rate converter
+ class SRC {
+ public:
+ SRC (ExportGraphBuilder & parent) : parent (parent) {}
+ FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::SampleRateConverter> SRConverterPtr;
+
+ template<typename T>
+ void add_child_to_list (FileSpec const & new_config, std::list<T> & list);
+
+ ExportGraphBuilder & parent;
+ FileSpec config;
+ std::list<SFC> children;
+ std::list<Normalizer> normalized_children;
+ SRConverterPtr converter;
+ nframes_t max_frames_out;
+ };
+
+ // Silence trimmer + adder
+ class SilenceHandler {
+ public:
+ SilenceHandler (ExportGraphBuilder & parent) : parent (parent) {}
+ FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::SilenceTrimmer<Sample> > SilenceTrimmerPtr;
+
+ ExportGraphBuilder & parent;
+ FileSpec config;
+ std::list<SRC> children;
+ SilenceTrimmerPtr silence_trimmer;
+ nframes_t max_frames_in;
+ };
+
+ // channel configuration
+ class ChannelConfig {
+ public:
+ ChannelConfig (ExportGraphBuilder & parent) : parent (parent) {}
+ void init (FileSpec const & new_config, ChannelMap & channel_map);
+ void add_child (FileSpec const & new_config);
+ bool operator== (FileSpec const & other_config) const;
+
+ private:
+ typedef boost::shared_ptr<AudioGrapher::Interleaver<Sample> > InterleaverPtr;
+
+ ExportGraphBuilder & parent;
+ FileSpec config;
+ std::list<SilenceHandler> children;
+ InterleaverPtr interleaver;
+ nframes_t max_frames;
+ };
+
+ Session const & session;
+
+ // Roots for export processor trees
+ typedef std::list<ChannelConfig> ChannelConfigList;
+ ChannelConfigList channel_configs;
+
+ // The sources of all data, each channel is read only once
+ ChannelMap channels;
+
+ Sample * process_buffer;
+ nframes_t process_buffer_frames;
+
+ Glib::ThreadPool thread_pool;
+};
+
+} // namespace ARDOUR
+
+#endif /* __ardour_export_graph_builder_h__ */
diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h
index bbf1f7e208..f7f3b863b9 100644
--- a/libs/ardour/ardour/export_handler.h
+++ b/libs/ardour/ardour/export_handler.h
@@ -27,8 +27,8 @@
#include <boost/shared_ptr.hpp>
-#include "ardour/session.h"
#include "ardour/ardour.h"
+#include "ardour/session.h"
#include "ardour/types.h"
namespace ARDOUR
@@ -38,11 +38,11 @@ class ExportTimespan;
class ExportChannelConfiguration;
class ExportFormatSpecification;
class ExportFilename;
-class ExportProcessor;
+class ExportGraphBuilder;
class ExportElementFactory
{
- protected:
+ public:
typedef boost::shared_ptr<ExportTimespan> TimespanPtr;
typedef boost::shared_ptr<ExportChannelConfiguration> ChannelConfigPtr;
typedef boost::shared_ptr<ExportFormatSpecification> FormatPtr;
@@ -70,29 +70,30 @@ class ExportElementFactory
class ExportHandler : public ExportElementFactory
{
- private:
-
- /* Stuff for export configs
- * The multimap maps timespans to file specifications
- */
-
+ public:
struct FileSpec {
-
- FileSpec (ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename) :
- channel_config (channel_config),
- format (format),
- filename (filename)
- {}
+ FileSpec() {}
+ FileSpec (ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename)
+ : channel_config (channel_config)
+ , format (format)
+ , filename (filename)
+ {}
ChannelConfigPtr channel_config;
FormatPtr format;
FilenamePtr filename;
};
+
+ private:
+
+ /* Stuff for export configs
+ * The multimap maps timespans to file specifications
+ */
typedef std::pair<TimespanPtr, FileSpec> ConfigPair;
typedef std::multimap<TimespanPtr, FileSpec> ConfigMap;
- typedef boost::shared_ptr<ExportProcessor> ProcessorPtr;
+ typedef boost::shared_ptr<ExportGraphBuilder> GraphBuilderPtr;
typedef boost::shared_ptr<ExportStatus> StatusPtr;
private:
@@ -112,16 +113,26 @@ class ExportHandler : public ExportElementFactory
private:
Session & session;
- ProcessorPtr processor;
+ GraphBuilderPtr graph_builder;
StatusPtr export_status;
ConfigMap config_map;
bool realtime;
- PBD::ScopedConnection files_written_connection;
- PBD::ScopedConnection export_read_finished_connection;
- std::list<Glib::ustring> files_written;
- void add_file (const Glib::ustring&);
+ /* Timespan management */
+
+ void start_timespan ();
+ int process_timespan (nframes_t frames);
+ void finish_timespan ();
+
+ typedef std::pair<ConfigMap::iterator, ConfigMap::iterator> TimespanBounds;
+ TimespanPtr current_timespan;
+ TimespanBounds timespan_bounds;
+
+ PBD::ScopedConnection process_connection;
+ sframes_t process_position;
+
+ PBD::ScopedConnection export_read_finished_connection;
/* CD Marker stuff */
@@ -141,13 +152,13 @@ class ExportHandler : public ExportElementFactory
/* Track info */
uint32_t track_number;
- nframes_t track_position;
- nframes_t track_duration;
- nframes_t track_start_frame;
+ sframes_t track_position;
+ sframes_t track_duration;
+ sframes_t track_start_frame;
/* Index info */
uint32_t index_number;
- nframes_t index_position;
+ sframes_t index_position;
};
@@ -162,23 +173,10 @@ class ExportHandler : public ExportElementFactory
void write_index_info_cue (CDMarkerStatus & status);
void write_index_info_toc (CDMarkerStatus & status);
- void frames_to_cd_frames_string (char* buf, nframes_t when);
+ void frames_to_cd_frames_string (char* buf, sframes_t when);
int cue_tracknum;
int cue_indexnum;
-
- /* Timespan management */
-
- void start_timespan ();
- void finish_timespan ();
- void timespan_thread_finished ();
-
- typedef std::pair<ConfigMap::iterator, ConfigMap::iterator> TimespanBounds;
- TimespanPtr current_timespan;
- ConfigMap::iterator current_map_it;
- TimespanBounds timespan_bounds;
- PBD::ScopedConnection channel_config_connection;
-
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/export_processor.h b/libs/ardour/ardour/export_processor.h
deleted file mode 100644
index 493dd3231f..0000000000
--- a/libs/ardour/ardour/export_processor.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- Copyright (C) 2008 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_export_processor_h__
-#define __ardour_export_processor_h__
-
-#include <vector>
-
-#include <boost/smart_ptr.hpp>
-#include <glibmm/ustring.h>
-
-#include "ardour/graph.h"
-#include "ardour/export_file_io.h"
-#include "ardour/export_utilities.h"
-
-namespace ARDOUR
-{
-
-class Session;
-class ExportStatus;
-class ExportFilename;
-class ExportFormatSpecification;
-
-/// Sets up components for export post processing
-class ExportProcessor
-{
- private:
- /* Typedefs for utility processors */
-
- typedef boost::shared_ptr<SampleRateConverter> SRConverterPtr;
- typedef boost::shared_ptr<PeakReader> PReaderPtr;
- typedef boost::shared_ptr<Normalizer> NormalizerPtr;
- typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
-
- typedef GraphSink<float> FloatSink;
- typedef boost::shared_ptr<FloatSink> FloatSinkPtr;
- typedef std::vector<FloatSinkPtr> FloatSinkVect;
-
- typedef boost::shared_ptr<ExportFilename> FilenamePtr;
- typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr;
-
- typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr;
- typedef std::list<FileWriterPtr> FileWriterList;
-
- public:
-
- ExportProcessor (Session & session);
- ~ExportProcessor ();
- ExportProcessor * copy() { return new ExportProcessor (session); }
-
- /// Do preparations for exporting
- /** Should be called before process
- * @return 0 on success
- */
- int prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, bool split = false, nframes_t start = 0);
-
- /// Process data
- /** @param frames frames to process @return frames written **/
- nframes_t process (float * data, nframes_t frames);
-
- /** should be called after all data is given to process **/
- void prepare_post_processors ();
-
- void write_files ();
-
- static PBD::Signal1<void,const Glib::ustring&> WritingFile;
-
- private:
-
- void reset ();
-
- Session & session;
- boost::shared_ptr<ExportStatus> status;
-
- /* these are initalized in prepare() */
-
- FilenamePtr filename;
- NormalizerPtr normalizer;
- SRConverterPtr src;
- PReaderPtr peak_reader;
- TempFilePtr temp_file;
- FloatSinkVect file_sinks;
- FileWriterList writer_list;
-
- /* general info */
-
- uint32_t channels;
- nframes_t blocksize;
- nframes_t frame_rate;
-
- /* Processing */
-
- bool tag;
- bool broadcast_info;
- bool split_files;
- bool normalize;
- bool trim_beginning;
- bool trim_end;
- nframes_t silence_beginning;
- nframes_t silence_end;
-
- /* Progress info */
-
- nframes_t temp_file_position;
- nframes_t temp_file_length;
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_export_processor_h__ */
diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h
index a29979460f..793ceac1f5 100644
--- a/libs/ardour/ardour/export_profile_manager.h
+++ b/libs/ardour/ardour/export_profile_manager.h
@@ -264,6 +264,9 @@ class ExportProfileManager
ChannelConfigStatePtr channel_config_state,
FormatStatePtr format_state,
FilenameStatePtr filename_state);
+
+ bool check_format (FormatPtr format, uint32_t channels);
+ bool check_sndfile_format (FormatPtr format, unsigned int channels);
/* Utilities */
diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h
index 7b7ae7cd99..9053ace0f9 100644
--- a/libs/ardour/ardour/export_timespan.h
+++ b/libs/ardour/ardour/export_timespan.h
@@ -39,9 +39,6 @@ class ExportTempFile;
class ExportTimespan
{
private:
- typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
- typedef std::pair<ExportChannelPtr, TempFilePtr> ChannelFilePair;
- typedef std::map<ExportChannelPtr, TempFilePtr> TempFileMap;
typedef boost::shared_ptr<ExportStatus> ExportStatusPtr;
private:
@@ -57,20 +54,6 @@ class ExportTimespan
Glib::ustring range_id () const { return _range_id; }
void set_range_id (Glib::ustring range_id) { _range_id = range_id; }
- /// Registers a channel to be read when export starts rolling
- void register_channel (ExportChannelPtr channel);
-
- /// "Rewinds" the tempfiles to start reading the beginnings again
- void rewind ();
-
- /// Reads data from the tempfile belonging to channel into data
- nframes_t get_data (float * data, nframes_t frames, ExportChannelPtr channel);
-
- /// Reads data from each channel and writes to tempfile
- int process (nframes_t frames);
-
- PBD::ScopedConnection process_connection;
-
void set_range (nframes_t start, nframes_t end);
nframes_t get_length () const { return end_frame - start_frame; }
nframes_t get_start () const { return start_frame; }
@@ -85,8 +68,6 @@ class ExportTimespan
nframes_t position;
nframes_t frame_rate;
- TempFileMap filemap;
-
Glib::ustring _name;
Glib::ustring _range_id;
diff --git a/libs/ardour/ardour/export_utilities.h b/libs/ardour/ardour/export_utilities.h
deleted file mode 100644
index 5733ebb403..0000000000
--- a/libs/ardour/ardour/export_utilities.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- Copyright (C) 2008 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_export_utilities_h__
-#define __ardour_export_utilities_h__
-
-#include <samplerate.h>
-
-#include "ardour/graph.h"
-#include "ardour/types.h"
-#include "ardour/ardour.h"
-#include "ardour/export_format_base.h"
-#include "ardour/runtime_functions.h"
-
-namespace ARDOUR
-{
-
-/* Processors */
-
-/* Sample rate converter */
-
-class SampleRateConverter : public GraphSinkVertex<float, float>
-{
- public:
- SampleRateConverter (uint32_t channels, nframes_t in_rate, nframes_t out_rate, int quality);
- ~SampleRateConverter ();
-
- protected:
- nframes_t process (float * data, nframes_t frames);
-
- private:
- bool active;
- uint32_t channels;
-
- nframes_t leftover_frames;
- nframes_t max_leftover_frames;
- nframes_t frames_in;
- nframes_t frames_out;
-
- float * data_in;
- float * leftover_data;
-
- float * data_out;
- nframes_t data_out_size;
-
- SRC_DATA src_data;
- SRC_STATE* src_state;
-};
-
-/* Sample format converter */
-
-template <typename TOut>
-class SampleFormatConverter : public GraphSinkVertex<float, TOut>
-{
- public:
- SampleFormatConverter (uint32_t channels, ExportFormatBase::DitherType type = ExportFormatBase::D_None, int data_width_ = 0);
- ~SampleFormatConverter ();
-
- void set_clip_floats (bool yn) { clip_floats = yn; }
-
- protected:
- nframes_t process (float * data, nframes_t frames);
-
- private:
- uint32_t channels;
- int data_width;
- GDither dither;
- nframes_t data_out_size;
- TOut * data_out;
-
- bool clip_floats;
-
-};
-
-/* Peak reader */
-
-class PeakReader : public GraphSinkVertex<float, float>
-{
- public:
- PeakReader (uint32_t channels) : channels (channels), peak (0) {}
- ~PeakReader () {}
-
- float get_peak () { return peak; }
-
- protected:
- nframes_t process (float * data, nframes_t frames)
- {
- peak = compute_peak (data, channels * frames, peak);
- return piped_to->write (data, frames);
- }
-
- private:
- uint32_t channels;
- float peak;
-};
-
-/* Normalizer */
-
-class Normalizer : public GraphSinkVertex<float, float>
-{
- public:
- Normalizer (uint32_t channels, float target_dB);
- ~Normalizer ();
-
- void set_peak (float peak);
-
- protected:
- nframes_t process (float * data, nframes_t frames);
-
- private:
- uint32_t channels;
-
- bool enabled;
- gain_t target;
- gain_t gain;
-};
-
-/* Other */
-
-class NullSink : public GraphSink<float>
-{
- public:
- nframes_t write (float * /*data*/, nframes_t frames) { return frames; }
-};
-
-
-} // namespace ARDOUR
-
-#endif /* __ardour_export_utilities_h__ */
diff --git a/libs/ardour/ardour/gdither.h b/libs/ardour/ardour/gdither.h
deleted file mode 100644
index 67efcc3583..0000000000
--- a/libs/ardour/ardour/gdither.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2002 Steve Harris <steve@plugin.org.uk>
- *
- * 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 GDITHER_H
-#define GDITHER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "gdither_types.h"
-
-/* Create and initialise a state structure, takes a dither type, a number of
- * channels and a bit depth as input
- *
- * The Dither type is one of
- *
- * GDitherNone - straight nearest neighbour rounding. Theres no pressing
- * reason to do this at 8 or 16 bit, but you might want to at 24, for some
- * reason. At the lest it will save you writing int->float conversion code,
- * which is arder than it sounds.
- *
- * GDitherRect - mathematically most accurate, lowest noise floor, but not
- * that good for audio. It is the fastest though.
- *
- * GDitherTri - a happy medium between Rectangular and Shaped, reasonable
- * noise floor, not too obvious, quite fast.
- *
- * GDitherShaped - should have the least audible impact, but has the highest
- * noise floor, fairly CPU intensive. Not advisible if your going to apply
- * any frequency manipulation afterwards.
- *
- * channels, sets the number of channels in the output data, output data will
- * be written interleaved into the area given to gdither_run(). Set to 1
- * if you are not working with interleaved buffers.
- *
- * bit depth, sets the bit width of the output sample data, it can be one of:
- *
- * GDither8bit - 8 bit unsiged
- * GDither16bit - 16 bit signed
- * GDither32bit - 24+bits in upper bits of a 32 bit word
- * GDitherFloat - IEEE floating point (32bits)
- * GDitherDouble - Double precision IEEE floating point (64bits)
- *
- * dither_depth, set the number of bits before the signal will be truncated to,
- * eg. 16 will produce an output stream with 16bits-worth of signal. Setting to
- * zero or greater than the width of the output format will dither to the
- * maximum precision allowed by the output format.
- */
-GDither gdither_new(GDitherType type, uint32_t channels,
-
- GDitherSize bit_depth, int dither_depth);
-
-/* Frees memory used by gdither_new.
- */
-void gdither_free(GDither s);
-
-/* Applies dithering to the supplied signal.
- *
- * channel is the channel number you are processing (0 - channles-1), length is
- * the length of the input, in samples, x is the input samples (float), y is
- * where the output samples will be written, it should have the approaprate
- * type for the chosen bit depth
- */
-void gdither_runf(GDither s, uint32_t channel, uint32_t length,
- float *x, void *y);
-
-/* see gdither_runf, vut input argument is double format */
-void gdither_run(GDither s, uint32_t channel, uint32_t length,
- double *x, void *y);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/ardour/ardour/gdither_types.h b/libs/ardour/ardour/gdither_types.h
deleted file mode 100644
index bcc0097d7f..0000000000
--- a/libs/ardour/ardour/gdither_types.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2002 Steve Harris <steve@plugin.org.uk>
- *
- * 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 GDITHER_TYPES_H
-#define GDITHER_TYPES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- GDitherNone = 0,
- GDitherRect,
- GDitherTri,
- GDitherShaped
-} GDitherType;
-
-typedef enum {
- GDither8bit = 8,
- GDither16bit = 16,
- GDither32bit = 32,
- GDitherFloat = 25,
- GDitherDouble = 54
-} GDitherSize;
-
-typedef void *GDither;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/ardour/ardour/gdither_types_internal.h b/libs/ardour/ardour/gdither_types_internal.h
deleted file mode 100644
index 6cb0c48af9..0000000000
--- a/libs/ardour/ardour/gdither_types_internal.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2002 Steve Harris <steve@plugin.org.uk>
- *
- * 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 GDITHER_TYPES_H
-#define GDITHER_TYPES_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GDITHER_SH_BUF_SIZE 8
-#define GDITHER_SH_BUF_MASK 7
-
-/* this must agree with whats in gdither_types.h */
-typedef enum {
- GDitherNone = 0,
- GDitherRect,
- GDitherTri,
- GDitherShaped
-} GDitherType;
-
-typedef enum {
- GDither8bit = 8,
- GDither16bit = 16,
- GDither32bit = 32,
- GDitherFloat = 25,
- GDitherDouble = 54
-} GDitherSize;
-
-typedef struct {
- uint32_t phase;
- float buffer[GDITHER_SH_BUF_SIZE];
-} GDitherShapedState;
-
-typedef struct GDither_s {
- GDitherType type;
- uint32_t channels;
- uint32_t bit_depth;
- uint32_t dither_depth;
- float scale;
- uint32_t post_scale;
- float post_scale_fp;
- float bias;
-
- int clamp_u;
-
- int clamp_l;
- float *tri_state;
- GDitherShapedState *shaped_state;
-} *GDither;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h
deleted file mode 100644
index 5d6919f56e..0000000000
--- a/libs/ardour/ardour/graph.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- Copyright (C) 2008 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_graph_h__
-#define __ardour_graph_h__
-
-#include <boost/shared_ptr.hpp>
-
-#include "ardour/types.h"
-
-namespace ARDOUR
-{
-
-/// Takes data in
-template <typename T>
-class GraphSink {
- public:
- GraphSink () : end_of_input (false) {}
- virtual ~GraphSink () { end_of_input = false; }
-
- // writes data and return number of frames written
- virtual nframes_t write (T * data, nframes_t frames) = 0;
-
- // Notifies end of input. All left over data must be written at this stage
- virtual void set_end_of_input (bool state = true)
- {
- end_of_input = state;
- }
-
- protected:
- bool end_of_input;
-};
-
-/// is a source for data
-template <typename T>
-class GraphSource {
- public:
- GraphSource () {}
- virtual ~GraphSource () {}
-
- virtual nframes_t read (T * data, nframes_t frames) = 0;
-};
-
-/// Takes data in, processes it and passes it on to another sink
-template <typename TIn, typename TOut>
-class GraphSinkVertex : public GraphSink<TIn> {
- public:
- GraphSinkVertex () {}
- virtual ~GraphSinkVertex () {}
-
- void pipe_to (boost::shared_ptr<GraphSink<TOut> > dest) {
- piped_to = dest;
- }
-
- nframes_t write (TIn * data, nframes_t frames)
- {
- if (!piped_to) {
- return -1;
- }
- return process (data, frames);
- }
-
- virtual void set_end_of_input (bool state = true)
- {
- if (!piped_to) {
- return;
- }
- piped_to->set_end_of_input (state);
- GraphSink<TIn>::end_of_input = state;
- }
-
- protected:
- boost::shared_ptr<GraphSink<TOut> > piped_to;
-
- /* process must process data,
- use piped_to->write to write the data
- and return number of frames written */
- virtual nframes_t process (TIn * data, nframes_t frames) = 0;
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_graph_h__ */
-