comparison data/model/WaveFileModel.h @ 300:5877d68815c7

* Change WaveFileModel API from getValues(start,end) to getData(start,count). It's much less error-prone to pass in frame counts instead of start/end locations. Should have done this ages ago. This closes #1794563. * Add option to apply a transform to only the selection region, instead of the whole audio. * (to make the above work properly) Add start frame offset to wave models
author Chris Cannam
date Mon, 01 Oct 2007 13:48:38 +0000
parents c022976d18e8
children 3a6725f285d6
comparison
equal deleted inserted replaced
299:576be0d0d218 300:5877d68815c7
50 virtual Model *clone() const; 50 virtual Model *clone() const;
51 51
52 float getValueMinimum() const { return -1.0f; } 52 float getValueMinimum() const { return -1.0f; }
53 float getValueMaximum() const { return 1.0f; } 53 float getValueMaximum() const { return 1.0f; }
54 54
55 virtual size_t getStartFrame() const { return 0; } 55 virtual size_t getStartFrame() const { return m_startFrame; }
56 virtual size_t getEndFrame() const { return getFrameCount(); } 56 virtual size_t getEndFrame() const { return m_startFrame + getFrameCount(); }
57 57
58 virtual size_t getValues(int channel, size_t start, size_t end, 58 void setStartFrame(size_t startFrame) { m_startFrame = startFrame; }
59 float *buffer) const;
60 59
61 virtual size_t getValues(int channel, size_t start, size_t end, 60 virtual size_t getData(int channel, size_t start, size_t count,
62 double *buffer) const; 61 float *buffer) const;
63 62
64 virtual void getRanges(size_t channel, size_t start, size_t end, 63 virtual size_t getData(int channel, size_t start, size_t count,
65 RangeBlock &ranges, 64 double *buffer) const;
66 size_t &blockSize) const;
67 65
68 virtual Range getRange(size_t channel, size_t start, size_t end) const; 66 virtual void getSummaries(size_t channel, size_t start, size_t count,
67 RangeBlock &ranges,
68 size_t &blockSize) const;
69
70 virtual Range getSummary(size_t channel, size_t start, size_t count) const;
69 71
70 virtual void toXml(QTextStream &out, 72 virtual void toXml(QTextStream &out,
71 QString indent = "", 73 QString indent = "",
72 QString extraAttributes = "") const; 74 QString extraAttributes = "") const;
73 75
103 105
104 QString m_path; 106 QString m_path;
105 AudioFileReader *m_reader; 107 AudioFileReader *m_reader;
106 bool m_myReader; 108 bool m_myReader;
107 109
110 size_t m_startFrame;
111
108 RangeBlock m_cache[2]; // interleaved at two base resolutions 112 RangeBlock m_cache[2]; // interleaved at two base resolutions
109 mutable QMutex m_mutex; 113 mutable QMutex m_mutex;
110 RangeCacheFillThread *m_fillThread; 114 RangeCacheFillThread *m_fillThread;
111 QTimer *m_updateTimer; 115 QTimer *m_updateTimer;
112 size_t m_lastFillExtent; 116 size_t m_lastFillExtent;