Mercurial > hg > svcore
comparison data/model/WaveFileModel.h @ 175:b0f4555b625e
* Introduce WritableWaveFileModel, and use it as an output model for audio
real-time plugin transforms. Updates aren't working correctly yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Oct 2006 14:17:37 +0000 |
parents | 4148ad087959 |
children | 0ed2b2e26b44 |
comparison
equal
deleted
inserted
replaced
174:f8cf055dbf34 | 175:b0f4555b625e |
---|---|
32 { | 32 { |
33 Q_OBJECT | 33 Q_OBJECT |
34 | 34 |
35 public: | 35 public: |
36 WaveFileModel(QString path); | 36 WaveFileModel(QString path); |
37 WaveFileModel(QString path, AudioFileReader *reader); | |
37 ~WaveFileModel(); | 38 ~WaveFileModel(); |
38 | 39 |
39 bool isOK() const; | 40 bool isOK() const; |
40 bool isReady(int *) const; | 41 bool isReady(int *) const; |
41 | 42 |
69 virtual QString toXmlString(QString indent = "", | 70 virtual QString toXmlString(QString indent = "", |
70 QString extraAttributes = "") const; | 71 QString extraAttributes = "") const; |
71 | 72 |
72 protected slots: | 73 protected slots: |
73 void fillTimerTimedOut(); | 74 void fillTimerTimedOut(); |
75 void frameCountChanged(); | |
74 void cacheFilled(); | 76 void cacheFilled(); |
75 | 77 |
76 protected: | 78 protected: |
77 void initialize(); | 79 void initialize(); |
78 | 80 |
79 class RangeCacheFillThread : public Thread | 81 class RangeCacheFillThread : public Thread |
80 { | 82 { |
81 public: | 83 public: |
82 RangeCacheFillThread(WaveFileModel &model) : | 84 RangeCacheFillThread(WaveFileModel &model) : |
83 m_model(model), m_fillExtent(0) { } | 85 m_model(model), m_fillExtent(0), |
86 m_frameCount(model.getFrameCount()) { } | |
84 | 87 |
85 size_t getFillExtent() const { return m_fillExtent; } | 88 size_t getFillExtent() const { return m_fillExtent; } |
89 void frameCountChanged(); | |
86 virtual void run(); | 90 virtual void run(); |
87 | 91 |
88 protected: | 92 protected: |
89 WaveFileModel &m_model; | 93 WaveFileModel &m_model; |
90 size_t m_fillExtent; | 94 size_t m_fillExtent; |
95 size_t m_frameCount; | |
91 }; | 96 }; |
92 | 97 |
93 void fillCache(); | 98 void fillCache(); |
94 | 99 |
95 QString m_path; | 100 QString m_path; |
96 AudioFileReader *m_reader; | 101 AudioFileReader *m_reader; |
102 bool m_myReader; | |
97 | 103 |
98 RangeBlock m_cache[2]; // interleaved at two base resolutions | 104 RangeBlock m_cache[2]; // interleaved at two base resolutions |
99 mutable QMutex m_mutex; | 105 mutable QMutex m_mutex; |
100 RangeCacheFillThread *m_fillThread; | 106 RangeCacheFillThread *m_fillThread; |
101 QTimer *m_updateTimer; | 107 QTimer *m_updateTimer; |