summaryrefslogtreecommitdiff
path: root/libs/ardour/export_channel_configuration.cc
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/export_channel_configuration.cc
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/export_channel_configuration.cc')
-rw-r--r--libs/ardour/export_channel_configuration.cc122
1 files changed, 0 insertions, 122 deletions
diff --git a/libs/ardour/export_channel_configuration.cc b/libs/ardour/export_channel_configuration.cc
index 89a4952feb..cc68356d82 100644
--- a/libs/ardour/export_channel_configuration.cc
+++ b/libs/ardour/export_channel_configuration.cc
@@ -22,7 +22,6 @@
#include "ardour/export_handler.h"
#include "ardour/export_filename.h"
-#include "ardour/export_processor.h"
#include "ardour/export_timespan.h"
#include "ardour/audio_port.h"
@@ -43,15 +42,11 @@ namespace ARDOUR
ExportChannelConfiguration::ExportChannelConfiguration (Session & session) :
session (session),
- writer_thread (*this),
- status (session.get_export_status ()),
- files_written (false),
split (false)
{
}
-
XMLNode &
ExportChannelConfiguration::get_state ()
{
@@ -104,121 +99,4 @@ ExportChannelConfiguration::all_channels_have_ports () const
return true;
}
-bool
-ExportChannelConfiguration::write_files (boost::shared_ptr<ExportProcessor> new_processor)
-{
- if (files_written || writer_thread.running) {
- return false;
- }
-
- files_written = true;
-
- if (!timespan) {
- throw ExportFailed (X_("Programming error: No timespan registered to channel configuration when requesting files to be written"));
- }
-
- /* Take a local copy of the processor to be used in the thread that is created below */
-
- processor.reset (new_processor->copy());
-
- /* Create new thread for post processing */
-
- pthread_create (&writer_thread.thread, 0, _write_files, &writer_thread);
- writer_thread.running = true;
- pthread_detach (writer_thread.thread);
-
- return true;
-}
-
-void
-ExportChannelConfiguration::write_file ()
-{
- timespan->rewind ();
- nframes_t progress = 0;
- nframes_t timespan_length = timespan->get_length();
-
- nframes_t frames = 2048; // TODO good block size ?
- nframes_t frames_read = 0;
-
- float * channel_buffer = new float [frames];
- float * file_buffer = new float [channels.size() * frames];
- uint32_t channel_count = channels.size();
- uint32_t channel;
-
- do {
- if (status->aborted()) { break; }
-
- channel = 0;
- for (ChannelList::iterator it = channels.begin(); it != channels.end(); ++it) {
-
- /* Get channel data */
-
- frames_read = timespan->get_data (channel_buffer, frames, *it);
-
- /* Interleave into file buffer */
-
- for (uint32_t i = 0; i < frames_read; ++i) {
- file_buffer[channel + (channel_count * i)] = channel_buffer[i];
- }
-
- ++channel;
- }
-
- progress += frames_read;
- status->progress = (float) progress / timespan_length;
-
- } while (processor->process (file_buffer, frames_read) > 0);
-
- delete [] channel_buffer;
- delete [] file_buffer;
-}
-
-void *
-ExportChannelConfiguration::_write_files (void *arg)
-{
- SessionEvent::create_per_thread_pool ("exporter events", 64);
-
- // cc can be trated like 'this'
- WriterThread & cc (*((WriterThread *) arg));
-
- try {
- for (FileConfigList::iterator it = cc->file_configs.begin(); it != cc->file_configs.end(); ++it) {
- if (cc->status->aborted()) {
- break;
- }
- cc->processor->prepare (it->first, it->second, cc->channels.size(), cc->split, cc->timespan->get_start());
- cc->write_file (); // Writes tempfile
- cc->processor->prepare_post_processors ();
- cc->processor->write_files();
- }
- } catch (ExportFailed & e) {
- cc->status->abort (true);
- }
-
- cc.running = false;
- cc->files_written = true;
- cc->FilesWritten();
-
- return 0; // avoid compiler warnings
-}
-
-void
-ExportChannelConfiguration::register_with_timespan (TimespanPtr new_timespan)
-{
- timespan = new_timespan;
-
- for (ChannelList::iterator it = channels.begin(); it != channels.end(); ++it) {
- timespan->register_channel (*it);
- }
-}
-
-void
-ExportChannelConfiguration::unregister_all ()
-{
- timespan.reset();
- processor.reset();
- file_configs.clear();
- files_written = false;
-}
-
} // namespace ARDOUR