diff data/fileio/CodedAudioFileReader.h @ 297:c022976d18e8

* Merge from sv-match-alignment branch (excluding alignment-specific document). - add aggregate wave model (not yet complete enough to be added as a true model in a layer, but there's potential) - add play solo mode - add alignment model -- unused in plain SV - fix two plugin leaks - add m3u playlist support (opens all files at once, potentially hazardous) - fix retrieval of pre-encoded URLs - add ability to resample audio files on import, so as to match rates with other files previously loaded; add preference for same - add preliminary support in transform code for range and rate of transform input - reorganise preferences dialog, move dark-background option to preferences, add option for temporary directory location
author Chris Cannam
date Fri, 28 Sep 2007 13:56:38 +0000
parents 92e8dbde73cd
children b92513201610
line wrap: on
line diff
--- a/data/fileio/CodedAudioFileReader.h	Fri Sep 21 09:13:11 2007 +0000
+++ b/data/fileio/CodedAudioFileReader.h	Fri Sep 28 13:56:38 2007 +0000
@@ -22,6 +22,8 @@
 #include <QMutex>
 
 class WavFileReader;
+class Serialiser;
+class Resampler;
 
 class CodedAudioFileReader : public AudioFileReader
 {
@@ -36,18 +38,31 @@
     virtual void getInterleavedFrames(size_t start, size_t count,
 				      SampleBlock &frames) const;
 
+    virtual size_t getNativeRate() const { return m_fileRate; }
+
 protected:
-    CodedAudioFileReader(CacheMode cacheMode);
+    CodedAudioFileReader(CacheMode cacheMode, size_t targetRate);
 
     void initialiseDecodeCache(); // samplerate, channels must have been set
-    void addSampleToDecodeCache(float sample);
+    void addSamplesToDecodeCache(float **samples, size_t nframes);
+    void addSamplesToDecodeCache(float *samplesInterleaved, size_t nframes);
+    void addSamplesToDecodeCache(const SampleBlock &interleaved);
     void finishDecodeCache();
     bool isDecodeCacheInitialised() const { return m_initialised; }
 
+    void startSerialised(QString id);
+    void endSerialised();
+
+private:
+    void pushBuffer(float *interleaved, size_t sz, bool final);
+
+protected:
     QMutex m_cacheMutex;
     CacheMode m_cacheMode;
     SampleBlock m_data;
     bool m_initialised;
+    Serialiser *m_serialiser;
+    size_t m_fileRate;
 
     QString m_cacheFileName;
     SNDFILE *m_cacheFileWritePtr;
@@ -55,6 +70,9 @@
     float *m_cacheWriteBuffer;
     size_t m_cacheWriteBufferIndex;
     size_t m_cacheWriteBufferSize; // frames
+
+    Resampler *m_resampler;
+    float *m_resampleBuffer;
 };
 
 #endif