Clarify API/docs by introducing the audio "frame", and add helpers.

The frame is the interleaved set of one sample for each channel.  Add
some docs and some methods that make working with samples a bit more
convenient.

Adjusted QAudioBuffer to use these helper functions and terminology.

Change-Id: I96db48e659561972d6de2aa19893d29f9a828cd3
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Michael Goddard
2012-07-10 14:26:58 +10:00
committed by Qt by Nokia
parent 68079a5e22
commit 4d13a15bae
7 changed files with 318 additions and 81 deletions

View File

@@ -91,6 +91,18 @@ public:
void setSampleType(QAudioFormat::SampleType sampleType);
QAudioFormat::SampleType sampleType() const;
// Helper functions
qint32 bytesForDuration(qint64 duration) const;
qint64 durationForBytes(qint32 byteCount) const;
qint32 bytesForFrames(qint32 frameCount) const;
qint32 framesForBytes(qint32 byteCount) const;
qint32 framesForDuration(qint64 duration) const;
qint64 durationForFrames(qint32 frameCount) const;
int bytesPerFrame() const;
private:
QSharedDataPointer<QAudioFormatPrivate> d;
};