|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change required a significant refactoring of the application,
including:
* Re-write WavFile class so that it inherits from QFile rather
than taking a QIODevice as an argument to its method calls.
* Modified Engine class so that its internal QByteArray buffer
(m_buffer) need not correspond to the entire clip. This was done
by introducing the m_bufferPosition variable, which indicates the
offset from the start of the clip to the start of the region of
the clip which is currently held in memory. For tone generation
and record/playback modes, the buffer does still map directly to
the whole clip, so m_bufferPosition is always zero. For file
playback, the WavFile instance is the QIODevice which is passed
to QAudioOutput; m_buffer is just the part of the file which is
currently in memory for spectrum analysis, level calculation and
waveform rendering.
* For file playback, introduced a second WavFile instance as a
member of the Engine class. This is because QFile::seek() is
called in order to read the part of the file currently required
for analysis. If the QAudioOutput implementation passes its
QIODevice across a thread boundary, this seeking causes playback
to jump around within the file rather than progressing smoothly
forward.
* Modified the audioLength utility function so that its return
value is always a multiple of the sample size.
In the process of making the above changes, a few other minor
modifications were made:
* Modify all internal APIs concerned with buffer offsets and lengths
to deal in bytes. Previously, some calls passed values in
microseconds and others in bytes, which was confusing.
* Remove write functionality from WavFile class, since it is not
used in this application.
Task-number: QTBUG-12936
|