summaryrefslogtreecommitdiff
path: root/libs/audiographer
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2012-01-24 20:21:54 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2012-01-24 20:21:54 +0000
commitf57da9b00e0660640c7a4cbb48f32ef63830d463 (patch)
tree49a1e3dff9e3d3fb525b9baaff9514dc45c34c98 /libs/audiographer
parente6a7a679339bf71719775da7b6111cd4857bd6f0 (diff)
Show proper progress information for export while normalizing
git-svn-id: svn://localhost/ardour2/branches/3.0@11337 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/audiographer')
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_writer.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_writer.h b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
index 6e8ecc2567..984ec01d41 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_writer.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
@@ -31,7 +31,7 @@ class SndfileWriter
: SndfileHandle (path, Write, format, channels, samplerate)
, path (path)
{
- add_supported_flag (ProcessContext<T>::EndOfInput);
+ init();
if (broadcast_info) {
broadcast_info->write_to_file (this);
@@ -40,8 +40,16 @@ class SndfileWriter
virtual ~SndfileWriter () {}
- SndfileWriter (SndfileWriter const & other) : SndfileHandle (other) {}
+ SndfileWriter (SndfileWriter const & other)
+ : SndfileHandle (other)
+ {
+ init();
+ }
+
using SndfileHandle::operator=;
+
+ framecnt_t get_frames_written() const { return frames_written; }
+ void reset_frames_written_count() { frames_written = 0; }
/// Writes data to file
void process (ProcessContext<T> const & c)
@@ -55,6 +63,8 @@ class SndfileWriter
}
framecnt_t const written = write (c.data(), c.frames());
+ frames_written += written;
+
if (throw_level (ThrowProcess) && written != c.frames()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to output file (%1%)")
@@ -75,11 +85,18 @@ class SndfileWriter
/// SndfileHandle has to be constructed directly by deriving classes
SndfileWriter ()
{
+ init();
+ }
+
+ void init()
+ {
+ frames_written = 0;
add_supported_flag (ProcessContext<T>::EndOfInput);
}
-
+
protected:
std::string path;
+ framecnt_t frames_written;
};
} // namespace