kwave  18.07.70
Kwave::SampleReader Class Reference

#include <SampleReader.h>

Inheritance diagram for Kwave::SampleReader:
Inheritance graph
Collaboration diagram for Kwave::SampleReader:
Collaboration graph

Signals

void proceeded ()
 
void output (Kwave::SampleArray data)
 
- Signals inherited from Kwave::StreamObject
void attributeChanged (const QVariant value)
 

Public Member Functions

 SampleReader (Kwave::ReaderMode mode, Kwave::Stripe::List stripes)
 
virtual ~SampleReader () Q_DECL_OVERRIDE
 
void reset ()
 
virtual void goOn () Q_DECL_OVERRIDE
 
bool eof () const
 
virtual bool done () const Q_DECL_OVERRIDE
 
unsigned int read (Kwave::SampleArray &buffer, unsigned int dstoff, unsigned int length)
 
void minMax (sample_index_t first, sample_index_t last, sample_t &min, sample_t &max)
 
void skip (sample_index_t count)
 
void seek (sample_index_t pos)
 
sample_index_t pos () const
 
sample_index_t first () const
 
sample_index_t last () const
 
SampleReaderoperator>> (sample_t &sample)
 
SampleReaderoperator>> (Kwave::SampleArray &sample)
 
- Public Member Functions inherited from Kwave::SampleSource
 SampleSource (QObject *parent=Q_NULLPTR)
 
virtual ~SampleSource ()
 
- Public Member Functions inherited from Kwave::StreamObject
 StreamObject (QObject *parent=Q_NULLPTR)
 
virtual ~StreamObject ()
 
virtual unsigned int tracks () const
 
virtual Kwave::StreamObjectoperator[] (unsigned int track)
 
virtual unsigned int tracksOfPort (const char *port) const
 
virtual Kwave::StreamObjectport (const char *port, unsigned int track)
 
virtual unsigned int blockSize () const
 
void setAttribute (const char *attribute, const QVariant &value)
 

Protected Member Functions

void fillBuffer ()
 
unsigned int readSamples (sample_index_t offset, Kwave::SampleArray &buffer, unsigned int buf_offset, unsigned int length)
 

Private Attributes

Kwave::ReaderMode m_mode
 
QList< Kwave::Stripem_stripes
 
sample_index_t m_src_position
 
sample_index_t m_first
 
sample_index_t m_last
 
Kwave::SampleArray m_buffer
 
unsigned int m_buffer_used
 
unsigned int m_buffer_position
 
QTime m_progress_time
 
sample_index_t m_last_seek_pos
 

Additional Inherited Members

- Static Public Member Functions inherited from Kwave::StreamObject
static void setInteractive (bool interactive)
 

Detailed Description

Definition at line 39 of file SampleReader.h.

Constructor & Destructor Documentation

◆ SampleReader()

Kwave::SampleReader::SampleReader ( Kwave::ReaderMode  mode,
Kwave::Stripe::List  stripes 
)

Constructor. Creates a stream for reading samples from a track.

Parameters
modethe reader mode, see Kwave::ReaderMode
stripeslist of stripes which contains the desired range
See also
InsertMode

Definition at line 35 of file SampleReader.cpp.

References m_progress_time.

37  :m_mode(mode), m_stripes(stripes),
38  m_src_position(stripes.left()), m_first(stripes.left()),
39  m_last(stripes.right()), m_buffer(blockSize()),
42 {
43  m_progress_time.start();
44 }
sample_index_t m_last
Definition: SampleReader.h:187
sample_index_t left() const
Definition: Stripe.h:214
sample_index_t m_first
Definition: SampleReader.h:184
sample_index_t right() const
Definition: Stripe.h:217
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
Kwave::SampleArray m_buffer
Definition: SampleReader.h:190
QList< Kwave::Stripe > m_stripes
Definition: SampleReader.h:173
virtual unsigned int blockSize() const
unsigned int m_buffer_used
Definition: SampleReader.h:193
Kwave::ReaderMode m_mode
Definition: SampleReader.h:170
sample_index_t m_last_seek_pos
Definition: SampleReader.h:202

◆ ~SampleReader()

Kwave::SampleReader::~SampleReader ( )
virtual

Destructor

Definition at line 47 of file SampleReader.cpp.

48 {
49 }

Member Function Documentation

◆ done()

virtual bool Kwave::SampleReader::done ( ) const
inlinevirtual

Returns true if the end of the source has been reached, e.g. at EOF of an input stream.

Returns
true if it can produce more sample data, otherwise false
See also
eof()

Reimplemented from Kwave::SampleSource.

Definition at line 77 of file SampleReader.h.

77 { return eof(); }
bool eof() const
Definition: SampleReader.h:66

◆ eof()

bool Kwave::SampleReader::eof ( ) const
inline

Checks if the last read operation has reached the end of input

Definition at line 66 of file SampleReader.h.

Referenced by Kwave::AsciiEncoder::encode(), Kwave::WavEncoder::encode(), Kwave::MP3Encoder::encode(), Kwave::MultiTrackReader::eof(), fillBuffer(), Kwave::NormalizePlugin::getMaxPower(), Kwave::NormalizePlugin::getMaxPowerOfTrack(), Kwave::Writer::operator<<(), read(), and Kwave::PlaybackController::run_wrapper().

66  {
67  return (pos() > m_last);
68  }
sample_index_t m_last
Definition: SampleReader.h:187
sample_index_t pos() const
Definition: SampleReader.h:111
Here is the caller graph for this function:

◆ fillBuffer()

void Kwave::SampleReader::fillBuffer ( )
protected

Fills the sample buffer

Definition at line 75 of file SampleReader.cpp.

References eof(), Kwave::SampleArray::isEmpty(), m_buffer, m_buffer_position, m_buffer_used, m_last, m_progress_time, m_src_position, MIN_PROGRESS_INTERVAL, proceeded(), readSamples(), Kwave::SampleArray::size(), and Kwave::toUint().

Referenced by operator>>().

76 {
77  Q_ASSERT(m_buffer_position >= m_buffer_used);
78  m_buffer_used = 0;
80  if (eof()) return;
81  if (m_buffer.isEmpty()) return; // we had a OOM before?
82 
83  unsigned int rest = m_buffer.size();/* - m_buffer_used (is 0) */
84  if (m_src_position + rest > m_last)
85  rest = Kwave::toUint(m_last - m_src_position + 1);
86  Q_ASSERT(rest <= m_buffer.size());
87  if (rest > m_buffer.size()) rest = m_buffer.size();
88  Q_ASSERT(rest);
89 
90  unsigned int len = readSamples(m_src_position, m_buffer, 0, rest);
91  Q_ASSERT(len == rest);
92  m_buffer_used += len;
93 
94  // inform others that we proceeded
95  if (m_progress_time.elapsed() > MIN_PROGRESS_INTERVAL) {
96  m_progress_time.restart();
97  emit proceeded();
98  QApplication::sendPostedEvents();
99  }
100 }
sample_index_t m_last
Definition: SampleReader.h:187
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
bool eof() const
Definition: SampleReader.h:66
Kwave::SampleArray m_buffer
Definition: SampleReader.h:190
bool isEmpty() const
Definition: SampleArray.h:118
#define MIN_PROGRESS_INTERVAL
unsigned int size() const
unsigned int toUint(T x)
Definition: Utils.h:109
unsigned int readSamples(sample_index_t offset, Kwave::SampleArray &buffer, unsigned int buf_offset, unsigned int length)
unsigned int m_buffer_used
Definition: SampleReader.h:193
Here is the call graph for this function:
Here is the caller graph for this function:

◆ first()

sample_index_t Kwave::SampleReader::first ( ) const
inline

Returns the position of the first sample

Definition at line 116 of file SampleReader.h.

Referenced by Kwave::MultiTrackReader::proceeded().

116  {
117  return m_first;
118  }
sample_index_t m_first
Definition: SampleReader.h:184
Here is the caller graph for this function:

◆ goOn()

void Kwave::SampleReader::goOn ( )
virtual

Each KwaveSampleSource has to derive this method for producing sample data. It then should emit a signal like this: "output(SampleArray &data)"

Implements Kwave::SampleSource.

Definition at line 305 of file SampleReader.cpp.

References Kwave::StreamObject::blockSize(), and output().

306 {
307  Kwave::SampleArray buffer(blockSize());
308  (*this) >> buffer;
309  emit output(buffer);
310 }
void output(Kwave::SampleArray data)
virtual unsigned int blockSize() const
Here is the call graph for this function:

◆ last()

sample_index_t Kwave::SampleReader::last ( ) const
inline

Returns the position of the last sample

Definition at line 121 of file SampleReader.h.

Referenced by Kwave::MultiTrackReader::proceeded().

121  {
122  return m_last;
123  }
sample_index_t m_last
Definition: SampleReader.h:187
Here is the caller graph for this function:

◆ minMax()

void Kwave::SampleReader::minMax ( sample_index_t  first,
sample_index_t  last,
sample_t min,
sample_t max 
)

Returns the minimum and maximum sample value within a range of samples.

Parameters
firstindex of the first sample
lastindex of the last sample
minreceives the lowest value or 0 if no samples are in range
maxreceives the highest value or 0 if no samples are in range
Note
min and max do not need to be initialized

Definition at line 103 of file SampleReader.cpp.

References Kwave::Stripe::end(), Kwave::Stripe::length(), m_stripes, Kwave::Stripe::minMax(), SAMPLE_MAX, SAMPLE_MIN, Kwave::Stripe::start(), and Kwave::toUint().

Referenced by Kwave::OverViewCache::getMinMax(), and Kwave::TrackPixmap::validateBuffer().

105 {
106  bool empty = true;
107  min = SAMPLE_MAX;
108  max = SAMPLE_MIN;
109 
110  foreach (Kwave::Stripe s, m_stripes) {
111  if (!s.length()) continue;
112  sample_index_t start = s.start();
113  sample_index_t end = s.end();
114 
115  if (end < first) continue; // not yet in range
116  if (start > last) break; // done
117 
118  // overlap -> not empty
119  empty = false;
120 
121  // get min/max from the stripe
122  unsigned int s1 = Kwave::toUint(
123  (first > start) ? (first - start) : 0);
124  unsigned int s2 = Kwave::toUint(
125  (last < end) ? (last - start) : (end - start));
126  s.minMax(s1, s2, min, max);
127  }
128 
129  // special case: no signal in that range -> set to zero
130  if (empty) {
131  min = 0;
132  max = 0;
133  }
134 }
unsigned int length() const
Definition: Stripe.cpp:276
#define SAMPLE_MIN
Definition: Sample.h:49
quint64 sample_index_t
Definition: Sample.h:28
sample_index_t last() const
Definition: SampleReader.h:121
sample_index_t start() const
Definition: Stripe.cpp:262
sample_index_t first() const
Definition: SampleReader.h:116
sample_index_t end() const
Definition: Stripe.cpp:282
QList< Kwave::Stripe > m_stripes
Definition: SampleReader.h:173
#define SAMPLE_MAX
Definition: Sample.h:52
unsigned int toUint(T x)
Definition: Utils.h:109
void minMax(unsigned int first, unsigned int last, sample_t &min, sample_t &max)
Definition: Stripe.cpp:537
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator>>() [1/2]

Kwave::SampleReader & Kwave::SampleReader::operator>> ( sample_t sample)

Reads one single sample.

Definition at line 278 of file SampleReader.cpp.

References fillBuffer(), m_buffer, m_buffer_position, and m_buffer_used.

279 {
280  // get new buffer if end of last buffer reached
282  const Kwave::SampleArray &buffer = m_buffer;
283  sample = (m_buffer_position < m_buffer_used) ?
284  buffer[m_buffer_position++] : 0;
285  return *this;
286 }
unsigned int m_buffer_position
Definition: SampleReader.h:196
Kwave::SampleArray m_buffer
Definition: SampleReader.h:190
unsigned int m_buffer_used
Definition: SampleReader.h:193
Here is the call graph for this function:

◆ operator>>() [2/2]

Kwave::SampleReader & Kwave::SampleReader::operator>> ( Kwave::SampleArray sample)

Reads a full buffer of samples. If the buffer cannot be filled, it will be shrinked to the number of samples that were really read.

Definition at line 289 of file SampleReader.cpp.

References read(), Kwave::SampleArray::resize(), and Kwave::SampleArray::size().

291 {
292  unsigned int size = buffer.size();
293  unsigned int count = read(buffer, 0, size);
294  if (count != size) {
295  bool ok = buffer.resize(count);
296  Q_ASSERT(ok); // shrinking should always be possible
297  if (!ok) {
298  qWarning("Kwave::SampleReader::operator >> - OOM?");
299  }
300  }
301  return *this;
302 }
unsigned int read(Kwave::SampleArray &buffer, unsigned int dstoff, unsigned int length)
Here is the call graph for this function:

◆ output

void Kwave::SampleReader::output ( Kwave::SampleArray  data)
signal

Interface for the signal/slot based streaming API.

Parameters
datasample data that has been read

Referenced by goOn().

Here is the caller graph for this function:

◆ pos()

sample_index_t Kwave::SampleReader::pos ( ) const
inline

Returns the current read position.

Definition at line 111 of file SampleReader.h.

Referenced by Kwave::MultiTrackReader::proceeded(), and seek().

111  {
113  }
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
unsigned int m_buffer_used
Definition: SampleReader.h:193
Here is the caller graph for this function:

◆ proceeded

void Kwave::SampleReader::proceeded ( )
signal

Emitted when the internal buffer is filled or the reader is closed

Referenced by fillBuffer(), read(), and reset().

Here is the caller graph for this function:

◆ read()

unsigned int Kwave::SampleReader::read ( Kwave::SampleArray buffer,
unsigned int  dstoff,
unsigned int  length 
)

Reads samples into a buffer.

Parameters
bufferthe destination buffer to receive the samples
dstoffoffset within the destination buffer
lengthnumber of samples to read
Returns
number of read samples

Definition at line 137 of file SampleReader.cpp.

References eof(), m_buffer, m_buffer_position, m_buffer_used, m_last, m_progress_time, m_src_position, MEMCPY, MIN_PROGRESS_INTERVAL, proceeded(), readSamples(), Kwave::SampleArray::size(), and Kwave::toUint().

Referenced by Kwave::NormalizePlugin::getMaxPowerOfTrack(), Kwave::Writer::operator<<(), operator>>(), and Kwave::TrackPixmap::validateBuffer().

140 {
141  if (eof() || !length) return 0; // already done or nothing to do
142 
143  // just a sanity check
144  Q_ASSERT(buffer.size());
145  Q_ASSERT(dstoff < buffer.size());
146  if (dstoff >= buffer.size()) return 0;
147 
148  unsigned int count = 0;
149  unsigned int rest = length;
150  if (dstoff + rest > buffer.size()) rest = buffer.size() - dstoff;
151  Q_ASSERT(rest);
152  if (!rest) return 0;
153 
154  // first try to read from the current buffer
156  unsigned int cnt = rest;
157  unsigned int src = m_buffer_position;
158  unsigned int dst = dstoff;
159 
160  if (m_buffer_position + cnt > m_buffer_used)
162 
163  m_buffer_position += cnt;
164  count += cnt;
165  rest -= cnt;
166  dstoff += cnt;
167  qDebug("filling from buffer dstoff=%u, cnt=%u",dstoff,cnt);
168 #ifdef STRICTLY_QT
169  while (cnt--) {
170  buffer[dst++] = m_buffer[src++];
171  }
172 #else
173  const Kwave::SampleArray &in = m_buffer;
174  MEMCPY(&(buffer[dst]), &(in[src]), cnt * sizeof(sample_t));
175 #endif
176 
177  if (m_buffer_position >= m_buffer_used) {
178  // buffer is empty now
179  m_buffer_position = m_buffer_used = 0;
180  }
181 
182  if (!rest) {
183  // inform others that we proceeded
184  if (m_progress_time.elapsed() > MIN_PROGRESS_INTERVAL) {
185  m_progress_time.restart();
186  emit proceeded();
187  QApplication::sendPostedEvents();
188  }
189  return count; // done
190  }
191  }
192 
193  // take the rest directly out of the stripe(s)
194  if (m_src_position + rest > (m_last + 1)) // clip to end of reader range
195  rest = Kwave::toUint((m_last + 1) - m_src_position);
196  if (dstoff + rest > buffer.size()) // clip to end of buffer
197  rest = buffer.size() - dstoff;
198  Q_ASSERT(dstoff + rest <= buffer.size());
199  unsigned int len = readSamples(m_src_position, buffer, dstoff, rest);
200  Q_ASSERT(len == rest);
201  count += len;
202 
203  // inform others that we proceeded
204  if (m_progress_time.elapsed() > MIN_PROGRESS_INTERVAL) {
205  m_progress_time.restart();
206  emit proceeded();
207  QApplication::sendPostedEvents();
208  }
209  return count;
210 }
sample_index_t m_last
Definition: SampleReader.h:187
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
bool eof() const
Definition: SampleReader.h:66
Kwave::SampleArray m_buffer
Definition: SampleReader.h:190
#define MEMCPY
Definition: memcpy.h:37
#define MIN_PROGRESS_INTERVAL
unsigned int size() const
unsigned int toUint(T x)
Definition: Utils.h:109
unsigned int readSamples(sample_index_t offset, Kwave::SampleArray &buffer, unsigned int buf_offset, unsigned int length)
unsigned int m_buffer_used
Definition: SampleReader.h:193
qint32 sample_t
Definition: Sample.h:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readSamples()

unsigned int Kwave::SampleReader::readSamples ( sample_index_t  offset,
Kwave::SampleArray buffer,
unsigned int  buf_offset,
unsigned int  length 
)
protected

Read a block of samples, with padding if necessary.

Parameters
offsetposition where to start the read operation
bufferreceives the samples
buf_offsetoffset within the buffer
lengthnumber of samples to read
Returns
number of read samples

Definition at line 313 of file SampleReader.cpp.

References Kwave::Stripe::end(), Kwave::Stripe::length(), m_mode, m_src_position, m_stripes, padBuffer(), Kwave::Stripe::read(), Kwave::SinglePassForward, Kwave::SampleArray::size(), Kwave::Stripe::start(), and Kwave::toUint().

Referenced by fillBuffer(), and read().

317 {
318  Q_ASSERT(length);
319  if (!length) return 0; // nothing to do !?
320  Q_ASSERT(buf_offset + length <= buffer.size());
321 
322  unsigned int rest = length;
323  sample_index_t left = offset;
324  sample_index_t right = offset + length - 1;
325 
326  foreach (Kwave::Stripe s, m_stripes) {
327  if (!s.length()) continue;
328  sample_index_t start = s.start();
329  sample_index_t end = s.end();
330 
331  if (left < start) {
332  // gap before the stripe -> pad
333  sample_index_t pad = Kwave::toUint(start - left);
334  if (pad > rest) pad = rest;
335  padBuffer(buffer, buf_offset, Kwave::toUint(pad));
336  buf_offset += pad;
337  rest -= pad;
338  left += pad;
339  if (!rest) break;
340  }
341 
342  if (start > right) break; // done, we are after the range
343 
344  if (left <= end) {
345  // some kind of overlap
346  Q_ASSERT(left >= start);
347  unsigned int ofs = Kwave::toUint(left - start);
348  unsigned int len = Kwave::toUint(end - left + 1);
349  if (len > rest) len = rest;
350  unsigned int count = s.read(buffer, buf_offset, ofs, len);
351  Q_ASSERT(count == len);
352  buf_offset += count;
353  rest -= count;
354  left += count;
355  if (!rest) break;
356  }
357  }
358 
359  // pad at the end
360  if (rest) padBuffer(buffer, buf_offset, rest);
361 
362  m_src_position += length;
363 
364  // if this reader is of "single pass forward only" type: remove all
365  // stripes that we have passed -> there is no way back!
367  while (!m_stripes.isEmpty() &&
368  (m_stripes.first().end() < m_src_position))
369  {
370  m_stripes.removeFirst();
371  }
372  }
373 
374  return length;
375 }
unsigned int length() const
Definition: Stripe.cpp:276
unsigned int read(Kwave::SampleArray &buffer, unsigned int dstoff, unsigned int offset, unsigned int length)
Definition: Stripe.cpp:502
quint64 sample_index_t
Definition: Sample.h:28
sample_index_t m_src_position
Definition: SampleReader.h:181
sample_index_t start() const
Definition: Stripe.cpp:262
sample_index_t end() const
Definition: Stripe.cpp:282
QList< Kwave::Stripe > m_stripes
Definition: SampleReader.h:173
static void padBuffer(Kwave::SampleArray &buffer, unsigned int offset, unsigned int len)
unsigned int size() const
unsigned int toUint(T x)
Definition: Utils.h:109
Kwave::ReaderMode m_mode
Definition: SampleReader.h:170
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void Kwave::SampleReader::reset ( )

Resets the stream to it's start

Definition at line 52 of file SampleReader.cpp.

References m_buffer_position, m_buffer_used, m_first, m_src_position, and proceeded().

Referenced by Kwave::MultiTrackReader::reset().

53 {
55  m_buffer_used = 0;
57 
58  emit proceeded();
59 }
sample_index_t m_first
Definition: SampleReader.h:184
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
unsigned int m_buffer_used
Definition: SampleReader.h:193
Here is the caller graph for this function:

◆ seek()

void Kwave::SampleReader::seek ( sample_index_t  pos)

Seeks to a given position

Definition at line 237 of file SampleReader.cpp.

References m_buffer_position, m_buffer_used, m_last_seek_pos, m_mode, m_src_position, m_stripes, pos(), Kwave::SinglePassReverse, and skip().

Referenced by Kwave::ReversePlugin::reverseSlice(), Kwave::MultiTrackReader::seek(), and Kwave::TrackPixmap::validateBuffer().

238 {
239  const sample_index_t current_pos = m_src_position +
241 
242  if (pos == current_pos) return; // nothing to do
243 
244  if (pos < current_pos) {
245  // if we are in SinglePassReverse mode, discard all stripes
246  // that we already have passed, up to the end
248  while (!m_stripes.isEmpty() &&
249  (m_stripes.last().start() > m_last_seek_pos))
250  {
251 // qDebug("SampleReader: removing stripe [%9u ... %9u] (end=%9u)",
252 // m_stripes.last().start(),
253 // m_stripes.last().end(),
254 // m_last_seek_pos);
255  m_stripes.removeLast();
256  }
257  }
258 
259  // seek backwards
260  const sample_index_t count = current_pos - pos;
261  if (count <= m_buffer_position) {
262  // go back within the buffer
263  m_buffer_position -= count;
264  } else {
265  // skip out of the buffer
267  m_buffer_position = m_buffer_used = 0;
268  }
269  } else {
270  // seek forward
271  skip(pos - current_pos);
272  }
273 
275 }
void skip(sample_index_t count)
unsigned int m_buffer_position
Definition: SampleReader.h:196
quint64 sample_index_t
Definition: Sample.h:28
sample_index_t m_src_position
Definition: SampleReader.h:181
sample_index_t pos() const
Definition: SampleReader.h:111
QList< Kwave::Stripe > m_stripes
Definition: SampleReader.h:173
unsigned int m_buffer_used
Definition: SampleReader.h:193
Kwave::ReaderMode m_mode
Definition: SampleReader.h:170
sample_index_t m_last_seek_pos
Definition: SampleReader.h:202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ skip()

void Kwave::SampleReader::skip ( sample_index_t  count)

Skips a number of samples.

Definition at line 213 of file SampleReader.cpp.

References m_buffer_position, m_buffer_used, m_mode, m_src_position, m_stripes, and Kwave::SinglePassForward.

Referenced by seek(), and Kwave::MultiTrackReader::skip().

214 {
215  if (m_buffer_position + count < m_buffer_used) {
216  // skip within the buffer
217  m_buffer_position += count;
218  } else {
219  // skip out of the buffer
220  count -= m_buffer_used;
221  m_src_position += count;
223  }
224 
225  // if this reader is of "single pass forward only" type: remove all
226  // stripes that we have passed -> there is no way back!
228  while (!m_stripes.isEmpty() &&
229  (m_stripes.first().end() < m_src_position))
230  {
231  m_stripes.removeFirst();
232  }
233  }
234 }
unsigned int m_buffer_position
Definition: SampleReader.h:196
sample_index_t m_src_position
Definition: SampleReader.h:181
QList< Kwave::Stripe > m_stripes
Definition: SampleReader.h:173
unsigned int m_buffer_used
Definition: SampleReader.h:193
Kwave::ReaderMode m_mode
Definition: SampleReader.h:170
Here is the caller graph for this function:

Member Data Documentation

◆ m_buffer

Kwave::SampleArray Kwave::SampleReader::m_buffer
private

intermediate buffer for the input data

Definition at line 190 of file SampleReader.h.

Referenced by fillBuffer(), operator>>(), and read().

◆ m_buffer_position

unsigned int Kwave::SampleReader::m_buffer_position
private

read position within the buffer

Definition at line 196 of file SampleReader.h.

Referenced by fillBuffer(), operator>>(), read(), reset(), seek(), and skip().

◆ m_buffer_used

unsigned int Kwave::SampleReader::m_buffer_used
private

number of used elements in the buffer

Definition at line 193 of file SampleReader.h.

Referenced by fillBuffer(), operator>>(), read(), reset(), seek(), and skip().

◆ m_first

sample_index_t Kwave::SampleReader::m_first
private

first sample index

Definition at line 184 of file SampleReader.h.

Referenced by reset().

◆ m_last

sample_index_t Kwave::SampleReader::m_last
private

last sample index

Definition at line 187 of file SampleReader.h.

Referenced by fillBuffer(), and read().

◆ m_last_seek_pos

sample_index_t Kwave::SampleReader::m_last_seek_pos
private

last seek position, needed in SinglePassReverse mode

Definition at line 202 of file SampleReader.h.

Referenced by seek().

◆ m_mode

Kwave::ReaderMode Kwave::SampleReader::m_mode
private

operation mode of the reader, see Kwave::ReaderMode

Definition at line 170 of file SampleReader.h.

Referenced by readSamples(), seek(), and skip().

◆ m_progress_time

QTime Kwave::SampleReader::m_progress_time
private

timer for limiting the number of progress signals per second

Definition at line 199 of file SampleReader.h.

Referenced by fillBuffer(), read(), and SampleReader().

◆ m_src_position

sample_index_t Kwave::SampleReader::m_src_position
private

Current sample position, related to the source of the samples. Does not reflect the position of the next sample to be read out due to internal buffering.

See also
pos() for the output position

Definition at line 181 of file SampleReader.h.

Referenced by fillBuffer(), read(), readSamples(), reset(), seek(), and skip().

◆ m_stripes

QList<Kwave::Stripe> Kwave::SampleReader::m_stripes
private

list of stipes in range

Definition at line 173 of file SampleReader.h.

Referenced by minMax(), readSamples(), seek(), and skip().


The documentation for this class was generated from the following files: