1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/***************************************************************************
TrackWriter.h - stream for writing samples into a track
-------------------
begin : Feb 11 2001
copyright : (C) 2001 by Thomas Eschenbacher
email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef TRACK_WRITER_H
#define TRACK_WRITER_H
#include "config.h"
#include "libkwave_export.h"
#include <QtGlobal>
#include <QElapsedTimer>
#include <QObject>
#include "libkwave/Writer.h"
namespace Kwave
{
class SampleArray;
class Track;
/**
* @class TrackWriter
* Input stream for transferring samples into a Track.
*
* @warning THIS CLASS IS NOT THREADSAFE! It is intended to be owned by
* and used from only one thread.
*/
class LIBKWAVE_EXPORT TrackWriter: public Kwave::Writer
{
Q_OBJECT
public:
/**
* Constructor, creates a writer for write access to a track.
*
* @param track reference to the track
* @param mode specifies where and how to insert
* @param left start of the input (only useful in insert and
* overwrite mode)
* @param right end of the input (only useful with overwrite mode)
* @see InsertMode
*/
TrackWriter(Kwave::Track &track, Kwave::InsertMode mode,
sample_index_t left = 0, sample_index_t right = 0);
/**
* Destructor.
*/
~TrackWriter() override;
/**
* Flush the content of a buffer. Normally the buffer is the
* internal intermediate buffer used for single-sample writes.
* When using block transfers, the internal buffer is bypassed
* and the written block is passed instead.
* @internal
* @param buffer reference to the buffer to be flushed
* @param count number of samples in the buffer to be flushed,
* will be internally set to zero if successful
* @return true if successful, false if failed (e.g. out of memory)
*/
virtual bool write(const Kwave::SampleArray &buffer,
unsigned int &count)
override;
private:
/** the track that receives our data */
Kwave::Track &m_track;
/** timer for limiting the number of progress signals per second */
QElapsedTimer m_progress_time;
};
}
#endif /* TRACK_WRITER_H */
//***************************************************************************
//***************************************************************************
|