Mercurial > hg > svcore
comparison data/model/WaveFileModel.h @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | 36f79bc5c3d7 |
children | a1cd5abcb38b |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
41 bool isOK() const; | 41 bool isOK() const; |
42 bool isReady(int *) const; | 42 bool isReady(int *) const; |
43 | 43 |
44 const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; } | 44 const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; } |
45 | 45 |
46 int getFrameCount() const; | 46 sv_frame_t getFrameCount() const; |
47 int getChannelCount() const; | 47 int getChannelCount() const; |
48 int getSampleRate() const; | 48 int getSampleRate() const; |
49 int getNativeRate() const; | 49 int getNativeRate() const; |
50 | 50 |
51 QString getTitle() const; | 51 QString getTitle() const; |
57 virtual Model *clone() const; | 57 virtual Model *clone() const; |
58 | 58 |
59 float getValueMinimum() const { return -1.0f; } | 59 float getValueMinimum() const { return -1.0f; } |
60 float getValueMaximum() const { return 1.0f; } | 60 float getValueMaximum() const { return 1.0f; } |
61 | 61 |
62 virtual int getStartFrame() const { return m_startFrame; } | 62 virtual sv_frame_t getStartFrame() const { return m_startFrame; } |
63 virtual int getEndFrame() const { return m_startFrame + getFrameCount(); } | 63 virtual sv_frame_t getEndFrame() const { return m_startFrame + getFrameCount(); } |
64 | 64 |
65 void setStartFrame(int startFrame) { m_startFrame = startFrame; } | 65 void setStartFrame(sv_frame_t startFrame) { m_startFrame = startFrame; } |
66 | 66 |
67 virtual int getData(int channel, int start, int count, | 67 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, |
68 float *buffer) const; | 68 float *buffer) const; |
69 | 69 |
70 virtual int getData(int channel, int start, int count, | 70 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, |
71 double *buffer) const; | 71 double *buffer) const; |
72 | 72 |
73 virtual int getData(int fromchannel, int tochannel, | 73 virtual sv_frame_t getData(int fromchannel, int tochannel, |
74 int start, int count, | 74 sv_frame_t start, sv_frame_t count, |
75 float **buffers) const; | 75 float **buffers) const; |
76 | 76 |
77 virtual int getSummaryBlockSize(int desired) const; | 77 virtual int getSummaryBlockSize(int desired) const; |
78 | 78 |
79 virtual void getSummaries(int channel, int start, int count, | 79 virtual void getSummaries(int channel, sv_frame_t start, sv_frame_t count, |
80 RangeBlock &ranges, | 80 RangeBlock &ranges, |
81 int &blockSize) const; | 81 int &blockSize) const; |
82 | 82 |
83 virtual Range getSummary(int channel, int start, int count) const; | 83 virtual Range getSummary(int channel, sv_frame_t start, sv_frame_t count) const; |
84 | 84 |
85 QString getTypeName() const { return tr("Wave File"); } | 85 QString getTypeName() const { return tr("Wave File"); } |
86 | 86 |
87 virtual void toXml(QTextStream &out, | 87 virtual void toXml(QTextStream &out, |
88 QString indent = "", | 88 QString indent = "", |
100 public: | 100 public: |
101 RangeCacheFillThread(WaveFileModel &model) : | 101 RangeCacheFillThread(WaveFileModel &model) : |
102 m_model(model), m_fillExtent(0), | 102 m_model(model), m_fillExtent(0), |
103 m_frameCount(model.getFrameCount()) { } | 103 m_frameCount(model.getFrameCount()) { } |
104 | 104 |
105 int getFillExtent() const { return m_fillExtent; } | 105 sv_frame_t getFillExtent() const { return m_fillExtent; } |
106 virtual void run(); | 106 virtual void run(); |
107 | 107 |
108 protected: | 108 protected: |
109 WaveFileModel &m_model; | 109 WaveFileModel &m_model; |
110 int m_fillExtent; | 110 sv_frame_t m_fillExtent; |
111 int m_frameCount; | 111 sv_frame_t m_frameCount; |
112 }; | 112 }; |
113 | 113 |
114 void fillCache(); | 114 void fillCache(); |
115 | 115 |
116 FileSource m_source; | 116 FileSource m_source; |
117 QString m_path; | 117 QString m_path; |
118 AudioFileReader *m_reader; | 118 AudioFileReader *m_reader; |
119 bool m_myReader; | 119 bool m_myReader; |
120 | 120 |
121 int m_startFrame; | 121 sv_frame_t m_startFrame; |
122 | 122 |
123 RangeBlock m_cache[2]; // interleaved at two base resolutions | 123 RangeBlock m_cache[2]; // interleaved at two base resolutions |
124 mutable QMutex m_mutex; | 124 mutable QMutex m_mutex; |
125 RangeCacheFillThread *m_fillThread; | 125 RangeCacheFillThread *m_fillThread; |
126 QTimer *m_updateTimer; | 126 QTimer *m_updateTimer; |
127 int m_lastFillExtent; | 127 sv_frame_t m_lastFillExtent; |
128 bool m_exiting; | 128 bool m_exiting; |
129 static PowerOfSqrtTwoZoomConstraint m_zoomConstraint; | 129 static PowerOfSqrtTwoZoomConstraint m_zoomConstraint; |
130 | 130 |
131 mutable SampleBlock m_directRead; | 131 mutable SampleBlock m_directRead; |
132 mutable int m_lastDirectReadStart; | 132 mutable sv_frame_t m_lastDirectReadStart; |
133 mutable int m_lastDirectReadCount; | 133 mutable sv_frame_t m_lastDirectReadCount; |
134 mutable QMutex m_directReadMutex; | 134 mutable QMutex m_directReadMutex; |
135 }; | 135 }; |
136 | 136 |
137 #endif | 137 #endif |