comparison data/fileio/CodedAudioFileReader.h @ 935:f960d67ce842 tonioni

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:42:01 +0100
parents d03b3d956358
children 36f79bc5c3d7
comparison
equal deleted inserted replaced
925:3efc20c59a94 935:f960d67ce842
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, 53 CodedAudioFileReader(CacheMode cacheMode,
54 size_t targetRate, 54 int targetRate,
55 bool normalised); 55 bool normalised);
56 56
57 void initialiseDecodeCache(); // samplerate, channels must have been set 57 void initialiseDecodeCache(); // samplerate, channels must have been set
58 58
59 // may throw InsufficientDiscSpace: 59 // may throw InsufficientDiscSpace:
60 void addSamplesToDecodeCache(float **samples, size_t nframes); 60 void addSamplesToDecodeCache(float **samples, int nframes);
61 void addSamplesToDecodeCache(float *samplesInterleaved, size_t nframes); 61 void addSamplesToDecodeCache(float *samplesInterleaved, int nframes);
62 void addSamplesToDecodeCache(const SampleBlock &interleaved); 62 void addSamplesToDecodeCache(const SampleBlock &interleaved);
63 63
64 // may throw InsufficientDiscSpace: 64 // may throw InsufficientDiscSpace:
65 void finishDecodeCache(); 65 void finishDecodeCache();
66 66
68 68
69 void startSerialised(QString id); 69 void startSerialised(QString id);
70 void endSerialised(); 70 void endSerialised();
71 71
72 private: 72 private:
73 void pushBuffer(float *interleaved, size_t sz, bool final); 73 void pushBuffer(float *interleaved, int sz, bool final);
74 void pushBufferResampling(float *interleaved, size_t sz, float ratio, bool final); 74 void pushBufferResampling(float *interleaved, int sz, float ratio, bool final);
75 void pushBufferNonResampling(float *interleaved, size_t sz); 75 void pushBufferNonResampling(float *interleaved, int sz);
76 76
77 protected: 77 protected:
78 QMutex m_cacheMutex; 78 QMutex m_cacheMutex;
79 CacheMode m_cacheMode; 79 CacheMode m_cacheMode;
80 SampleBlock m_data; 80 SampleBlock m_data;
81 mutable QReadWriteLock m_dataLock; 81 mutable QReadWriteLock m_dataLock;
82 bool m_initialised; 82 bool m_initialised;
83 Serialiser *m_serialiser; 83 Serialiser *m_serialiser;
84 size_t m_fileRate; 84 int m_fileRate;
85 85
86 QString m_cacheFileName; 86 QString m_cacheFileName;
87 SNDFILE *m_cacheFileWritePtr; 87 SNDFILE *m_cacheFileWritePtr;
88 WavFileReader *m_cacheFileReader; 88 WavFileReader *m_cacheFileReader;
89 float *m_cacheWriteBuffer; 89 float *m_cacheWriteBuffer;
90 size_t m_cacheWriteBufferIndex; 90 int m_cacheWriteBufferIndex;
91 size_t m_cacheWriteBufferSize; // frames 91 int m_cacheWriteBufferSize; // frames
92 92
93 Resampler *m_resampler; 93 Resampler *m_resampler;
94 float *m_resampleBuffer; 94 float *m_resampleBuffer;
95 size_t m_fileFrameCount; 95 int m_fileFrameCount;
96 96
97 bool m_normalised; 97 bool m_normalised;
98 float m_max; 98 float m_max;
99 float m_gain; 99 float m_gain;
100 }; 100 };