Mercurial > hg > svcore
comparison data/fft/FFTDataServer.h @ 154:6ec58bb8f729
* Suspend/resume fft data server write activity while reading from a server
to repaint the spectrogram display. Makes a significant improvement to
the otherwise dreadful responsiveness of spectrogram display.
author | Chris Cannam |
---|---|
date | Thu, 03 Aug 2006 12:42:15 +0000 |
parents | 21792a550ec9 |
children | ae9be6b6b522 |
comparison
equal
deleted
inserted
replaced
153:8d92611901d3 | 154:6ec58bb8f729 |
---|---|
72 float getPhaseAt(size_t x, size_t y); | 72 float getPhaseAt(size_t x, size_t y); |
73 void getValuesAt(size_t x, size_t y, float &real, float &imaginary); | 73 void getValuesAt(size_t x, size_t y, float &real, float &imaginary); |
74 bool isColumnReady(size_t x); | 74 bool isColumnReady(size_t x); |
75 | 75 |
76 void suspend(); | 76 void suspend(); |
77 void resume(); // also happens automatically if new data needed | |
77 | 78 |
78 // Convenience functions: | 79 // Convenience functions: |
79 | 80 |
80 bool isLocalPeak(size_t x, size_t y) { | 81 bool isLocalPeak(size_t x, size_t y) { |
81 float mag = getMagnitudeAt(x, y); | 82 float mag = getMagnitudeAt(x, y); |
129 typedef std::deque<int> IntQueue; | 130 typedef std::deque<int> IntQueue; |
130 IntQueue m_dormantCaches; | 131 IntQueue m_dormantCaches; |
131 | 132 |
132 int m_lastUsedCache; | 133 int m_lastUsedCache; |
133 FFTCache *getCache(size_t x, size_t &col) { | 134 FFTCache *getCache(size_t x, size_t &col) { |
134 if (m_suspended) resume(); | |
135 col = x % m_cacheWidth; | 135 col = x % m_cacheWidth; |
136 int c = x / m_cacheWidth; | 136 int c = x / m_cacheWidth; |
137 // The only use of m_lastUsedCache without a lock is to | 137 // The only use of m_lastUsedCache without a lock is to |
138 // establish whether a cache has been created at all (they're | 138 // establish whether a cache has been created at all (they're |
139 // created on demand, but not destroyed until the server is). | 139 // created on demand, but not destroyed until the server is). |
177 bool m_suspended; | 177 bool m_suspended; |
178 FillThread *m_fillThread; | 178 FillThread *m_fillThread; |
179 | 179 |
180 void deleteProcessingData(); | 180 void deleteProcessingData(); |
181 void fillColumn(size_t x); | 181 void fillColumn(size_t x); |
182 void resume(); | |
183 | 182 |
184 QString generateFileBasename() const; | 183 QString generateFileBasename() const; |
185 static QString generateFileBasename(const DenseTimeValueModel *model, | 184 static QString generateFileBasename(const DenseTimeValueModel *model, |
186 int channel, | 185 int channel, |
187 WindowType windowType, | 186 WindowType windowType, |