[84b6f5]: libkwave / TrackWriter.h Maximize Restore History

Download this file

TrackWriter.h    90 lines (72 with data), 2.9 kB

 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
/***************************************************************************
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 <QObject>
#include <QTime>
#include <kdemacros.h>
#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 KDE_EXPORT TrackWriter: public Kwave::Writer
{
Q_OBJECT
public:
/**
* Constructor, creates a writer for write access to a track.
*
* @param 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, InsertMode mode,
sample_index_t left = 0, sample_index_t right = 0);
/**
* Destructor.
*/
virtual ~TrackWriter();
/**
* 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);
private:
/** the track that receives our data */
Kwave::Track &m_track;
/** timer for limiting the number of progress signals per second */
QTime m_progress_time;
};
}
#endif /* _TRACK_WRITER_H_ */