X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fexport_channel_configuration.h;h=a950cecc65194f1d6b6bd843ac84114645d88cd6;hb=722defe41a6119cfe6e9f5a66fdcb2408c12a455;hp=234cd5d127244cea4b1c3f18e0eca07141845482;hpb=eec19ca7afde0da57b2a4d9abc6ef847e6924975;p=ardour.git diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index 234cd5d127..a950cecc65 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -21,18 +21,17 @@ #ifndef __ardour_export_channel_configuration_h__ #define __ardour_export_channel_configuration_h__ -#include #include +#include +#include -#include -#include +#include -#include -#include +#include "ardour/export_channel.h" +#include "ardour/export_status.h" +#include "ardour/ardour.h" -#include - -using Glib::ustring; +#include "pbd/xml++.h" namespace ARDOUR { @@ -46,94 +45,53 @@ class ExportProcessor; class ExportTimespan; class Session; -class ExportChannel : public std::set -{ - public: - void add_port (AudioPort * port) { if (port) { insert (port); } } - void read_ports (float * data, nframes_t frames) const; -}; - -class ExportChannelConfiguration +class ExportChannelConfiguration : public boost::enable_shared_from_this { - private: - typedef boost::shared_ptr ProcessorPtr; - typedef boost::shared_ptr TimespanPtr; - typedef boost::shared_ptr FormatPtr; - typedef boost::shared_ptr FilenamePtr; - - typedef std::pair FileConfig; - typedef std::list 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 (ExportStatus & status, Session & session); - + 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 &); - - typedef boost::shared_ptr ChannelPtr; - typedef std::list ChannelList; - - ChannelList const & get_channels () { return channels; } - bool all_channels_have_ports (); - - ustring name () const { return _name; } - void set_name (ustring name) { _name = name; } + + typedef std::list ChannelList; + + ChannelList const & get_channels () const { return channels; } + bool all_channels_have_ports () const; + + std::string name () const { return _name; } + void set_name (std::string name) { _name = name; } void set_split (bool value) { split = value; } - - bool get_split () { return split; } - uint32_t get_n_chans () { return channels.size(); } - - void register_channel (ChannelPtr channel) { channels.push_back (channel); } - void register_file_config (FormatPtr format, FilenamePtr filename) { file_configs.push_back (FileConfig (format, filename)); } - + + RegionExportChannelFactory::Type region_processing_type() const { return region_type; } + void set_region_processing_type(RegionExportChannelFactory::Type type) { region_type = type; } + + bool get_split () const { return split; } + uint32_t get_n_chans () const { return channels.size(); } + + void register_channel (ExportChannelPtr channel) { channels.push_back (channel); } + void register_channels (ChannelList const & new_channels) { + std::copy (new_channels.begin(), new_channels.end(), std::back_inserter(channels)); + } 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 new_processor); - sigc::signal FilesWritten; - - // Tells the handler the necessary information for it to handle tempfiles - void register_with_timespan (TimespanPtr timespan); - - void unregister_all (); - - private: - Session & session; + /** Returns a list of channel configurations that match the files created. + * I.e. many configurations if splitting is enabled, one if not. */ + void configurations_for_files (std::list > & configs); - // 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; - ExportStatus & status; + private: - bool files_written; + Session & session; - TimespanPtr timespan; ChannelList channels; - FileConfigList file_configs; - bool split; // Split to mono files - ustring _name; + std::string _name; + RegionExportChannelFactory::Type region_type; }; } // namespace ARDOUR