Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.h @ 1126:39019ce29178 tony-2.0-integration
Merge through to branch for Tony 2.0
author | Chris Cannam |
---|---|
date | Thu, 20 Aug 2015 14:54:21 +0100 |
parents | 5cbf71022679 |
children | 757a406dabc4 |
comparison
equal
deleted
inserted
replaced
1119:e22bfe8ca248 | 1126:39019ce29178 |
---|---|
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 enum DecodeMode { |
42 DecodeAtOnce, // decode the file on construction, with progress | |
43 DecodeThreaded // decode in a background thread after construction | |
44 }; | |
45 | |
46 virtual std::vector<float> getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; | |
42 | 47 |
43 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } | 48 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } |
44 | 49 |
45 virtual QString getLocalFilename() const { return m_cacheFileName; } | 50 virtual QString getLocalFilename() const { return m_cacheFileName; } |
46 | 51 |
58 void initialiseDecodeCache(); // samplerate, channels must have been set | 63 void initialiseDecodeCache(); // samplerate, channels must have been set |
59 | 64 |
60 // may throw InsufficientDiscSpace: | 65 // may throw InsufficientDiscSpace: |
61 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); | 66 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); |
62 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); | 67 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); |
63 void addSamplesToDecodeCache(const SampleBlock &interleaved); | 68 void addSamplesToDecodeCache(const std::vector<float> &interleaved); |
64 | 69 |
65 // may throw InsufficientDiscSpace: | 70 // may throw InsufficientDiscSpace: |
66 void finishDecodeCache(); | 71 void finishDecodeCache(); |
67 | 72 |
68 bool isDecodeCacheInitialised() const { return m_initialised; } | 73 bool isDecodeCacheInitialised() const { return m_initialised; } |
76 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); | 81 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); |
77 | 82 |
78 protected: | 83 protected: |
79 QMutex m_cacheMutex; | 84 QMutex m_cacheMutex; |
80 CacheMode m_cacheMode; | 85 CacheMode m_cacheMode; |
81 SampleBlock m_data; | 86 std::vector<float> m_data; |
82 mutable QReadWriteLock m_dataLock; | 87 mutable QMutex m_dataLock; |
83 bool m_initialised; | 88 bool m_initialised; |
84 Serialiser *m_serialiser; | 89 Serialiser *m_serialiser; |
85 sv_samplerate_t m_fileRate; | 90 sv_samplerate_t m_fileRate; |
86 | 91 |
87 QString m_cacheFileName; | 92 QString m_cacheFileName; |