X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fexport_timespan.cc;h=3b2021355e1f9ecf7ce8c1a4ccad70709a25c9fd;hb=79621762193a7a56cbb5a966cc8603c1d1c5e17c;hp=d6996a5a48e3e619053f8fa8778ef335b10ffb77;hpb=6b50ba341da426805ce3c92609c0fa12c52b67ac;p=ardour.git diff --git a/libs/ardour/export_timespan.cc b/libs/ardour/export_timespan.cc index d6996a5a48..3b2021355e 100644 --- a/libs/ardour/export_timespan.cc +++ b/libs/ardour/export_timespan.cc @@ -18,96 +18,31 @@ */ -#include - -#include -#include -#include -#include +#include "ardour/export_timespan.h" namespace ARDOUR { -ExportTimespan::ExportTimespan (ExportStatusPtr status, nframes_t frame_rate) : - status (status), - start_frame (0), - end_frame (0), - position (0), - frame_rate (frame_rate) -{ -} - -ExportTimespan::~ExportTimespan () +ExportTimespan::ExportTimespan (ExportStatusPtr status, framecnt_t frame_rate) : + status (status), + start_frame (0), + end_frame (0), + position (0), + frame_rate (frame_rate) { -} -void -ExportTimespan::register_channel (ExportChannel const & channel) -{ - TempFilePtr ptr (new ExportTempFile (1, frame_rate)); - ChannelFilePair pair (channel, ptr); - filemap.insert (pair); -} - -void -ExportTimespan::rewind () -{ - for (TempFileMap::iterator it = filemap.begin(); it != filemap.end(); ++it) { - it->second->reset_read (); - } } -nframes_t -ExportTimespan::get_data (float * data, nframes_t frames, ExportChannel const & channel) +ExportTimespan::~ExportTimespan () { - TempFileMap::iterator it = filemap.find (channel); - if (it == filemap.end()) { - throw ExportFailed (X_("Trying to get data from ExportTimespan for channel that was never registered!")); - } - - return it->second->read (data, frames); } void -ExportTimespan::set_range (nframes_t start, nframes_t end) +ExportTimespan::set_range (framepos_t start, framepos_t end) { start_frame = start; position = start_frame; end_frame = end; } -int -ExportTimespan::process (nframes_t frames) -{ - status->stage = export_ReadTimespan; - - /* update position */ - - nframes_t frames_to_read; - - if (position + frames <= end_frame) { - frames_to_read = frames; - } else { - frames_to_read = end_frame - position; - status->stop = true; - } - - position += frames_to_read; - status->progress = (float) (position - start_frame) / (end_frame - start_frame); - - /* Read channels from ports and save to tempfiles */ - - float * data = new float[frames_to_read]; - - for (TempFileMap::iterator it = filemap.begin(); it != filemap.end(); ++it) { - it->first.read_ports (data, frames_to_read); - it->second->write (data, frames_to_read); - } - - delete [] data; - - return 0; -} - - } // namespace ARDOUR