Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.h @ 1096:4d9816ba0ebe simple-fft-model
Rework audio file reader API to prefer using std containers
author | Chris Cannam |
---|---|
date | Mon, 15 Jun 2015 12:19:47 +0100 |
parents | 843f67be0ed9 |
children | abc309f507ae |
comparison
equal
deleted
inserted
replaced
1095:b66734b5f806 | 1096:4d9816ba0ebe |
---|---|
36 enum CacheMode { | 36 enum CacheMode { |
37 CacheInTemporaryFile, | 37 CacheInTemporaryFile, |
38 CacheInMemory | 38 CacheInMemory |
39 }; | 39 }; |
40 | 40 |
41 virtual SampleBlock getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; | 41 virtual std::vector<float> getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; |
42 | 42 |
43 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } | 43 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } |
44 | 44 |
45 virtual QString getLocalFilename() const { return m_cacheFileName; } | 45 virtual QString getLocalFilename() const { return m_cacheFileName; } |
46 | 46 |
58 void initialiseDecodeCache(); // samplerate, channels must have been set | 58 void initialiseDecodeCache(); // samplerate, channels must have been set |
59 | 59 |
60 // may throw InsufficientDiscSpace: | 60 // may throw InsufficientDiscSpace: |
61 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); | 61 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); |
62 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); | 62 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); |
63 void addSamplesToDecodeCache(const SampleBlock &interleaved); | 63 void addSamplesToDecodeCache(const std::vector<float> &interleaved); |
64 | 64 |
65 // may throw InsufficientDiscSpace: | 65 // may throw InsufficientDiscSpace: |
66 void finishDecodeCache(); | 66 void finishDecodeCache(); |
67 | 67 |
68 bool isDecodeCacheInitialised() const { return m_initialised; } | 68 bool isDecodeCacheInitialised() const { return m_initialised; } |
76 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); | 76 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); |
77 | 77 |
78 protected: | 78 protected: |
79 QMutex m_cacheMutex; | 79 QMutex m_cacheMutex; |
80 CacheMode m_cacheMode; | 80 CacheMode m_cacheMode; |
81 SampleBlock m_data; | 81 std::vector<float> m_data; |
82 mutable QReadWriteLock m_dataLock; | 82 mutable QReadWriteLock m_dataLock; |
83 bool m_initialised; | 83 bool m_initialised; |
84 Serialiser *m_serialiser; | 84 Serialiser *m_serialiser; |
85 sv_samplerate_t m_fileRate; | 85 sv_samplerate_t m_fileRate; |
86 | 86 |