summaryrefslogtreecommitdiffstats
path: root/demos/spectrum/app/wavfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'demos/spectrum/app/wavfile.h')
-rw-r--r--demos/spectrum/app/wavfile.h35
1 files changed, 10 insertions, 25 deletions
diff --git a/demos/spectrum/app/wavfile.h b/demos/spectrum/app/wavfile.h
index f2f3304..935e935 100644
--- a/demos/spectrum/app/wavfile.h
+++ b/demos/spectrum/app/wavfile.h
@@ -46,37 +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;
+ QAudioFormat m_fileFormat;
+ qint64 m_headerLength;
+
};
#endif