Mercurial > hg > svcore
diff data/fileio/AudioFileReader.h @ 327:1d656dcda8ef
* some tweaks to improve usability of these classes in a console application
author | Chris Cannam |
---|---|
date | Fri, 02 Nov 2007 16:50:31 +0000 |
parents | c324d410b096 |
children | 1afaf98dbf11 |
line wrap: on
line diff
--- a/data/fileio/AudioFileReader.h Thu Nov 01 16:02:01 2007 +0000 +++ b/data/fileio/AudioFileReader.h Fri Nov 02 16:50:31 2007 +0000 @@ -17,10 +17,13 @@ #define _AUDIO_FILE_READER_H_ #include <QString> -#include "model/Model.h" // for SampleBlock #include "FileSource.h" +#include <vector> + +typedef std::vector<float> SampleBlock; + class AudioFileReader : public QObject { Q_OBJECT @@ -45,6 +48,10 @@ virtual QString getTitle() const { return ""; } /** + * Return interleaved samples for count frames from index start. + * The resulting sample block will contain count * + * getChannelCount() samples (or fewer if end of file is reached). + * * The subclass implementations of this function must be * thread-safe -- that is, safe to call from multiple threads with * different arguments on the same object at the same time. @@ -52,6 +59,16 @@ virtual void getInterleavedFrames(size_t start, size_t count, SampleBlock &frames) const = 0; + /** + * Return de-interleaved samples for count frames from index + * start. Implemented in this class (it calls + * getInterleavedFrames and de-interleaves). The resulting vector + * will contain getChannelCount() sample blocks of count samples + * each (or fewer if end of file is reached). + */ + virtual void getDeInterleavedFrames(size_t start, size_t count, + std::vector<SampleBlock> &frames) const; + // only subclasses that do not know exactly how long the audio // file is until it's been completely decoded should implement this virtual int getDecodeCompletion() const { return 100; } // %