Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.h @ 936:0c1d6de8f44b
Merge from branch warnfix_no_size_t
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 13:51:16 +0100 |
parents | d03b3d956358 |
children | 36f79bc5c3d7 |
comparison
equal
deleted
inserted
replaced
917:49618f39ff09 | 936:0c1d6de8f44b |
---|---|
36 enum CacheMode { | 36 enum CacheMode { |
37 CacheInTemporaryFile, | 37 CacheInTemporaryFile, |
38 CacheInMemory | 38 CacheInMemory |
39 }; | 39 }; |
40 | 40 |
41 virtual void getInterleavedFrames(size_t start, size_t count, | 41 virtual void getInterleavedFrames(int start, int count, |
42 SampleBlock &frames) const; | 42 SampleBlock &frames) const; |
43 | 43 |
44 virtual size_t getNativeRate() const { return m_fileRate; } | 44 virtual int getNativeRate() const { return m_fileRate; } |
45 | 45 |
46 /// Intermediate cache means all CodedAudioFileReaders are quickly seekable | 46 /// Intermediate cache means all CodedAudioFileReaders are quickly seekable |
47 virtual bool isQuicklySeekable() const { return true; } | 47 virtual bool isQuicklySeekable() const { return true; } |
48 | 48 |
49 signals: | 49 signals: |
50 void progress(int); | 50 void progress(int); |
51 | 51 |
52 protected: | 52 protected: |
53 CodedAudioFileReader(CacheMode cacheMode, size_t targetRate); | 53 CodedAudioFileReader(CacheMode cacheMode, |
54 int targetRate, | |
55 bool normalised); | |
54 | 56 |
55 void initialiseDecodeCache(); // samplerate, channels must have been set | 57 void initialiseDecodeCache(); // samplerate, channels must have been set |
56 | 58 |
57 // may throw InsufficientDiscSpace: | 59 // may throw InsufficientDiscSpace: |
58 void addSamplesToDecodeCache(float **samples, size_t nframes); | 60 void addSamplesToDecodeCache(float **samples, int nframes); |
59 void addSamplesToDecodeCache(float *samplesInterleaved, size_t nframes); | 61 void addSamplesToDecodeCache(float *samplesInterleaved, int nframes); |
60 void addSamplesToDecodeCache(const SampleBlock &interleaved); | 62 void addSamplesToDecodeCache(const SampleBlock &interleaved); |
61 | 63 |
62 // may throw InsufficientDiscSpace: | 64 // may throw InsufficientDiscSpace: |
63 void finishDecodeCache(); | 65 void finishDecodeCache(); |
64 | 66 |
66 | 68 |
67 void startSerialised(QString id); | 69 void startSerialised(QString id); |
68 void endSerialised(); | 70 void endSerialised(); |
69 | 71 |
70 private: | 72 private: |
71 void pushBuffer(float *interleaved, size_t sz, bool final); | 73 void pushBuffer(float *interleaved, int sz, bool final); |
72 void pushBufferResampling(float *interleaved, size_t sz, float ratio, bool final); | 74 void pushBufferResampling(float *interleaved, int sz, float ratio, bool final); |
73 void pushBufferNonResampling(float *interleaved, size_t sz); | 75 void pushBufferNonResampling(float *interleaved, int sz); |
74 | 76 |
75 protected: | 77 protected: |
76 QMutex m_cacheMutex; | 78 QMutex m_cacheMutex; |
77 CacheMode m_cacheMode; | 79 CacheMode m_cacheMode; |
78 SampleBlock m_data; | 80 SampleBlock m_data; |
79 mutable QReadWriteLock m_dataLock; | 81 mutable QReadWriteLock m_dataLock; |
80 bool m_initialised; | 82 bool m_initialised; |
81 Serialiser *m_serialiser; | 83 Serialiser *m_serialiser; |
82 size_t m_fileRate; | 84 int m_fileRate; |
83 | 85 |
84 QString m_cacheFileName; | 86 QString m_cacheFileName; |
85 SNDFILE *m_cacheFileWritePtr; | 87 SNDFILE *m_cacheFileWritePtr; |
86 WavFileReader *m_cacheFileReader; | 88 WavFileReader *m_cacheFileReader; |
87 float *m_cacheWriteBuffer; | 89 float *m_cacheWriteBuffer; |
88 size_t m_cacheWriteBufferIndex; | 90 int m_cacheWriteBufferIndex; |
89 size_t m_cacheWriteBufferSize; // frames | 91 int m_cacheWriteBufferSize; // frames |
90 | 92 |
91 Resampler *m_resampler; | 93 Resampler *m_resampler; |
92 float *m_resampleBuffer; | 94 float *m_resampleBuffer; |
93 size_t m_fileFrameCount; | 95 int m_fileFrameCount; |
96 | |
97 bool m_normalised; | |
98 float m_max; | |
99 float m_gain; | |
94 }; | 100 }; |
95 | 101 |
96 #endif | 102 #endif |