comparison data/model/WaveFileModel.h @ 316:3a6725f285d6

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents 5877d68815c7
children c324d410b096
comparison
equal deleted inserted replaced
315:96ef9746c560 316:3a6725f285d6
18 18
19 #include "base/Thread.h" 19 #include "base/Thread.h"
20 #include <QMutex> 20 #include <QMutex>
21 #include <QTimer> 21 #include <QTimer>
22 22
23 #include "data/fileio/RemoteFile.h"
24
23 #include "RangeSummarisableTimeValueModel.h" 25 #include "RangeSummarisableTimeValueModel.h"
24 #include "PowerOfSqrtTwoZoomConstraint.h" 26 #include "PowerOfSqrtTwoZoomConstraint.h"
25 27
26 #include <stdlib.h> 28 #include <stdlib.h>
27 29
30 class WaveFileModel : public RangeSummarisableTimeValueModel 32 class WaveFileModel : public RangeSummarisableTimeValueModel
31 { 33 {
32 Q_OBJECT 34 Q_OBJECT
33 35
34 public: 36 public:
35 WaveFileModel(QString path, size_t targetRate = 0); 37 WaveFileModel(RemoteFile source, size_t targetRate = 0);
36 WaveFileModel(QString path, QString originalLocation, size_t targetRate = 0); 38 WaveFileModel(RemoteFile source, AudioFileReader *reader);
37 WaveFileModel(QString originalLocation, AudioFileReader *reader);
38 ~WaveFileModel(); 39 ~WaveFileModel();
39 40
40 bool isOK() const; 41 bool isOK() const;
41 bool isReady(int *) const; 42 bool isReady(int *) const;
42 43
100 size_t m_fillExtent; 101 size_t m_fillExtent;
101 size_t m_frameCount; 102 size_t m_frameCount;
102 }; 103 };
103 104
104 void fillCache(); 105 void fillCache();
105 106
107 RemoteFile m_source;
106 QString m_path; 108 QString m_path;
107 AudioFileReader *m_reader; 109 AudioFileReader *m_reader;
108 bool m_myReader; 110 bool m_myReader;
109 111
110 size_t m_startFrame; 112 size_t m_startFrame;