diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2010-11-12 00:23:27 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2010-11-12 00:23:27 (GMT) |
commit | 6e49bbc11a0cbe2f596f26066256154b0a5b23be (patch) | |
tree | 2d7cb412d212187c9b07a9f6d9fcd2b461a70936 /demos/spectrum/app/wavfile.h | |
parent | 1d228b5d532dc158d1c9ac3347168cdc11378779 (diff) | |
parent | 7a81735272b5ee065f499a492cca4b4a703e0659 (diff) | |
download | Qt-6e49bbc11a0cbe2f596f26066256154b0a5b23be.zip Qt-6e49bbc11a0cbe2f596f26066256154b0a5b23be.tar.gz Qt-6e49bbc11a0cbe2f596f26066256154b0a5b23be.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
Diffstat (limited to 'demos/spectrum/app/wavfile.h')
-rw-r--r-- | demos/spectrum/app/wavfile.h | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/demos/spectrum/app/wavfile.h b/demos/spectrum/app/wavfile.h index fc14b08..935e935 100644 --- a/demos/spectrum/app/wavfile.h +++ b/demos/spectrum/app/wavfile.h @@ -46,38 +46,22 @@ #include <QtCore/qfile.h> #include <QtMultimedia/qaudioformat.h> -/** - * Helper class for reading WAV files - * - * See https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ - */ -class WavFile +class WavFile : public QFile { public: - WavFile(const QAudioFormat &format = QAudioFormat(), - qint64 dataLength = 0); + WavFile(QObject *parent = 0); - // Reads WAV header and seeks to start of data - bool readHeader(QIODevice &device); + bool open(const QString &fileName); + const QAudioFormat &fileFormat() const; + qint64 headerLength() const; - // Writes WAV header - bool writeHeader(QIODevice &device); - - // Read PCM data - qint64 readData(QIODevice &device, QByteArray &buffer, - QAudioFormat outputFormat = QAudioFormat()); - - const QAudioFormat& format() const; - qint64 dataLength() const; - - static qint64 headerLength(); - - static bool writeDataLength(QIODevice &device, qint64 dataLength); +private: + bool readHeader(); private: - QAudioFormat m_format; - qint64 m_dataLength; - qint64 m_dataPosition; + QAudioFormat m_fileFormat; + qint64 m_headerLength; + }; #endif |