# HG changeset patch # User Chris Cannam # Date 1403012022 -3600 # Node ID 59e7fe1b10031f0c86e0f41c1b1489177165a422 # Parent 6a94bb528e9d31a45f72a16b75f69c0504a73cd8 Unsigned removals and warning fixes in data/ diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTCacheReader.h --- a/data/fft/FFTCacheReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTCacheReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -24,18 +24,18 @@ public: virtual ~FFTCacheReader() { } - virtual size_t getWidth() const = 0; - virtual size_t getHeight() const = 0; + virtual int getWidth() const = 0; + virtual int getHeight() const = 0; - virtual float getMagnitudeAt(size_t x, size_t y) const = 0; - virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0; - virtual float getMaximumMagnitudeAt(size_t x) const = 0; - virtual float getPhaseAt(size_t x, size_t y) const = 0; + virtual float getMagnitudeAt(int x, int y) const = 0; + virtual float getNormalizedMagnitudeAt(int x, int y) const = 0; + virtual float getMaximumMagnitudeAt(int x) const = 0; + virtual float getPhaseAt(int x, int y) const = 0; - virtual void getValuesAt(size_t x, size_t y, float &real, float &imag) const = 0; - virtual void getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const = 0; + virtual void getValuesAt(int x, int y, float &real, float &imag) const = 0; + virtual void getMagnitudesAt(int x, float *values, int minbin, int count, int step) const = 0; - virtual bool haveSetColumnAt(size_t x) const = 0; + virtual bool haveSetColumnAt(int x) const = 0; virtual FFTCache::StorageType getStorageType() const = 0; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTCacheWriter.h --- a/data/fft/FFTCacheWriter.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTCacheWriter.h Tue Jun 17 14:33:42 2014 +0100 @@ -23,13 +23,13 @@ public: virtual ~FFTCacheWriter() { } - virtual size_t getWidth() const = 0; - virtual size_t getHeight() const = 0; + virtual int getWidth() const = 0; + virtual int getHeight() const = 0; - virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0; - virtual void setColumnAt(size_t x, float *reals, float *imags) = 0; + virtual void setColumnAt(int x, float *mags, float *phases, float factor) = 0; + virtual void setColumnAt(int x, float *reals, float *imags) = 0; - virtual bool haveSetColumnAt(size_t x) const = 0; + virtual bool haveSetColumnAt(int x) const = 0; virtual void allColumnsWritten() = 0; // notify cache to close diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTDataServer.cpp --- a/data/fft/FFTDataServer.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTDataServer.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -48,12 +48,12 @@ FFTDataServer::getInstance(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn) + int fillFromColumn) { QString n = generateFileBasename(model, channel, @@ -110,12 +110,12 @@ FFTDataServer::getFuzzyInstance(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn) + int fillFromColumn) { // Fuzzy matching: // @@ -483,12 +483,12 @@ const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn) : + int fillFromColumn) : m_fileBaseName(fileBaseName), m_model(model), m_channel(channel), @@ -514,8 +514,8 @@ //!!! end is not correct until model finished reading -- what to do??? - size_t start = m_model->getStartFrame(); - size_t end = m_model->getEndFrame(); + int start = m_model->getStartFrame(); + int end = m_model->getEndFrame(); m_width = (end - start) / m_windowIncrement + 1; m_height = m_fftSize / 2 + 1; // DC == 0, Nyquist == fftsize/2 @@ -525,8 +525,8 @@ << m_width << "x" << m_height << endl; #endif - size_t maxCacheSize = 20 * 1024 * 1024; - size_t columnSize = m_height * sizeof(fftsample) * 2 + sizeof(fftsample); + int maxCacheSize = 20 * 1024 * 1024; + int columnSize = m_height * sizeof(fftsample) * 2 + sizeof(fftsample); if (m_width * columnSize < maxCacheSize * 2) m_cacheWidth = m_width; else m_cacheWidth = maxCacheSize / columnSize; @@ -562,7 +562,7 @@ } } - for (size_t i = 0; i <= m_width / m_cacheWidth; ++i) { + for (int i = 0; i <= m_width / m_cacheWidth; ++i) { m_caches.push_back(0); } @@ -678,7 +678,7 @@ } void -FFTDataServer::getStorageAdvice(size_t w, size_t h, +FFTDataServer::getStorageAdvice(int w, int h, bool &memoryCache, bool &compactCache) { int cells = w * h; @@ -763,7 +763,7 @@ QString name = QString("%1-%2").arg(m_fileBaseName).arg(c); - size_t width = m_cacheWidth; + int width = m_cacheWidth; if (c * m_cacheWidth + width > m_width) { width = m_width - c * m_cacheWidth; } @@ -885,7 +885,7 @@ } float -FFTDataServer::getMagnitudeAt(size_t x, size_t y) +FFTDataServer::getMagnitudeAt(int x, int y) { Profiler profiler("FFTDataServer::getMagnitudeAt", false); @@ -894,7 +894,7 @@ float val = 0; try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return 0; @@ -917,7 +917,7 @@ } bool -FFTDataServer::getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) +FFTDataServer::getMagnitudesAt(int x, float *values, int minbin, int count, int step) { Profiler profiler("FFTDataServer::getMagnitudesAt", false); @@ -930,7 +930,7 @@ } try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return false; @@ -950,7 +950,7 @@ } float -FFTDataServer::getNormalizedMagnitudeAt(size_t x, size_t y) +FFTDataServer::getNormalizedMagnitudeAt(int x, int y) { Profiler profiler("FFTDataServer::getNormalizedMagnitudeAt", false); @@ -960,7 +960,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return 0; @@ -978,7 +978,7 @@ } bool -FFTDataServer::getNormalizedMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) +FFTDataServer::getNormalizedMagnitudesAt(int x, float *values, int minbin, int count, int step) { Profiler profiler("FFTDataServer::getNormalizedMagnitudesAt", false); @@ -992,7 +992,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return false; @@ -1001,7 +1001,7 @@ fillColumn(x); } - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { values[i] = cache->getNormalizedMagnitudeAt(col, i * step + minbin); } @@ -1014,7 +1014,7 @@ } float -FFTDataServer::getMaximumMagnitudeAt(size_t x) +FFTDataServer::getMaximumMagnitudeAt(int x) { Profiler profiler("FFTDataServer::getMaximumMagnitudeAt", false); @@ -1024,7 +1024,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return 0; @@ -1042,7 +1042,7 @@ } float -FFTDataServer::getPhaseAt(size_t x, size_t y) +FFTDataServer::getPhaseAt(int x, int y) { Profiler profiler("FFTDataServer::getPhaseAt", false); @@ -1052,7 +1052,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return 0; @@ -1070,7 +1070,7 @@ } bool -FFTDataServer::getPhasesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) +FFTDataServer::getPhasesAt(int x, float *values, int minbin, int count, int step) { Profiler profiler("FFTDataServer::getPhasesAt", false); @@ -1084,7 +1084,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return false; @@ -1093,7 +1093,7 @@ fillColumn(x); } - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { values[i] = cache->getPhaseAt(col, i * step + minbin); } @@ -1106,7 +1106,7 @@ } void -FFTDataServer::getValuesAt(size_t x, size_t y, float &real, float &imaginary) +FFTDataServer::getValuesAt(int x, int y, float &real, float &imaginary) { Profiler profiler("FFTDataServer::getValuesAt", false); @@ -1118,7 +1118,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) { @@ -1143,7 +1143,7 @@ } bool -FFTDataServer::getValuesAt(size_t x, float *reals, float *imaginaries, size_t minbin, size_t count, size_t step) +FFTDataServer::getValuesAt(int x, float *reals, float *imaginaries, int minbin, int count, int step) { Profiler profiler("FFTDataServer::getValuesAt", false); @@ -1157,7 +1157,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return false; @@ -1166,7 +1166,7 @@ fillColumn(x); } - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { cache->getValuesAt(col, i * step + minbin, reals[i], imaginaries[i]); } @@ -1179,7 +1179,7 @@ } bool -FFTDataServer::isColumnReady(size_t x) +FFTDataServer::isColumnReady(int x) { Profiler profiler("FFTDataServer::isColumnReady", false); @@ -1200,7 +1200,7 @@ try { - size_t col; + int col; FFTCacheReader *cache = getCacheReader(x, col); if (!cache) return true; @@ -1213,7 +1213,7 @@ } void -FFTDataServer::fillColumn(size_t x) +FFTDataServer::fillColumn(int x) { Profiler profiler("FFTDataServer::fillColumn", false); @@ -1237,7 +1237,7 @@ return; } - size_t col; + int col; #ifdef DEBUG_FFT_SERVER_FILL cout << "FFTDataServer::fillColumn(" << x << ")" << endl; #endif @@ -1397,14 +1397,14 @@ else return ""; } -size_t +int FFTDataServer::getFillCompletion() const { if (m_fillThread) return m_fillThread->getCompletion(); else return 100; } -size_t +int FFTDataServer::getFillExtent() const { if (m_fillThread) return m_fillThread->getExtent(); @@ -1423,9 +1423,9 @@ FFTDataServer::generateFileBasename(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar) { char buffer[200]; @@ -1460,9 +1460,9 @@ } if (m_server.m_exiting) return; - size_t start = m_server.m_model->getStartFrame(); - size_t end = m_server.m_model->getEndFrame(); - size_t remainingEnd = end; + int start = m_server.m_model->getStartFrame(); + int end = m_server.m_model->getEndFrame(); + int remainingEnd = end; int counter = 0; int updateAt = 1; @@ -1471,7 +1471,7 @@ if (m_fillFrom > start) { - for (size_t f = m_fillFrom; f < end; f += m_server.m_windowIncrement) { + for (int f = m_fillFrom; f < end; f += m_server.m_windowIncrement) { try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); @@ -1503,7 +1503,7 @@ if (++counter == updateAt) { m_extent = f; - m_completion = size_t(100 * fabsf(float(f - m_fillFrom) / + m_completion = int(100 * fabsf(float(f - m_fillFrom) / float(end - start))); counter = 0; if (updateAt < maxUpdateAt) { @@ -1518,9 +1518,9 @@ else remainingEnd = start; } - size_t baseCompletion = m_completion; + int baseCompletion = m_completion; - for (size_t f = start; f < remainingEnd; f += m_server.m_windowIncrement) { + for (int f = start; f < remainingEnd; f += m_server.m_windowIncrement) { try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); @@ -1552,7 +1552,7 @@ if (++counter == updateAt) { m_extent = f; m_completion = baseCompletion + - size_t(100 * fabsf(float(f - start) / + int(100 * fabsf(float(f - start) / float(end - start))); counter = 0; if (updateAt < maxUpdateAt) { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTDataServer.h --- a/data/fft/FFTDataServer.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTDataServer.h Tue Jun 17 14:33:42 2014 +0100 @@ -43,24 +43,24 @@ static FFTDataServer *getInstance(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria = StorageAdviser::NoCriteria, - size_t fillFromColumn = 0); + int fillFromColumn = 0); static FFTDataServer *getFuzzyInstance(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria = StorageAdviser::NoCriteria, - size_t fillFromColumn = 0); + int fillFromColumn = 0); static void claimInstance(FFTDataServer *); static void releaseInstance(FFTDataServer *); @@ -70,25 +70,25 @@ const DenseTimeValueModel *getModel() const { return m_model; } int getChannel() const { return m_channel; } WindowType getWindowType() const { return m_windower.getType(); } - size_t getWindowSize() const { return m_windowSize; } - size_t getWindowIncrement() const { return m_windowIncrement; } - size_t getFFTSize() const { return m_fftSize; } + int getWindowSize() const { return m_windowSize; } + int getWindowIncrement() const { return m_windowIncrement; } + int getFFTSize() const { return m_fftSize; } bool getPolar() const { return m_polar; } - size_t getWidth() const { return m_width; } - size_t getHeight() const { return m_height; } + int getWidth() const { return m_width; } + int getHeight() const { return m_height; } - float getMagnitudeAt(size_t x, size_t y); - float getNormalizedMagnitudeAt(size_t x, size_t y); - float getMaximumMagnitudeAt(size_t x); - float getPhaseAt(size_t x, size_t y); - void getValuesAt(size_t x, size_t y, float &real, float &imaginary); - bool isColumnReady(size_t x); + float getMagnitudeAt(int x, int y); + float getNormalizedMagnitudeAt(int x, int y); + float getMaximumMagnitudeAt(int x); + float getPhaseAt(int x, int y); + void getValuesAt(int x, int y, float &real, float &imaginary); + bool isColumnReady(int x); - bool getMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0, size_t step = 1); - bool getNormalizedMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0, size_t step = 1); - bool getPhasesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0, size_t step = 1); - bool getValuesAt(size_t x, float *reals, float *imaginaries, size_t minbin = 0, size_t count = 0, size_t step = 1); + bool getMagnitudesAt(int x, float *values, int minbin = 0, int count = 0, int step = 1); + bool getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0, int step = 1); + bool getPhasesAt(int x, float *values, int minbin = 0, int count = 0, int step = 1); + bool getValuesAt(int x, float *reals, float *imaginaries, int minbin = 0, int count = 0, int step = 1); void suspend(); void suspendWrites(); @@ -96,31 +96,31 @@ // Convenience functions: - bool isLocalPeak(size_t x, size_t y) { + bool isLocalPeak(int x, int y) { float mag = getMagnitudeAt(x, y); if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; if (y < getHeight()-1 && mag < getMagnitudeAt(x, y + 1)) return false; return true; } - bool isOverThreshold(size_t x, size_t y, float threshold) { + bool isOverThreshold(int x, int y, float threshold) { return getMagnitudeAt(x, y) > threshold; } QString getError() const; - size_t getFillCompletion() const; - size_t getFillExtent() const; + int getFillCompletion() const; + int getFillExtent() const; private: FFTDataServer(QString fileBaseName, const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn = 0); + int fillFromColumn = 0); virtual ~FFTDataServer(); @@ -135,16 +135,16 @@ Window m_windower; - size_t m_windowSize; - size_t m_windowIncrement; - size_t m_fftSize; + int m_windowSize; + int m_windowIncrement; + int m_fftSize; bool m_polar; - size_t m_width; - size_t m_height; - size_t m_cacheWidth; - size_t m_cacheWidthPower; - size_t m_cacheWidthMask; + int m_width; + int m_height; + int m_cacheWidth; + int m_cacheWidthPower; + int m_cacheWidthMask; struct CacheBlock { FFTMemoryCache *memoryCache; @@ -167,7 +167,7 @@ QReadWriteLock m_cacheVectorLock; // locks cache lookup, not use QMutex m_cacheCreationMutex; // solely to serialise makeCache() calls - FFTCacheReader *getCacheReader(size_t x, size_t &col) { + FFTCacheReader *getCacheReader(int x, int &col) { Profiler profiler("FFTDataServer::getCacheReader"); col = x & m_cacheWidthMask; int c = x >> m_cacheWidthPower; @@ -200,7 +200,7 @@ return getCacheReader(x, col); } - FFTCacheWriter *getCacheWriter(size_t x, size_t &col) { + FFTCacheWriter *getCacheWriter(int x, int &col) { Profiler profiler("FFTDataServer::getCacheWriter"); col = x & m_cacheWidthMask; int c = x >> m_cacheWidthPower; @@ -218,7 +218,7 @@ return getCacheWriter(x, col); } - bool haveCache(size_t x) { + bool haveCache(int x) { int c = x >> m_cacheWidthPower; return (m_caches.at(c) != 0); } @@ -228,7 +228,7 @@ StorageAdviser::Criteria m_criteria; - void getStorageAdvice(size_t w, size_t h, bool &memory, bool &compact); + void getStorageAdvice(int w, int h, bool &memory, bool &compact); QMutex m_fftBuffersLock; QWaitCondition m_condition; @@ -241,20 +241,20 @@ class FillThread : public Thread { public: - FillThread(FFTDataServer &server, size_t fillFromColumn) : + FillThread(FFTDataServer &server, int fillFromColumn) : m_server(server), m_extent(0), m_completion(0), m_fillFrom(fillFromColumn) { } - size_t getExtent() const { return m_extent; } - size_t getCompletion() const { return m_completion ? m_completion : 1; } + int getExtent() const { return m_extent; } + int getCompletion() const { return m_completion ? m_completion : 1; } QString getError() const { return m_error; } virtual void run(); protected: FFTDataServer &m_server; - size_t m_extent; - size_t m_completion; - size_t m_fillFrom; + int m_extent; + int m_completion; + int m_fillFrom; QString m_error; }; @@ -264,16 +264,16 @@ QString m_error; void deleteProcessingData(); - void fillColumn(size_t x); + void fillColumn(int x); void fillComplete(); QString generateFileBasename() const; static QString generateFileBasename(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar); typedef std::pair ServerCountPair; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTFileCacheReader.cpp --- a/data/fft/FFTFileCacheReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTFileCacheReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -53,22 +53,22 @@ delete m_mfc; } -size_t +int FFTFileCacheReader::getWidth() const { return m_mfc->getWidth(); } -size_t +int FFTFileCacheReader::getHeight() const { - size_t mh = m_mfc->getHeight(); + int mh = m_mfc->getHeight(); if (mh > m_factorSize) return (mh - m_factorSize) / 2; else return 0; } float -FFTFileCacheReader::getMagnitudeAt(size_t x, size_t y) const +FFTFileCacheReader::getMagnitudeAt(int x, int y) const { Profiler profiler("FFTFileCacheReader::getMagnitudeAt", false); @@ -98,7 +98,7 @@ } float -FFTFileCacheReader::getNormalizedMagnitudeAt(size_t x, size_t y) const +FFTFileCacheReader::getNormalizedMagnitudeAt(int x, int y) const { float value = 0.f; @@ -108,7 +108,8 @@ value = getFromReadBufCompactUnsigned(x, y * 2) / 65535.0; break; - default: + case FFTCache::Rectangular: + case FFTCache::Polar: { float mag = getMagnitudeAt(x, y); float factor = getNormalizationFactor(x); @@ -122,13 +123,13 @@ } float -FFTFileCacheReader::getMaximumMagnitudeAt(size_t x) const +FFTFileCacheReader::getMaximumMagnitudeAt(int x) const { return getNormalizationFactor(x); } float -FFTFileCacheReader::getPhaseAt(size_t x, size_t y) const +FFTFileCacheReader::getPhaseAt(int x, int y) const { float value = 0.f; @@ -155,7 +156,7 @@ } void -FFTFileCacheReader::getValuesAt(size_t x, size_t y, float &real, float &imag) const +FFTFileCacheReader::getValuesAt(int x, int y, float &real, float &imag) const { // SVDEBUG << "FFTFileCacheReader::getValuesAt(" << x << "," << y << ")" << endl; @@ -166,7 +167,8 @@ imag = getFromReadBufStandard(x, y * 2 + 1); return; - default: + case FFTCache::Compact: + case FFTCache::Polar: float mag = getMagnitudeAt(x, y); float phase = getPhaseAt(x, y); real = mag * cosf(phase); @@ -176,15 +178,15 @@ } void -FFTFileCacheReader::getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const +FFTFileCacheReader::getMagnitudesAt(int x, float *values, int minbin, int count, int step) const { Profiler profiler("FFTFileCacheReader::getMagnitudesAt"); switch (m_storageType) { case FFTCache::Compact: - for (size_t i = 0; i < count; ++i) { - size_t y = minbin + i * step; + for (int i = 0; i < count; ++i) { + int y = minbin + i * step; values[i] = (getFromReadBufCompactUnsigned(x, y * 2) / 65535.0) * getNormalizationFactor(x); } @@ -193,8 +195,8 @@ case FFTCache::Rectangular: { float real, imag; - for (size_t i = 0; i < count; ++i) { - size_t y = minbin + i * step; + for (int i = 0; i < count; ++i) { + int y = minbin + i * step; real = getFromReadBufStandard(x, y * 2); imag = getFromReadBufStandard(x, y * 2 + 1); values[i] = sqrtf(real * real + imag * imag); @@ -203,8 +205,8 @@ } case FFTCache::Polar: - for (size_t i = 0; i < count; ++i) { - size_t y = minbin + i * step; + for (int i = 0; i < count; ++i) { + int y = minbin + i * step; values[i] = getFromReadBufStandard(x, y * 2); } break; @@ -212,7 +214,7 @@ } bool -FFTFileCacheReader::haveSetColumnAt(size_t x) const +FFTFileCacheReader::haveSetColumnAt(int x) const { if (m_readbuf && m_readbufGood && (m_readbufCol == x || (m_readbufWidth > 1 && m_readbufCol+1 == x))) { @@ -222,17 +224,17 @@ return m_mfc->haveSetColumnAt(x); } -size_t -FFTFileCacheReader::getCacheSize(size_t width, size_t height, +int +FFTFileCacheReader::getCacheSize(int width, int height, FFTCache::StorageType type) { return (height * 2 + (type == FFTCache::Compact ? 2 : 1)) * width * (type == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float)) + - 2 * sizeof(size_t); // matrix file header size + 2 * sizeof(int); // matrix file header size } void -FFTFileCacheReader::populateReadBuf(size_t x) const +FFTFileCacheReader::populateReadBuf(int x) const { Profiler profiler("FFTFileCacheReader::populateReadBuf", false); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTFileCacheReader.h --- a/data/fft/FFTFileCacheReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTFileCacheReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -28,31 +28,31 @@ FFTFileCacheReader(FFTFileCacheWriter *); ~FFTFileCacheReader(); - size_t getWidth() const; - size_t getHeight() const; + int getWidth() const; + int getHeight() const; - float getMagnitudeAt(size_t x, size_t y) const; - float getNormalizedMagnitudeAt(size_t x, size_t y) const; - float getMaximumMagnitudeAt(size_t x) const; - float getPhaseAt(size_t x, size_t y) const; + float getMagnitudeAt(int x, int y) const; + float getNormalizedMagnitudeAt(int x, int y) const; + float getMaximumMagnitudeAt(int x) const; + float getPhaseAt(int x, int y) const; - void getValuesAt(size_t x, size_t y, float &real, float &imag) const; - void getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const; + void getValuesAt(int x, int y, float &real, float &imag) const; + void getMagnitudesAt(int x, float *values, int minbin, int count, int step) const; - bool haveSetColumnAt(size_t x) const; + bool haveSetColumnAt(int x) const; - static size_t getCacheSize(size_t width, size_t height, + static int getCacheSize(int width, int height, FFTCache::StorageType type); FFTCache::StorageType getStorageType() const { return m_storageType; } protected: mutable char *m_readbuf; - mutable size_t m_readbufCol; - mutable size_t m_readbufWidth; + mutable int m_readbufCol; + mutable int m_readbufWidth; mutable bool m_readbufGood; - float getFromReadBufStandard(size_t x, size_t y) const { + float getFromReadBufStandard(int x, int y) const { float v; if (m_readbuf && (m_readbufCol == x || (m_readbufWidth > 1 && m_readbufCol+1 == x))) { @@ -65,7 +65,7 @@ } } - float getFromReadBufCompactUnsigned(size_t x, size_t y) const { + float getFromReadBufCompactUnsigned(int x, int y) const { float v; if (m_readbuf && (m_readbufCol == x || (m_readbufWidth > 1 && m_readbufCol+1 == x))) { @@ -78,7 +78,7 @@ } } - float getFromReadBufCompactSigned(size_t x, size_t y) const { + float getFromReadBufCompactSigned(int x, int y) const { float v; if (m_readbuf && (m_readbufCol == x || (m_readbufWidth > 1 && m_readbufCol+1 == x))) { @@ -91,10 +91,10 @@ } } - void populateReadBuf(size_t x) const; + void populateReadBuf(int x) const; - float getNormalizationFactor(size_t col) const { - size_t h = m_mfc->getHeight(); + float getNormalizationFactor(int col) const { + int h = m_mfc->getHeight(); if (h < m_factorSize) return 0; if (m_storageType != FFTCache::Compact) { return getFromReadBufStandard(col, h - 1); @@ -108,7 +108,7 @@ (m_readbufWidth > 1 && m_readbufCol+1 == col))) { populateReadBuf(col); } - size_t ix = (col - m_readbufCol) * m_mfc->getHeight() + h; + int ix = (col - m_readbufCol) * m_mfc->getHeight() + h; factor.u[0] = ((uint16_t *)m_readbuf)[ix - 2]; factor.u[1] = ((uint16_t *)m_readbuf)[ix - 1]; return factor.f; @@ -116,7 +116,7 @@ } FFTCache::StorageType m_storageType; - size_t m_factorSize; + int m_factorSize; MatrixFile *m_mfc; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTFileCacheWriter.cpp --- a/data/fft/FFTFileCacheWriter.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTFileCacheWriter.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -33,7 +33,7 @@ FFTFileCacheWriter::FFTFileCacheWriter(QString fileBase, FFTCache::StorageType storageType, - size_t width, size_t height) : + int width, int height) : m_writebuf(0), m_fileBase(fileBase), m_storageType(storageType), @@ -62,49 +62,49 @@ return m_fileBase; } -size_t +int FFTFileCacheWriter::getWidth() const { return m_mfc->getWidth(); } -size_t +int FFTFileCacheWriter::getHeight() const { - size_t mh = m_mfc->getHeight(); + int mh = m_mfc->getHeight(); if (mh > m_factorSize) return (mh - m_factorSize) / 2; else return 0; } bool -FFTFileCacheWriter::haveSetColumnAt(size_t x) const +FFTFileCacheWriter::haveSetColumnAt(int x) const { return m_mfc->haveSetColumnAt(x); } void -FFTFileCacheWriter::setColumnAt(size_t x, float *mags, float *phases, float factor) +FFTFileCacheWriter::setColumnAt(int x, float *mags, float *phases, float factor) { - size_t h = getHeight(); + int h = getHeight(); switch (m_storageType) { case FFTCache::Compact: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { ((uint16_t *)m_writebuf)[y * 2] = uint16_t((mags[y] / factor) * 65535.0); ((uint16_t *)m_writebuf)[y * 2 + 1] = uint16_t(int16_t((phases[y] * 32767) / M_PI)); } break; case FFTCache::Rectangular: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { ((float *)m_writebuf)[y * 2] = mags[y] * cosf(phases[y]); ((float *)m_writebuf)[y * 2 + 1] = mags[y] * sinf(phases[y]); } break; case FFTCache::Polar: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { ((float *)m_writebuf)[y * 2] = mags[y]; ((float *)m_writebuf)[y * 2 + 1] = phases[y]; } @@ -123,20 +123,20 @@ } void -FFTFileCacheWriter::setColumnAt(size_t x, float *real, float *imag) +FFTFileCacheWriter::setColumnAt(int x, float *real, float *imag) { - size_t h = getHeight(); + int h = getHeight(); float factor = 0.0f; switch (m_storageType) { case FFTCache::Compact: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); if (mag > factor) factor = mag; } - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); float phase = atan2f(imag[y], real[y]); ((uint16_t *)m_writebuf)[y * 2] = uint16_t((mag / factor) * 65535.0); @@ -145,7 +145,7 @@ break; case FFTCache::Rectangular: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { ((float *)m_writebuf)[y * 2] = real[y]; ((float *)m_writebuf)[y * 2 + 1] = imag[y]; float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); @@ -154,7 +154,7 @@ break; case FFTCache::Polar: - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); if (mag > factor) factor = mag; ((float *)m_writebuf)[y * 2] = mag; @@ -175,13 +175,13 @@ m_mfc->setColumnAt(x, m_writebuf); } -size_t -FFTFileCacheWriter::getCacheSize(size_t width, size_t height, +int +FFTFileCacheWriter::getCacheSize(int width, int height, FFTCache::StorageType type) { return (height * 2 + (type == FFTCache::Compact ? 2 : 1)) * width * (type == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float)) + - 2 * sizeof(size_t); // matrix file header size + 2 * sizeof(int); // matrix file header size } void diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTFileCacheWriter.h --- a/data/fft/FFTFileCacheWriter.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTFileCacheWriter.h Tue Jun 17 14:33:42 2014 +0100 @@ -25,19 +25,19 @@ public: FFTFileCacheWriter(QString fileBase, FFTCache::StorageType storageType, - size_t width, size_t height); + int width, int height); ~FFTFileCacheWriter(); - size_t getWidth() const; - size_t getHeight() const; + int getWidth() const; + int getHeight() const; - void setColumnAt(size_t x, float *mags, float *phases, float factor); - void setColumnAt(size_t x, float *reals, float *imags); + void setColumnAt(int x, float *mags, float *phases, float factor); + void setColumnAt(int x, float *reals, float *imags); - static size_t getCacheSize(size_t width, size_t height, + static int getCacheSize(int width, int height, FFTCache::StorageType type); - bool haveSetColumnAt(size_t x) const; + bool haveSetColumnAt(int x) const; void allColumnsWritten(); @@ -48,7 +48,7 @@ char *m_writebuf; void setNormalizationFactorToWritebuf(float newfactor) { - size_t h = m_mfc->getHeight(); + int h = m_mfc->getHeight(); if (h < m_factorSize) return; if (m_storageType != FFTCache::Compact) { ((float *)m_writebuf)[h - 1] = newfactor; @@ -65,7 +65,7 @@ QString m_fileBase; FFTCache::StorageType m_storageType; - size_t m_factorSize; + int m_factorSize; MatrixFile *m_mfc; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTMemoryCache.cpp --- a/data/fft/FFTMemoryCache.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTMemoryCache.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -22,7 +22,7 @@ //#define DEBUG_FFT_MEMORY_CACHE 1 FFTMemoryCache::FFTMemoryCache(FFTCache::StorageType storageType, - size_t width, size_t height) : + int width, int height) : m_width(width), m_height(height), m_magnitude(0), @@ -48,7 +48,7 @@ cerr << "FFTMemoryCache[" << this << "]::~FFTMemoryCache" << endl; #endif - for (size_t i = 0; i < m_width; ++i) { + for (int i = 0; i < m_width; ++i) { if (m_magnitude && m_magnitude[i]) free(m_magnitude[i]); if (m_phase && m_phase[i]) free(m_phase[i]); if (m_fmagnitude && m_fmagnitude[i]) free(m_fmagnitude[i]); @@ -71,7 +71,7 @@ { Profiler profiler("FFTMemoryCache::initialise"); - size_t width = m_width, height = m_height; + int width = m_width, height = m_height; #ifdef DEBUG_FFT_MEMORY_CACHE cerr << "FFTMemoryCache[" << this << "]::initialise(" << width << "x" << height << " = " << width*height << ")" << endl; @@ -107,7 +107,7 @@ if (!array) throw std::bad_alloc(); MUNLOCK(array, m_width * sizeof(uint16_t *)); - for (size_t i = 0; i < m_width; ++i) { + for (int i = 0; i < m_width; ++i) { array[i] = (uint16_t *)malloc(m_height * sizeof(uint16_t)); if (!array[i]) throw std::bad_alloc(); MUNLOCK(array[i], m_height * sizeof(uint16_t)); @@ -121,7 +121,7 @@ if (!array) throw std::bad_alloc(); MUNLOCK(array, m_width * sizeof(float *)); - for (size_t i = 0; i < m_width; ++i) { + for (int i = 0; i < m_width; ++i) { array[i] = (float *)malloc(m_height * sizeof(float)); if (!array[i]) throw std::bad_alloc(); MUNLOCK(array[i], m_height * sizeof(float)); @@ -129,7 +129,7 @@ } void -FFTMemoryCache::setColumnAt(size_t x, float *mags, float *phases, float factor) +FFTMemoryCache::setColumnAt(int x, float *mags, float *phases, float factor) { Profiler profiler("FFTMemoryCache::setColumnAt: from polar"); @@ -137,12 +137,12 @@ if (m_storageType == FFTCache::Rectangular) { Profiler subprof("FFTMemoryCache::setColumnAt: polar to cart"); - for (size_t y = 0; y < m_height; ++y) { + for (int y = 0; y < m_height; ++y) { m_freal[x][y] = mags[y] * cosf(phases[y]); m_fimag[x][y] = mags[y] * sinf(phases[y]); } } else { - for (size_t y = 0; y < m_height; ++y) { + for (int y = 0; y < m_height; ++y) { setMagnitudeAt(x, y, mags[y]); setPhaseAt(x, y, phases[y]); } @@ -154,7 +154,7 @@ } void -FFTMemoryCache::setColumnAt(size_t x, float *reals, float *imags) +FFTMemoryCache::setColumnAt(int x, float *reals, float *imags) { Profiler profiler("FFTMemoryCache::setColumnAt: from cart"); @@ -163,7 +163,7 @@ switch (m_storageType) { case FFTCache::Rectangular: - for (size_t y = 0; y < m_height; ++y) { + for (int y = 0; y < m_height; ++y) { m_freal[x][y] = reals[y]; m_fimag[x][y] = imags[y]; float mag = sqrtf(reals[y] * reals[y] + imags[y] * imags[y]); @@ -175,7 +175,7 @@ case FFTCache::Polar: { Profiler subprof("FFTMemoryCache::setColumnAt: cart to polar"); - for (size_t y = 0; y < m_height; ++y) { + for (int y = 0; y < m_height; ++y) { float mag = sqrtf(reals[y] * reals[y] + imags[y] * imags[y]); float phase = atan2f(imags[y], reals[y]); reals[y] = mag; @@ -196,10 +196,10 @@ } } -size_t -FFTMemoryCache::getCacheSize(size_t width, size_t height, FFTCache::StorageType type) +int +FFTMemoryCache::getCacheSize(int width, int height, FFTCache::StorageType type) { - size_t sz = 0; + int sz = 0; switch (type) { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fft/FFTMemoryCache.h --- a/data/fft/FFTMemoryCache.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fft/FFTMemoryCache.h Tue Jun 17 14:33:42 2014 +0100 @@ -47,13 +47,13 @@ { public: FFTMemoryCache(FFTCache::StorageType storageType, - size_t width, size_t height); + int width, int height); ~FFTMemoryCache(); - size_t getWidth() const { return m_width; } - size_t getHeight() const { return m_height; } + int getWidth() const { return m_width; } + int getHeight() const { return m_height; } - float getMagnitudeAt(size_t x, size_t y) const { + float getMagnitudeAt(int x, int y) const { if (m_storageType == FFTCache::Rectangular) { Profiler profiler("FFTMemoryCache::getMagnitudeAt: cart to polar"); return sqrtf(m_freal[x][y] * m_freal[x][y] + @@ -63,17 +63,17 @@ } } - float getNormalizedMagnitudeAt(size_t x, size_t y) const { + float getNormalizedMagnitudeAt(int x, int y) const { if (m_storageType == FFTCache::Rectangular) return getMagnitudeAt(x, y) / m_factor[x]; else if (m_storageType == FFTCache::Polar) return m_fmagnitude[x][y]; else return float(m_magnitude[x][y]) / 65535.0; } - float getMaximumMagnitudeAt(size_t x) const { + float getMaximumMagnitudeAt(int x) const { return m_factor[x]; } - float getPhaseAt(size_t x, size_t y) const { + float getPhaseAt(int x, int y) const { if (m_storageType == FFTCache::Rectangular) { Profiler profiler("FFTMemoryCache::getValuesAt: cart to polar"); return atan2f(m_fimag[x][y], m_freal[x][y]); @@ -85,7 +85,7 @@ } } - void getValuesAt(size_t x, size_t y, float &real, float &imag) const { + void getValuesAt(int x, int y, float &real, float &imag) const { if (m_storageType == FFTCache::Rectangular) { real = m_freal[x][y]; imag = m_fimag[x][y]; @@ -98,48 +98,48 @@ } } - void getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const + void getMagnitudesAt(int x, float *values, int minbin, int count, int step) const { if (m_storageType == FFTCache::Rectangular) { - for (size_t i = 0; i < count; ++i) { - size_t y = i * step + minbin; + for (int i = 0; i < count; ++i) { + int y = i * step + minbin; values[i] = sqrtf(m_freal[x][y] * m_freal[x][y] + m_fimag[x][y] * m_fimag[x][y]); } } else if (m_storageType == FFTCache::Polar) { - for (size_t i = 0; i < count; ++i) { - size_t y = i * step + minbin; + for (int i = 0; i < count; ++i) { + int y = i * step + minbin; values[i] = m_fmagnitude[x][y] * m_factor[x]; } } else { - for (size_t i = 0; i < count; ++i) { - size_t y = i * step + minbin; + for (int i = 0; i < count; ++i) { + int y = i * step + minbin; values[i] = (float(m_magnitude[x][y]) * m_factor[x]) / 65535.0; } } } - bool haveSetColumnAt(size_t x) const { + bool haveSetColumnAt(int x) const { m_colsetLock.lockForRead(); bool have = m_colset.get(x); m_colsetLock.unlock(); return have; } - void setColumnAt(size_t x, float *mags, float *phases, float factor); + void setColumnAt(int x, float *mags, float *phases, float factor); - void setColumnAt(size_t x, float *reals, float *imags); + void setColumnAt(int x, float *reals, float *imags); void allColumnsWritten() { } - static size_t getCacheSize(size_t width, size_t height, + static int getCacheSize(int width, int height, FFTCache::StorageType type); FFTCache::StorageType getStorageType() const { return m_storageType; } private: - size_t m_width; - size_t m_height; + int m_width; + int m_height; uint16_t **m_magnitude; uint16_t **m_phase; float **m_fmagnitude; @@ -153,23 +153,23 @@ void initialise(); - void setNormalizationFactor(size_t x, float factor) { + void setNormalizationFactor(int x, float factor) { if (x < m_width) m_factor[x] = factor; } - void setMagnitudeAt(size_t x, size_t y, float mag) { + void setMagnitudeAt(int x, int y, float mag) { // norm factor must already be set setNormalizedMagnitudeAt(x, y, mag / m_factor[x]); } - void setNormalizedMagnitudeAt(size_t x, size_t y, float norm) { + void setNormalizedMagnitudeAt(int x, int y, float norm) { if (x < m_width && y < m_height) { if (m_storageType == FFTCache::Polar) m_fmagnitude[x][y] = norm; else m_magnitude[x][y] = uint16_t(norm * 65535.0); } } - void setPhaseAt(size_t x, size_t y, float phase) { + void setPhaseAt(int x, int y, float phase) { // phase in range -pi -> pi if (x < m_width && y < m_height) { if (m_storageType == FFTCache::Polar) m_fphase[x][y] = phase; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/AudioFileReader.cpp --- a/data/fileio/AudioFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/AudioFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -16,23 +16,23 @@ #include "AudioFileReader.h" void -AudioFileReader::getDeInterleavedFrames(size_t start, size_t count, +AudioFileReader::getDeInterleavedFrames(int start, int count, std::vector &frames) const { SampleBlock interleaved; getInterleavedFrames(start, count, interleaved); - size_t channels = getChannelCount(); - size_t rc = interleaved.size() / channels; + int channels = getChannelCount(); + int rc = interleaved.size() / channels; frames.clear(); - for (size_t c = 0; c < channels; ++c) { + for (int c = 0; c < channels; ++c) { frames.push_back(SampleBlock()); } - for (size_t i = 0; i < rc; ++i) { - for (size_t c = 0; c < channels; ++c) { + for (int i = 0; i < rc; ++i) { + for (int c = 0; c < channels; ++c) { frames[c].push_back(interleaved[i * channels + c]); } } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/AudioFileReader.h --- a/data/fileio/AudioFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/AudioFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -36,11 +36,11 @@ virtual QString getError() const { return ""; } - size_t getFrameCount() const { return m_frameCount; } - size_t getChannelCount() const { return m_channelCount; } - size_t getSampleRate() const { return m_sampleRate; } + int getFrameCount() const { return m_frameCount; } + int getChannelCount() const { return m_channelCount; } + int getSampleRate() const { return m_sampleRate; } - virtual size_t getNativeRate() const { return m_sampleRate; } // if resampled + virtual int getNativeRate() const { return m_sampleRate; } // if resampled /** * Return the location of the audio data in the reader (as passed @@ -81,7 +81,7 @@ * thread-safe -- that is, safe to call from multiple threads with * different arguments on the same object at the same time. */ - virtual void getInterleavedFrames(size_t start, size_t count, + virtual void getInterleavedFrames(int start, int count, SampleBlock &frames) const = 0; /** @@ -91,7 +91,7 @@ * will contain getChannelCount() sample blocks of count samples * each (or fewer if end of file is reached). */ - virtual void getDeInterleavedFrames(size_t start, size_t count, + virtual void getDeInterleavedFrames(int start, int count, std::vector &frames) const; // only subclasses that do not know exactly how long the audio @@ -104,9 +104,9 @@ void frameCountChanged(); protected: - size_t m_frameCount; - size_t m_channelCount; - size_t m_sampleRate; + int m_frameCount; + int m_channelCount; + int m_sampleRate; }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/AudioFileReaderFactory.cpp --- a/data/fileio/AudioFileReaderFactory.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/AudioFileReaderFactory.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -58,21 +58,21 @@ } AudioFileReader * -AudioFileReaderFactory::createReader(FileSource source, size_t targetRate, +AudioFileReaderFactory::createReader(FileSource source, int targetRate, ProgressReporter *reporter) { return create(source, targetRate, false, reporter); } AudioFileReader * -AudioFileReaderFactory::createThreadingReader(FileSource source, size_t targetRate, +AudioFileReaderFactory::createThreadingReader(FileSource source, int targetRate, ProgressReporter *reporter) { return create(source, targetRate, true, reporter); } AudioFileReader * -AudioFileReaderFactory::create(FileSource source, size_t targetRate, bool threading, +AudioFileReaderFactory::create(FileSource source, int targetRate, bool threading, ProgressReporter *reporter) { QString err; @@ -102,7 +102,7 @@ if (reader->isOK() && (!reader->isQuicklySeekable() || - (targetRate != 0 && fileRate != targetRate))) { + (targetRate != 0 && fileRate != (int)targetRate))) { SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", seekable " << reader->isQuicklySeekable() << ", creating decoding reader" << endl; @@ -215,7 +215,7 @@ if (reader->isOK() && (!reader->isQuicklySeekable() || - (targetRate != 0 && fileRate != targetRate))) { + (targetRate != 0 && fileRate != (int)targetRate))) { SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", seekable " << reader->isQuicklySeekable() << ", creating decoding reader" << endl; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/AudioFileReaderFactory.h --- a/data/fileio/AudioFileReaderFactory.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/AudioFileReaderFactory.h Tue Jun 17 14:33:42 2014 +0100 @@ -50,7 +50,7 @@ * Caller owns the returned object and must delete it after use. */ static AudioFileReader *createReader(FileSource source, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); /** @@ -75,12 +75,12 @@ * Caller owns the returned object and must delete it after use. */ static AudioFileReader *createThreadingReader(FileSource source, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); protected: static AudioFileReader *create(FileSource source, - size_t targetRate, + int targetRate, bool threading, ProgressReporter *reporter); }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CSVFileReader.cpp --- a/data/fileio/CSVFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CSVFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -35,7 +35,7 @@ #include CSVFileReader::CSVFileReader(QString path, CSVFormat format, - size_t mainModelSampleRate) : + int mainModelSampleRate) : m_format(format), m_file(0), m_warnings(0), @@ -81,16 +81,16 @@ return m_error; } -size_t -CSVFileReader::convertTimeValue(QString s, int lineno, size_t sampleRate, - size_t windowSize) const +int +CSVFileReader::convertTimeValue(QString s, int lineno, int sampleRate, + int windowSize) const { QRegExp nonNumericRx("[^0-9eE.,+-]"); int warnLimit = 10; CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); - size_t calculatedFrame = 0; + int calculatedFrame = 0; bool ok = false; QString numeric = s; @@ -135,8 +135,8 @@ CSVFormat::ModelType modelType = m_format.getModelType(); CSVFormat::TimingType timingType = m_format.getTimingType(); CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); - size_t sampleRate = m_format.getSampleRate(); - size_t windowSize = m_format.getWindowSize(); + int sampleRate = m_format.getSampleRate(); + int windowSize = m_format.getWindowSize(); QChar separator = m_format.getSeparator(); bool allowQuoting = m_format.getAllowQuoting(); @@ -169,15 +169,15 @@ float min = 0.0, max = 0.0; - size_t frameNo = 0; - size_t duration = 0; - size_t endFrame = 0; + int frameNo = 0; + int duration = 0; + int endFrame = 0; bool haveAnyValue = false; bool haveEndTime = false; bool pitchLooksLikeMIDI = true; - size_t startFrame = 0; // for calculation of dense model resolution + int startFrame = 0; // for calculation of dense model resolution bool firstEverValue = true; std::map labelCountMap; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CSVFileReader.h --- a/data/fileio/CSVFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CSVFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -28,7 +28,7 @@ class CSVFileReader : public DataFileReader { public: - CSVFileReader(QString path, CSVFormat format, size_t mainModelSampleRate); + CSVFileReader(QString path, CSVFormat format, int mainModelSampleRate); virtual ~CSVFileReader(); virtual bool isOK() const; @@ -40,10 +40,10 @@ QFile *m_file; QString m_error; mutable int m_warnings; - size_t m_mainModelSampleRate; + int m_mainModelSampleRate; - size_t convertTimeValue(QString, int lineno, size_t sampleRate, - size_t windowSize) const; + int convertTimeValue(QString, int lineno, int sampleRate, + int windowSize) const; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CSVFileWriter.cpp --- a/data/fileio/CSVFileWriter.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CSVFileWriter.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -95,8 +95,8 @@ selection->getSelections().begin(); i != selection->getSelections().end(); ++i) { - size_t f0(i->getStartFrame()), f1(i->getEndFrame()); - out << m_model->toDelimitedDataString(m_delimiter, f0, f1); + int f0(i->getStartFrame()), f1(i->getEndFrame()); + out << m_model->toDelimitedDataStringSubset(m_delimiter, f0, f1); } file.close(); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CSVFormat.h --- a/data/fileio/CSVFormat.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CSVFormat.h Tue Jun 17 14:33:42 2014 +0100 @@ -86,8 +86,8 @@ ModelType getModelType() const { return m_modelType; } TimingType getTimingType() const { return m_timingType; } TimeUnits getTimeUnits() const { return m_timeUnits; } - size_t getSampleRate() const { return m_sampleRate; } - size_t getWindowSize() const { return m_windowSize; } + int getSampleRate() const { return m_sampleRate; } + int getWindowSize() const { return m_windowSize; } int getColumnCount() const { return m_columnCount; } bool getAllowQuoting() const { return m_allowQuoting; } QChar getSeparator() const { @@ -99,8 +99,8 @@ void setTimingType(TimingType t) { m_timingType = t; } void setTimeUnits(TimeUnits t) { m_timeUnits = t; } void setSeparator(QChar s) { m_separator = s; } - void setSampleRate(size_t r) { m_sampleRate = r; } - void setWindowSize(size_t s) { m_windowSize = s; } + void setSampleRate(int r) { m_sampleRate = r; } + void setWindowSize(int s) { m_windowSize = s; } void setColumnCount(int c) { m_columnCount = c; } void setAllowQuoting(bool q) { m_allowQuoting = q; } @@ -123,8 +123,8 @@ TimingType m_timingType; TimeUnits m_timeUnits; QString m_separator; - size_t m_sampleRate; - size_t m_windowSize; + int m_sampleRate; + int m_windowSize; int m_columnCount; bool m_variableColumnCount; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CodedAudioFileReader.cpp --- a/data/fileio/CodedAudioFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CodedAudioFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -28,7 +28,7 @@ #include CodedAudioFileReader::CodedAudioFileReader(CacheMode cacheMode, - size_t targetRate) : + int targetRate) : m_cacheMode(cacheMode), m_initialised(false), m_serialiser(0), @@ -172,15 +172,15 @@ } void -CodedAudioFileReader::addSamplesToDecodeCache(float **samples, size_t nframes) +CodedAudioFileReader::addSamplesToDecodeCache(float **samples, int nframes) { QMutexLocker locker(&m_cacheMutex); if (!m_initialised) return; - for (size_t i = 0; i < nframes; ++i) { + for (int i = 0; i < nframes; ++i) { - for (size_t c = 0; c < m_channelCount; ++c) { + for (int c = 0; c < m_channelCount; ++c) { float sample = samples[c][i]; @@ -202,15 +202,15 @@ } void -CodedAudioFileReader::addSamplesToDecodeCache(float *samples, size_t nframes) +CodedAudioFileReader::addSamplesToDecodeCache(float *samples, int nframes) { QMutexLocker locker(&m_cacheMutex); if (!m_initialised) return; - for (size_t i = 0; i < nframes; ++i) { + for (int i = 0; i < nframes; ++i) { - for (size_t c = 0; c < m_channelCount; ++c) { + for (int c = 0; c < m_channelCount; ++c) { float sample = samples[i * m_channelCount + c]; @@ -238,7 +238,7 @@ if (!m_initialised) return; - for (size_t i = 0; i < samples.size(); ++i) { + for (int i = 0; i < (int)samples.size(); ++i) { float sample = samples[i]; @@ -293,7 +293,7 @@ } void -CodedAudioFileReader::pushBuffer(float *buffer, size_t sz, bool final) +CodedAudioFileReader::pushBuffer(float *buffer, int sz, bool final) { m_fileFrameCount += sz; @@ -310,15 +310,15 @@ } void -CodedAudioFileReader::pushBufferNonResampling(float *buffer, size_t sz) +CodedAudioFileReader::pushBufferNonResampling(float *buffer, int sz) { float max = 1.0; - size_t count = sz * m_channelCount; + int count = sz * m_channelCount; - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { if (buffer[i] > max) buffer[i] = max; } - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { if (buffer[i] < -max) buffer[i] = -max; } @@ -327,7 +327,7 @@ switch (m_cacheMode) { case CacheInTemporaryFile: - if (sf_writef_float(m_cacheFileWritePtr, buffer, sz) < sz) { + if (sf_writef_float(m_cacheFileWritePtr, buffer, sz) < (int)sz) { sf_close(m_cacheFileWritePtr); m_cacheFileWritePtr = 0; throw InsufficientDiscSpace(TempDirectory::getInstance()->getPath()); @@ -336,7 +336,7 @@ case CacheInMemory: m_dataLock.lockForWrite(); - for (size_t s = 0; s < count; ++s) { + for (int s = 0; s < count; ++s) { m_data.push_back(buffer[s]); } MUNLOCK_SAMPLEBLOCK(m_data); @@ -346,14 +346,14 @@ } void -CodedAudioFileReader::pushBufferResampling(float *buffer, size_t sz, +CodedAudioFileReader::pushBufferResampling(float *buffer, int sz, float ratio, bool final) { SVDEBUG << "pushBufferResampling: ratio = " << ratio << ", sz = " << sz << ", final = " << final << endl; if (sz > 0) { - size_t out = m_resampler->resampleInterleaved + int out = m_resampler->resampleInterleaved (buffer, m_resampleBuffer, sz, @@ -365,27 +365,27 @@ if (final) { - size_t padFrames = 1; + int padFrames = 1; if (m_frameCount / ratio < m_fileFrameCount) { padFrames = m_fileFrameCount - (m_frameCount / ratio) + 1; } - size_t padSamples = padFrames * m_channelCount; + int padSamples = padFrames * m_channelCount; SVDEBUG << "frameCount = " << m_frameCount << ", equivFileFrames = " << m_frameCount / ratio << ", m_fileFrameCount = " << m_fileFrameCount << ", padFrames= " << padFrames << ", padSamples = " << padSamples << endl; float *padding = new float[padSamples]; for (int i = 0; i < padSamples; ++i) padding[i] = 0.f; - size_t out = m_resampler->resampleInterleaved + int out = m_resampler->resampleInterleaved (padding, m_resampleBuffer, padFrames, ratio, true); - if (m_frameCount + out > int(m_fileFrameCount * ratio)) { - out = int(m_fileFrameCount * ratio) - m_frameCount; + if (int(m_frameCount + out) > int(m_fileFrameCount * ratio)) { + out = int(m_fileFrameCount * ratio) - int(m_frameCount); } pushBufferNonResampling(m_resampleBuffer, out); @@ -394,7 +394,7 @@ } void -CodedAudioFileReader::getInterleavedFrames(size_t start, size_t count, +CodedAudioFileReader::getInterleavedFrames(int start, int count, SampleBlock &frames) const { // Lock is only required in CacheInMemory mode (the cache file @@ -421,11 +421,11 @@ if (count == 0) return; frames.reserve(count * m_channelCount); - size_t idx = start * m_channelCount; - size_t i = 0; + int idx = start * m_channelCount; + int i = 0; m_dataLock.lockForRead(); - while (i < count * m_channelCount && idx < m_data.size()) { + while (i < count * m_channelCount && idx < (int)m_data.size()) { frames.push_back(m_data[idx]); ++idx; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CodedAudioFileReader.h --- a/data/fileio/CodedAudioFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CodedAudioFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -38,10 +38,10 @@ CacheInMemory }; - virtual void getInterleavedFrames(size_t start, size_t count, + virtual void getInterleavedFrames(int start, int count, SampleBlock &frames) const; - virtual size_t getNativeRate() const { return m_fileRate; } + virtual int getNativeRate() const { return m_fileRate; } /// Intermediate cache means all CodedAudioFileReaders are quickly seekable virtual bool isQuicklySeekable() const { return true; } @@ -50,13 +50,13 @@ void progress(int); protected: - CodedAudioFileReader(CacheMode cacheMode, size_t targetRate); + CodedAudioFileReader(CacheMode cacheMode, int targetRate); void initialiseDecodeCache(); // samplerate, channels must have been set // may throw InsufficientDiscSpace: - void addSamplesToDecodeCache(float **samples, size_t nframes); - void addSamplesToDecodeCache(float *samplesInterleaved, size_t nframes); + void addSamplesToDecodeCache(float **samples, int nframes); + void addSamplesToDecodeCache(float *samplesInterleaved, int nframes); void addSamplesToDecodeCache(const SampleBlock &interleaved); // may throw InsufficientDiscSpace: @@ -68,9 +68,9 @@ void endSerialised(); private: - void pushBuffer(float *interleaved, size_t sz, bool final); - void pushBufferResampling(float *interleaved, size_t sz, float ratio, bool final); - void pushBufferNonResampling(float *interleaved, size_t sz); + void pushBuffer(float *interleaved, int sz, bool final); + void pushBufferResampling(float *interleaved, int sz, float ratio, bool final); + void pushBufferNonResampling(float *interleaved, int sz); protected: QMutex m_cacheMutex; @@ -79,18 +79,18 @@ mutable QReadWriteLock m_dataLock; bool m_initialised; Serialiser *m_serialiser; - size_t m_fileRate; + int m_fileRate; QString m_cacheFileName; SNDFILE *m_cacheFileWritePtr; WavFileReader *m_cacheFileReader; float *m_cacheWriteBuffer; - size_t m_cacheWriteBufferIndex; - size_t m_cacheWriteBufferSize; // frames + int m_cacheWriteBufferIndex; + int m_cacheWriteBufferSize; // frames Resampler *m_resampler; float *m_resampleBuffer; - size_t m_fileFrameCount; + int m_fileFrameCount; }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CoreAudioFileReader.cpp --- a/data/fileio/CoreAudioFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CoreAudioFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -59,7 +59,7 @@ CoreAudioFileReader::CoreAudioFileReader(FileSource source, DecodeMode decodeMode, CacheMode mode, - size_t targetRate, + int targetRate, ProgressReporter *reporter) : CodedAudioFileReader(mode, targetRate), m_source(source), diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/CoreAudioFileReader.h --- a/data/fileio/CoreAudioFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/CoreAudioFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -39,7 +39,7 @@ CoreAudioFileReader(FileSource source, DecodeMode decodeMode, CacheMode cacheMode, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); virtual ~CoreAudioFileReader(); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/DataFileReaderFactory.cpp --- a/data/fileio/DataFileReaderFactory.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/DataFileReaderFactory.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -32,7 +32,7 @@ bool csv, MIDIFileImportPreferenceAcquirer *acquirer, CSVFormat format, - size_t mainModelSampleRate) + int mainModelSampleRate) { QString err; @@ -58,7 +58,7 @@ DataFileReader * DataFileReaderFactory::createReader(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate) + int mainModelSampleRate) { DataFileReader *reader = createReader (path, false, acquirer, CSVFormat(), mainModelSampleRate); @@ -74,7 +74,7 @@ Model * DataFileReaderFactory::load(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate) + int mainModelSampleRate) { DataFileReader *reader = createReader(path, acquirer, @@ -94,7 +94,7 @@ Model * DataFileReaderFactory::loadNonCSV(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate) + int mainModelSampleRate) { DataFileReader *reader = createReader(path, false, acquirer, @@ -114,7 +114,7 @@ Model * DataFileReaderFactory::loadCSV(QString path, CSVFormat format, - size_t mainModelSampleRate) + int mainModelSampleRate) { DataFileReader *reader = createReader(path, true, 0, format, mainModelSampleRate); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/DataFileReaderFactory.h --- a/data/fileio/DataFileReaderFactory.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/DataFileReaderFactory.h Tue Jun 17 14:33:42 2014 +0100 @@ -48,7 +48,7 @@ */ static DataFileReader *createReader(QString path, MIDIFileImportPreferenceAcquirer *, - size_t mainModelSampleRate); + int mainModelSampleRate); /** * Read the given path, if a suitable reader is available. @@ -60,7 +60,7 @@ */ static Model *load(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate); + int mainModelSampleRate); /** * Read the given path, if a suitable reader is available. @@ -69,7 +69,7 @@ */ static Model *loadNonCSV(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate); + int mainModelSampleRate); /** * Read the given path using the CSV reader with the given format. @@ -77,13 +77,13 @@ */ static Model *loadCSV(QString path, CSVFormat format, - size_t mainModelSampleRate); + int mainModelSampleRate); protected: static DataFileReader *createReader(QString path, bool csv, MIDIFileImportPreferenceAcquirer *, CSVFormat format, - size_t mainModelSampleRate); + int mainModelSampleRate); }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/DecodingWavFileReader.cpp --- a/data/fileio/DecodingWavFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/DecodingWavFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -24,7 +24,7 @@ DecodingWavFileReader::DecodingWavFileReader(FileSource source, ResampleMode resampleMode, CacheMode mode, - size_t targetRate, + int targetRate, ProgressReporter *reporter) : CodedAudioFileReader(mode, targetRate), m_source(source), @@ -63,14 +63,14 @@ (tr("Decoding %1...").arg(QFileInfo(m_path).fileName())); } - size_t blockSize = 16384; - size_t total = m_original->getFrameCount(); + int blockSize = 16384; + int total = m_original->getFrameCount(); SampleBlock block; - for (size_t i = 0; i < total; i += blockSize) { + for (int i = 0; i < total; i += blockSize) { - size_t count = blockSize; + int count = blockSize; if (i + count > total) count = total - i; m_original->getInterleavedFrames(i, count, block); @@ -120,14 +120,14 @@ m_reader->startSerialised("DecodingWavFileReader::Decode"); } - size_t blockSize = 16384; - size_t total = m_reader->m_original->getFrameCount(); + int blockSize = 16384; + int total = m_reader->m_original->getFrameCount(); SampleBlock block; - for (size_t i = 0; i < total; i += blockSize) { + for (int i = 0; i < total; i += blockSize) { - size_t count = blockSize; + int count = blockSize; if (i + count > total) count = total - i; m_reader->m_original->getInterleavedFrames(i, count, block); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/DecodingWavFileReader.h --- a/data/fileio/DecodingWavFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/DecodingWavFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -37,7 +37,7 @@ DecodingWavFileReader(FileSource source, ResampleMode resampleMode, CacheMode cacheMode, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); virtual ~DecodingWavFileReader(); @@ -62,7 +62,7 @@ QString m_path; QString m_error; bool m_cancelled; - size_t m_processed; + int m_processed; int m_completion; WavFileReader *m_original; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/FFTFuzzyAdapter.cpp --- a/data/fileio/FFTFuzzyAdapter.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/FFTFuzzyAdapter.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -20,11 +20,11 @@ FFTFuzzyAdapter::FFTFuzzyAdapter(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, - size_t fillFromColumn) : + int fillFromColumn) : m_server(0), m_xshift(0), m_yshift(0) @@ -38,8 +38,8 @@ polar, fillFromColumn); - size_t xratio = windowIncrement / m_server->getWindowIncrement(); - size_t yratio = m_server->getFFTSize() / fftSize; + int xratio = windowIncrement / m_server->getWindowIncrement(); + int yratio = m_server->getFFTSize() / fftSize; while (xratio > 1) { if (xratio & 0x1) { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/FFTFuzzyAdapter.h --- a/data/fileio/FFTFuzzyAdapter.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/FFTFuzzyAdapter.h Tue Jun 17 14:33:42 2014 +0100 @@ -24,49 +24,49 @@ FFTFuzzyAdapter(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, - size_t fillFromColumn = 0); + int fillFromColumn = 0); ~FFTFuzzyAdapter(); - size_t getWidth() const { + int getWidth() const { return m_server->getWidth() >> m_xshift; } - size_t getHeight() const { + int getHeight() const { return m_server->getHeight() >> m_yshift; } - float getMagnitudeAt(size_t x, size_t y) { + float getMagnitudeAt(int x, int y) { return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift); } - float getNormalizedMagnitudeAt(size_t x, size_t y) { + float getNormalizedMagnitudeAt(int x, int y) { return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift); } - float getMaximumMagnitudeAt(size_t x) { + float getMaximumMagnitudeAt(int x) { return m_server->getMaximumMagnitudeAt(x << m_xshift); } - float getPhaseAt(size_t x, size_t y) { + float getPhaseAt(int x, int y) { return m_server->getPhaseAt(x << m_xshift, y << m_yshift); } - void getValuesAt(size_t x, size_t y, float &real, float &imaginary) { + void getValuesAt(int x, int y, float &real, float &imaginary) { m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary); } - bool isColumnReady(size_t x) { + bool isColumnReady(int x) { return m_server->isColumnReady(x << m_xshift); } - bool isLocalPeak(size_t x, size_t y) { + bool isLocalPeak(int x, int y) { float mag = getMagnitudeAt(x, y); if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; if (y < getHeight() - 1 && mag < getMagnitudeAt(x, y + 1)) return false; return true; } - bool isOverThreshold(size_t x, size_t y, float threshold) { + bool isOverThreshold(int x, int y, float threshold) { return getMagnitudeAt(x, y) > threshold; } - size_t getFillCompletion() const { return m_server->getFillCompletion(); } - size_t getFillExtent() const { return m_server->getFillExtent(); } + int getFillCompletion() const { return m_server->getFillCompletion(); } + int getFillExtent() const { return m_server->getFillExtent(); } private: FFTFuzzyAdapter(const FFTFuzzyAdapter &); // not implemented diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MIDIFileReader.cpp --- a/data/fileio/MIDIFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MIDIFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -57,7 +57,7 @@ MIDIFileReader::MIDIFileReader(QString path, MIDIFileImportPreferenceAcquirer *acquirer, - size_t mainModelSampleRate) : + int mainModelSampleRate) : m_smpte(false), m_timingDivision(0), m_fps(0), @@ -896,7 +896,7 @@ if (tracksToLoad.empty()) return 0; - size_t n = tracksToLoad.size(), count = 0; + int n = tracksToLoad.size(), count = 0; Model *model = 0; for (std::set::iterator i = tracksToLoad.begin(); @@ -943,10 +943,9 @@ const MIDITrack &track = m_midiComposition.find(trackToLoad)->second; - size_t totalEvents = track.size(); - size_t count = 0; + int totalEvents = track.size(); + int count = 0; - bool minorKey = false; bool sharpKey = true; for (MIDITrack::const_iterator i = track.begin(); i != track.end(); ++i) { @@ -968,7 +967,7 @@ switch((*i)->getMetaEventCode()) { case MIDI_KEY_SIGNATURE: - minorKey = (int((*i)->getMetaMessage()[1]) != 0); + // minorKey = (int((*i)->getMetaMessage()[1]) != 0); sharpKey = (int((*i)->getMetaMessage()[0]) >= 0); break; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MIDIFileReader.h --- a/data/fileio/MIDIFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MIDIFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -62,7 +62,7 @@ public: MIDIFileReader(QString path, MIDIFileImportPreferenceAcquirer *pref, - size_t mainModelSampleRate); + int mainModelSampleRate); virtual ~MIDIFileReader(); virtual bool isOK() const; @@ -126,9 +126,9 @@ QString m_path; std::ifstream *m_midiFile; - size_t m_fileSize; + int m_fileSize; QString m_error; - size_t m_mainModelSampleRate; + int m_mainModelSampleRate; MIDIFileImportPreferenceAcquirer *m_acquirer; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MIDIFileWriter.cpp --- a/data/fileio/MIDIFileWriter.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MIDIFileWriter.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -344,8 +344,8 @@ for (NoteList::const_iterator i = notes.begin(); i != notes.end(); ++i) { - size_t frame = i->start; - size_t duration = i->duration; + int frame = i->start; + int duration = i->duration; int pitch = i->midiPitch; int velocity = i->velocity; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MP3FileReader.cpp --- a/data/fileio/MP3FileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MP3FileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -37,7 +37,7 @@ #include MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, - CacheMode mode, size_t targetRate, + CacheMode mode, int targetRate, ProgressReporter *reporter) : CodedAudioFileReader(mode, targetRate), m_source(source), @@ -85,7 +85,7 @@ } ssize_t sz = 0; - size_t offset = 0; + int offset = 0; while (offset < m_fileSize) { sz = ::read(fd, m_filebuffer + offset, m_fileSize - offset); if (sz < 0) { @@ -274,7 +274,7 @@ m_reader->m_filebuffer = 0; if (m_reader->m_samplebuffer) { - for (size_t c = 0; c < m_reader->m_channelCount; ++c) { + for (int c = 0; c < m_reader->m_channelCount; ++c) { delete[] m_reader->m_samplebuffer[c]; } delete[] m_reader->m_samplebuffer; @@ -290,7 +290,7 @@ } bool -MP3FileReader::decode(void *mm, size_t sz) +MP3FileReader::decode(void *mm, int sz) { DecoderData data; struct mad_decoder decoder; @@ -391,7 +391,7 @@ initialiseDecodeCache(); } - if (m_samplebuffersize < frames) { + if (int(m_samplebuffersize) < frames) { if (!m_samplebuffer) { m_samplebuffer = new float *[channels]; for (int c = 0; c < channels; ++c) { @@ -427,11 +427,11 @@ } enum mad_flow -MP3FileReader::error(void *dp, - struct mad_stream *stream, +MP3FileReader::error(void * /* dp */, + struct mad_stream * /* stream */, struct mad_frame *) { - DecoderData *data = (DecoderData *)dp; +// DecoderData *data = (DecoderData *)dp; // fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %lu\n", // stream->error, mad_stream_errorstr(stream), diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MP3FileReader.h --- a/data/fileio/MP3FileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MP3FileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -40,7 +40,7 @@ MP3FileReader(FileSource source, DecodeMode decodeMode, CacheMode cacheMode, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); virtual ~MP3FileReader(); @@ -72,15 +72,15 @@ QString m_title; QString m_maker; TagMap m_tags; - size_t m_fileSize; + int m_fileSize; double m_bitrateNum; - size_t m_bitrateDenom; + int m_bitrateDenom; int m_completion; bool m_done; unsigned char *m_filebuffer; float **m_samplebuffer; - size_t m_samplebuffersize; + int m_samplebuffersize; ProgressReporter *m_reporter; bool m_cancelled; @@ -92,7 +92,7 @@ MP3FileReader *reader; }; - bool decode(void *mm, size_t sz); + bool decode(void *mm, int sz); enum mad_flow accept(struct mad_header const *, struct mad_pcm *); static enum mad_flow input(void *, struct mad_stream *); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MatchFileReader.cpp --- a/data/fileio/MatchFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MatchFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -163,8 +163,11 @@ break; } - if (state < 3) ++state; - else if (state == 3 && alignment.thisIndex.size() == count) ++state; + if (state < 3) { + ++state; + } else if (state == 3 && int(alignment.thisIndex.size()) == count) { + ++state; + } } if (alignment.thisHopTime == 0.0) { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MatrixFile.cpp --- a/data/fileio/MatrixFile.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MatrixFile.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -52,7 +52,7 @@ static size_t openCount = 0; MatrixFile::MatrixFile(QString fileBase, Mode mode, - size_t cellSize, size_t width, size_t height) : + int cellSize, int width, int height) : m_fd(-1), m_mode(mode), m_flags(0), @@ -60,7 +60,7 @@ m_cellSize(cellSize), m_width(width), m_height(height), - m_headerSize(2 * sizeof(size_t)), + m_headerSize(2 * sizeof(int)), m_setColumns(0), m_autoClose(false), m_readyToReadColumn(-1) @@ -125,8 +125,8 @@ if (newFile) { initialise(); // write header and "unwritten" column tags } else { - size_t header[2]; - if (::read(m_fd, header, 2 * sizeof(size_t)) < 0) { + int header[2]; + if (::read(m_fd, header, 2 * sizeof(int)) < 0) { ::perror("MatrixFile::MatrixFile: read failed"); cerr << "ERROR: MatrixFile::MatrixFile: " << "Failed to read header (fd " << m_fd << ", file \"" @@ -222,10 +222,10 @@ throw FileOperationFailed(m_fileName, "lseek"); } - size_t header[2]; + int header[2]; header[0] = m_width; header[1] = m_height; - if (::write(m_fd, header, 2 * sizeof(size_t)) != 2 * sizeof(size_t)) { + if (::write(m_fd, header, 2 * sizeof(int)) != 2 * sizeof(int)) { ::perror("ERROR: MatrixFile::initialise: Failed to write header"); throw FileOperationFailed(m_fileName, "write"); } @@ -263,7 +263,7 @@ } void -MatrixFile::getColumnAt(size_t x, void *data) +MatrixFile::getColumnAt(int x, void *data) { assert(m_mode == ReadOnly); @@ -276,7 +276,7 @@ ssize_t r = -1; if (m_readyToReadColumn < 0 || - size_t(m_readyToReadColumn) != x) { + m_readyToReadColumn != x) { unsigned char set = 0; if (!seekTo(x)) { @@ -303,14 +303,14 @@ } bool -MatrixFile::haveSetColumnAt(size_t x) const +MatrixFile::haveSetColumnAt(int x) const { if (m_mode == WriteOnly) { return m_setColumns->get(x); } if (m_readyToReadColumn >= 0 && - size_t(m_readyToReadColumn) == x) return true; + int(m_readyToReadColumn) == x) return true; Profiler profiler("MatrixFile::haveSetColumnAt"); @@ -338,7 +338,7 @@ } void -MatrixFile::setColumnAt(size_t x, const void *data) +MatrixFile::setColumnAt(int x, const void *data) { assert(m_mode == WriteOnly); if (m_fd < 0) return; // closed @@ -408,7 +408,7 @@ } bool -MatrixFile::seekTo(size_t x) const +MatrixFile::seekTo(int x) const { if (m_fd < 0) { cerr << "ERROR: MatrixFile::seekTo: File not open" << endl; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/MatrixFile.h --- a/data/fileio/MatrixFile.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/MatrixFile.h Tue Jun 17 14:33:42 2014 +0100 @@ -58,15 +58,15 @@ * MatrixFile has no built-in cache and is not thread-safe. Use a * separate MatrixFile in each thread. */ - MatrixFile(QString fileBase, Mode mode, size_t cellSize, - size_t width, size_t height); + MatrixFile(QString fileBase, Mode mode, int cellSize, + int width, int height); virtual ~MatrixFile(); Mode getMode() const { return m_mode; } - size_t getWidth() const { return m_width; } - size_t getHeight() const { return m_height; } - size_t getCellSize() const { return m_cellSize; } + int getWidth() const { return m_width; } + int getHeight() const { return m_height; } + int getCellSize() const { return m_cellSize; } /** * If this is set true on a write-mode MatrixFile, then the file @@ -76,19 +76,19 @@ void close(); // does not decrement ref count; that happens in dtor - bool haveSetColumnAt(size_t x) const; - void getColumnAt(size_t x, void *data); // may throw FileReadFailed - void setColumnAt(size_t x, const void *data); + bool haveSetColumnAt(int x) const; + void getColumnAt(int x, void *data); // may throw FileReadFailed + void setColumnAt(int x, const void *data); protected: int m_fd; Mode m_mode; int m_flags; mode_t m_fmode; - size_t m_cellSize; - size_t m_width; - size_t m_height; - size_t m_headerSize; + int m_cellSize; + int m_width; + int m_height; + int m_headerSize; QString m_fileName; ResizeableBitset *m_setColumns; // only in writer @@ -102,7 +102,7 @@ static QMutex m_createMutex; void initialise(); - bool seekTo(size_t x) const; + bool seekTo(int col) const; }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/OggVorbisFileReader.cpp --- a/data/fileio/OggVorbisFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/OggVorbisFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -34,7 +34,7 @@ OggVorbisFileReader::OggVorbisFileReader(FileSource source, DecodeMode decodeMode, CacheMode mode, - size_t targetRate, + int targetRate, ProgressReporter *reporter) : CodedAudioFileReader(mode, targetRate), m_source(source), diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/OggVorbisFileReader.h --- a/data/fileio/OggVorbisFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/OggVorbisFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -42,7 +42,7 @@ OggVorbisFileReader(FileSource source, DecodeMode decodeMode, CacheMode cacheMode, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); virtual ~OggVorbisFileReader(); @@ -78,8 +78,8 @@ OGGZ *m_oggz; FishSound *m_fishSound; ProgressReporter *m_reporter; - size_t m_fileSize; - size_t m_bytesRead; + int m_fileSize; + int m_bytesRead; bool m_commentsRead; bool m_cancelled; int m_completion; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/QuickTimeFileReader.cpp --- a/data/fileio/QuickTimeFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/QuickTimeFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -43,14 +43,14 @@ OSErr err; AudioStreamBasicDescription asbd; Movie movie; - size_t blockSize; + int blockSize; }; QuickTimeFileReader::QuickTimeFileReader(FileSource source, DecodeMode decodeMode, CacheMode mode, - size_t targetRate, + int targetRate, ProgressReporter *reporter) : CodedAudioFileReader(mode, targetRate), m_source(source), diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/QuickTimeFileReader.h --- a/data/fileio/QuickTimeFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/QuickTimeFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -42,7 +42,7 @@ QuickTimeFileReader(FileSource source, DecodeMode decodeMode, CacheMode cacheMode, - size_t targetRate = 0, + int targetRate = 0, ProgressReporter *reporter = 0); virtual ~QuickTimeFileReader(); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/WavFileReader.cpp --- a/data/fileio/WavFileReader.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/WavFileReader.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -89,7 +89,7 @@ { QMutexLocker locker(&m_mutex); - size_t prevCount = m_fileInfo.frames; + int prevCount = m_fileInfo.frames; if (m_file) { sf_close(m_file); @@ -123,7 +123,7 @@ } void -WavFileReader::getInterleavedFrames(size_t start, size_t count, +WavFileReader::getInterleavedFrames(int start, int count, SampleBlock &results) const { if (count == 0) return; @@ -173,7 +173,7 @@ m_lastCount = readCount; } - for (size_t i = 0; i < count * m_fileInfo.channels; ++i) { + for (int i = 0; i < count * m_fileInfo.channels; ++i) { if (i >= m_bufsiz) { cerr << "INTERNAL ERROR: WavFileReader::getInterleavedFrames: " << i << " >= " << m_bufsiz << endl; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/WavFileReader.h --- a/data/fileio/WavFileReader.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/WavFileReader.h Tue Jun 17 14:33:42 2014 +0100 @@ -48,7 +48,7 @@ * Must be safe to call from multiple threads with different * arguments on the same object at the same time. */ - virtual void getInterleavedFrames(size_t start, size_t count, + virtual void getInterleavedFrames(int start, int count, SampleBlock &frames) const; static void getSupportedExtensions(std::set &extensions); @@ -75,9 +75,9 @@ mutable QMutex m_mutex; mutable float *m_buffer; - mutable size_t m_bufsiz; - mutable size_t m_lastStart; - mutable size_t m_lastCount; + mutable int m_bufsiz; + mutable int m_lastStart; + mutable int m_lastCount; bool m_updating; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/WavFileWriter.cpp --- a/data/fileio/WavFileWriter.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/WavFileWriter.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -25,8 +25,8 @@ #include WavFileWriter::WavFileWriter(QString path, - size_t sampleRate, - size_t channels, + int sampleRate, + int channels, FileWriteMode mode) : m_path(path), m_sampleRate(sampleRate), @@ -120,7 +120,7 @@ ownSelection = true; } - size_t bs = 2048; + int bs = 2048; float *ub = new float[bs]; // uninterleaved buffer (one channel) float *ib = new float[bs * m_channels]; // interleaved buffer @@ -128,15 +128,15 @@ selection->getSelections().begin(); i != selection->getSelections().end(); ++i) { - size_t f0(i->getStartFrame()), f1(i->getEndFrame()); + int f0(i->getStartFrame()), f1(i->getEndFrame()); - for (size_t f = f0; f < f1; f += bs) { + for (int f = f0; f < f1; f += bs) { - size_t n = std::min(bs, f1 - f); + int n = std::min(bs, f1 - f); for (int c = 0; c < int(m_channels); ++c) { source->getData(c, f, n, ub); - for (size_t i = 0; i < n; ++i) { + for (int i = 0; i < n; ++i) { ib[i * m_channels + c] = ub[i]; } } @@ -159,7 +159,7 @@ } bool -WavFileWriter::writeSamples(float **samples, size_t count) +WavFileWriter::writeSamples(float **samples, int count) { if (!m_file) { m_error = QString("Failed to write model to audio file '%1': File not open") @@ -168,8 +168,8 @@ } float *b = new float[count * m_channels]; - for (size_t i = 0; i < count; ++i) { - for (size_t c = 0; c < m_channels; ++c) { + for (int i = 0; i < int(count); ++i) { + for (int c = 0; c < int(m_channels); ++c) { b[i * m_channels + c] = samples[c][i]; } } @@ -178,7 +178,7 @@ delete[] b; - if (written < count) { + if (written < int(count)) { m_error = QString("Only wrote %1 of %2 frames") .arg(written).arg(count); } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/fileio/WavFileWriter.h --- a/data/fileio/WavFileWriter.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/fileio/WavFileWriter.h Tue Jun 17 14:33:42 2014 +0100 @@ -44,7 +44,7 @@ WriteToTarget }; - WavFileWriter(QString path, size_t sampleRate, size_t channels, + WavFileWriter(QString path, int sampleRate, int channels, FileWriteMode mode); virtual ~WavFileWriter(); @@ -57,14 +57,14 @@ bool writeModel(DenseTimeValueModel *source, MultiSelection *selection = 0); - bool writeSamples(float **samples, size_t count); // count per channel + bool writeSamples(float **samples, int count); // count per channel bool close(); protected: QString m_path; - size_t m_sampleRate; - size_t m_channels; + int m_sampleRate; + int m_channels; TempWriteFile *m_temp; SNDFILE *m_file; QString m_error; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/midi/MIDIInput.h --- a/data/midi/MIDIInput.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/midi/MIDIInput.h Tue Jun 17 14:33:42 2014 +0100 @@ -36,7 +36,7 @@ bool isOK() const { return m_rtmidi != 0; } bool isEmpty() const { return getEventsAvailable() == 0; } - size_t getEventsAvailable() const { return m_buffer.getReadSpace(); } + int getEventsAvailable() const { return m_buffer.getReadSpace(); } MIDIEvent readEvent(); signals: diff -r 6a94bb528e9d -r 59e7fe1b1003 data/midi/rtmidi/RtMidi.cpp --- a/data/midi/rtmidi/RtMidi.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/midi/rtmidi/RtMidi.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -2263,5 +2263,5 @@ { } -#endif __RTMIDI_DUMMY_ONLY__ +#endif /* __RTMIDI_DUMMY_ONLY__ */ diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/AggregateWaveModel.cpp --- a/data/model/AggregateWaveModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/AggregateWaveModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -65,27 +65,27 @@ return ready; } -size_t +int AggregateWaveModel::getFrameCount() const { - size_t count = 0; + int count = 0; for (ChannelSpecList::const_iterator i = m_components.begin(); i != m_components.end(); ++i) { - size_t thisCount = i->model->getEndFrame() - i->model->getStartFrame(); + int thisCount = i->model->getEndFrame() - i->model->getStartFrame(); if (thisCount > count) count = thisCount; } return count; } -size_t +int AggregateWaveModel::getChannelCount() const { return m_components.size(); } -size_t +int AggregateWaveModel::getSampleRate() const { if (m_components.empty()) return 0; @@ -98,8 +98,8 @@ return new AggregateWaveModel(m_components); } -size_t -AggregateWaveModel::getData(int channel, size_t start, size_t count, +int +AggregateWaveModel::getData(int channel, int start, int count, float *buffer) const { int ch0 = channel, ch1 = channel; @@ -113,21 +113,21 @@ float *readbuf = buffer; if (mixing) { readbuf = new float[count]; - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { buffer[i] = 0.f; } } - size_t sz = count; + int sz = count; for (int c = ch0; c <= ch1; ++c) { - size_t szHere = + int szHere = m_components[c].model->getData(m_components[c].channel, start, count, readbuf); if (szHere < sz) sz = szHere; if (mixing) { - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { buffer[i] += readbuf[i]; } } @@ -137,8 +137,8 @@ return sz; } -size_t -AggregateWaveModel::getData(int channel, size_t start, size_t count, +int +AggregateWaveModel::getData(int channel, int start, int count, double *buffer) const { int ch0 = channel, ch1 = channel; @@ -152,21 +152,21 @@ double *readbuf = buffer; if (mixing) { readbuf = new double[count]; - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { buffer[i] = 0.0; } } - size_t sz = count; + int sz = count; for (int c = ch0; c <= ch1; ++c) { - size_t szHere = + int szHere = m_components[c].model->getData(m_components[c].channel, start, count, readbuf); if (szHere < sz) sz = szHere; if (mixing) { - for (size_t i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { buffer[i] += readbuf[i]; } } @@ -176,50 +176,50 @@ return sz; } -size_t -AggregateWaveModel::getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, +int +AggregateWaveModel::getData(int fromchannel, int tochannel, + int start, int count, float **buffer) const { - size_t min = count; + int min = count; - for (size_t c = fromchannel; c <= tochannel; ++c) { - size_t here = getData(c, start, count, buffer[c - fromchannel]); + for (int c = fromchannel; c <= tochannel; ++c) { + int here = getData(c, start, count, buffer[c - fromchannel]); if (here < min) min = here; } return min; } -size_t -AggregateWaveModel::getSummaryBlockSize(size_t desired) const +int +AggregateWaveModel::getSummaryBlockSize(int desired) const { //!!! complete return desired; } void -AggregateWaveModel::getSummaries(size_t channel, size_t start, size_t count, - RangeBlock &ranges, size_t &blockSize) const +AggregateWaveModel::getSummaries(int, int, int, + RangeBlock &, int &) const { //!!! complete } AggregateWaveModel::Range -AggregateWaveModel::getSummary(size_t channel, size_t start, size_t count) const +AggregateWaveModel::getSummary(int, int, int) const { //!!! complete return Range(); } -size_t +int AggregateWaveModel::getComponentCount() const { return m_components.size(); } AggregateWaveModel::ModelChannelSpec -AggregateWaveModel::getComponent(size_t c) const +AggregateWaveModel::getComponent(int c) const { return m_components[c]; } @@ -231,7 +231,7 @@ } void -AggregateWaveModel::componentModelChanged(size_t start, size_t end) +AggregateWaveModel::componentModelChanged(int start, int end) { emit modelChanged(start, end); } @@ -243,9 +243,9 @@ } void -AggregateWaveModel::toXml(QTextStream &out, - QString indent, - QString extraAttributes) const +AggregateWaveModel::toXml(QTextStream &, + QString , + QString ) const { //!!! complete } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/AggregateWaveModel.h --- a/data/model/AggregateWaveModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/AggregateWaveModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -44,40 +44,40 @@ QString getTypeName() const { return tr("Aggregate Wave"); } - size_t getComponentCount() const; - ModelChannelSpec getComponent(size_t c) const; + int getComponentCount() const; + ModelChannelSpec getComponent(int c) const; const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; } - size_t getFrameCount() const; - size_t getChannelCount() const; - size_t getSampleRate() const; + int getFrameCount() const; + int getChannelCount() const; + int getSampleRate() const; virtual Model *clone() const; float getValueMinimum() const { return -1.0f; } float getValueMaximum() const { return 1.0f; } - virtual size_t getStartFrame() const { return 0; } - virtual size_t getEndFrame() const { return getFrameCount(); } + virtual int getStartFrame() const { return 0; } + virtual int getEndFrame() const { return getFrameCount(); } - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, float *buffer) const; - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, double *buffer) const; - virtual size_t getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, + virtual int getData(int fromchannel, int tochannel, + int start, int count, float **buffer) const; - virtual size_t getSummaryBlockSize(size_t desired) const; + virtual int getSummaryBlockSize(int desired) const; - virtual void getSummaries(size_t channel, size_t start, size_t count, + virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, - size_t &blockSize) const; + int &blockSize) const; - virtual Range getSummary(size_t channel, size_t start, size_t count) const; + virtual Range getSummary(int channel, int start, int count) const; virtual void toXml(QTextStream &out, QString indent = "", @@ -85,12 +85,12 @@ signals: void modelChanged(); - void modelChanged(size_t, size_t); + void modelChanged(int, int); void completionChanged(); protected slots: void componentModelChanged(); - void componentModelChanged(size_t, size_t); + void componentModelChanged(int, int); void componentModelCompletionChanged(); protected: diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/AlignmentModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -37,8 +37,8 @@ connect(m_rawPath, SIGNAL(modelChanged()), this, SLOT(pathChanged())); - connect(m_rawPath, SIGNAL(modelChanged(size_t, size_t)), - this, SLOT(pathChanged(size_t, size_t))); + connect(m_rawPath, SIGNAL(modelChanged(int, int)), + this, SLOT(pathChanged(int, int))); connect(m_rawPath, SIGNAL(completionChanged()), this, SLOT(pathCompletionChanged())); @@ -74,23 +74,23 @@ else return true; } -size_t +int AlignmentModel::getStartFrame() const { - size_t a = m_reference->getStartFrame(); - size_t b = m_aligned->getStartFrame(); + int a = m_reference->getStartFrame(); + int b = m_aligned->getStartFrame(); return std::min(a, b); } -size_t +int AlignmentModel::getEndFrame() const { - size_t a = m_reference->getEndFrame(); - size_t b = m_aligned->getEndFrame(); + int a = m_reference->getEndFrame(); + int b = m_aligned->getEndFrame(); return std::max(a, b); } -size_t +int AlignmentModel::getSampleRate() const { return m_reference->getSampleRate(); @@ -137,8 +137,8 @@ return m_aligned; } -size_t -AlignmentModel::toReference(size_t frame) const +int +AlignmentModel::toReference(int frame) const { #ifdef DEBUG_ALIGNMENT_MODEL SVDEBUG << "AlignmentModel::toReference(" << frame << ")" << endl; @@ -150,8 +150,8 @@ return align(m_path, frame); } -size_t -AlignmentModel::fromReference(size_t frame) const +int +AlignmentModel::fromReference(int frame) const { #ifdef DEBUG_ALIGNMENT_MODEL SVDEBUG << "AlignmentModel::fromReference(" << frame << ")" << endl; @@ -175,7 +175,7 @@ } void -AlignmentModel::pathChanged(size_t, size_t) +AlignmentModel::pathChanged(int, int) { if (!m_pathComplete) return; constructPath(); @@ -277,8 +277,8 @@ #endif } -size_t -AlignmentModel::align(PathModel *path, size_t frame) const +int +AlignmentModel::align(PathModel *path, int frame) const { if (!path) return frame; @@ -330,7 +330,7 @@ if (foundMapFrame < 0) return 0; - size_t resultFrame = foundMapFrame; + int resultFrame = foundMapFrame; if (followingFrame != foundFrame && long(frame) > foundFrame) { float interp = diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/AlignmentModel.h --- a/data/model/AlignmentModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/AlignmentModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -37,9 +37,9 @@ ~AlignmentModel(); virtual bool isOK() const; - virtual size_t getStartFrame() const; - virtual size_t getEndFrame() const; - virtual size_t getSampleRate() const; + virtual int getStartFrame() const; + virtual int getEndFrame() const; + virtual int getSampleRate() const; virtual Model *clone() const; virtual bool isReady(int *completion = 0) const; virtual const ZoomConstraint *getZoomConstraint() const; @@ -49,8 +49,8 @@ const Model *getReferenceModel() const; const Model *getAlignedModel() const; - size_t toReference(size_t frame) const; - size_t fromReference(size_t frame) const; + int toReference(int frame) const; + int fromReference(int frame) const; void setPath(PathModel *path); @@ -60,12 +60,12 @@ signals: void modelChanged(); - void modelChanged(size_t startFrame, size_t endFrame); + void modelChanged(int startFrame, int endFrame); void completionChanged(); protected slots: void pathChanged(); - void pathChanged(size_t startFrame, size_t endFrame); + void pathChanged(int startFrame, int endFrame); void pathCompletionChanged(); protected: @@ -83,7 +83,7 @@ void constructPath() const; void constructReversePath() const; - size_t align(PathModel *path, size_t frame) const; + int align(PathModel *path, int frame) const; }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/Dense3DModelPeakCache.cpp --- a/data/model/Dense3DModelPeakCache.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/Dense3DModelPeakCache.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -18,7 +18,7 @@ #include "base/Profiler.h" Dense3DModelPeakCache::Dense3DModelPeakCache(DenseThreeDimensionalModel *source, - size_t columnsPerPeak) : + int columnsPerPeak) : m_source(source), m_resolution(columnsPerPeak) { @@ -44,7 +44,7 @@ } bool -Dense3DModelPeakCache::isColumnAvailable(size_t column) const +Dense3DModelPeakCache::isColumnAvailable(int column) const { if (!m_source) return false; if (haveColumn(column)) return true; @@ -58,7 +58,7 @@ } Dense3DModelPeakCache::Column -Dense3DModelPeakCache::getColumn(size_t column) const +Dense3DModelPeakCache::getColumn(int column) const { Profiler profiler("Dense3DModelPeakCache::getColumn"); if (!m_source) return Column(); @@ -67,7 +67,7 @@ } float -Dense3DModelPeakCache::getValueAt(size_t column, size_t n) const +Dense3DModelPeakCache::getValueAt(int column, int n) const { if (!m_source) return 0.f; if (!haveColumn(column)) fillColumn(column); @@ -93,29 +93,29 @@ } bool -Dense3DModelPeakCache::haveColumn(size_t column) const +Dense3DModelPeakCache::haveColumn(int column) const { - return column < m_coverage.size() && m_coverage.get(column); + return column < (int)m_coverage.size() && m_coverage.get(column); } void -Dense3DModelPeakCache::fillColumn(size_t column) const +Dense3DModelPeakCache::fillColumn(int column) const { Profiler profiler("Dense3DModelPeakCache::fillColumn"); - if (column >= m_coverage.size()) { + if (column >= (int)m_coverage.size()) { // see note in sourceModelChanged if (m_coverage.size() > 0) m_coverage.reset(m_coverage.size()-1); m_coverage.resize(column + 1); } Column peak; - for (int i = 0; i < m_resolution; ++i) { + for (int i = 0; i < int(m_resolution); ++i) { Column here = m_source->getColumn(column * m_resolution + i); if (i == 0) { peak = here; } else { - for (int j = 0; j < peak.size() && j < here.size(); ++j) { + for (int j = 0; j < (int)peak.size() && j < (int)here.size(); ++j) { if (here[j] > peak[j]) peak[j] = here[j]; } } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/Dense3DModelPeakCache.h --- a/data/model/Dense3DModelPeakCache.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/Dense3DModelPeakCache.h Tue Jun 17 14:33:42 2014 +0100 @@ -26,22 +26,22 @@ public: Dense3DModelPeakCache(DenseThreeDimensionalModel *source, - size_t columnsPerPeak); + int columnsPerPeak); ~Dense3DModelPeakCache(); virtual bool isOK() const { return m_source && m_source->isOK(); } - virtual size_t getSampleRate() const { + virtual int getSampleRate() const { return m_source->getSampleRate(); } - virtual size_t getStartFrame() const { + virtual int getStartFrame() const { return m_source->getStartFrame(); } - virtual size_t getEndFrame() const { + virtual int getEndFrame() const { return m_source->getEndFrame(); } @@ -49,15 +49,15 @@ return new Dense3DModelPeakCache(m_source, m_resolution); } - virtual size_t getResolution() const { + virtual int getResolution() const { return m_source->getResolution() * m_resolution; } - virtual size_t getWidth() const { + virtual int getWidth() const { return m_source->getWidth() / m_resolution + 1; } - virtual size_t getHeight() const { + virtual int getHeight() const { return m_source->getHeight(); } @@ -69,13 +69,13 @@ return m_source->getMaximumLevel(); } - virtual bool isColumnAvailable(size_t column) const; + virtual bool isColumnAvailable(int column) const; - virtual Column getColumn(size_t column) const; + virtual Column getColumn(int column) const; - virtual float getValueAt(size_t column, size_t n) const; + virtual float getValueAt(int column, int n) const; - virtual QString getBinName(size_t n) const { + virtual QString getBinName(int n) const { return m_source->getBinName(n); } @@ -97,10 +97,10 @@ DenseThreeDimensionalModel *m_source; mutable EditableDenseThreeDimensionalModel *m_cache; mutable ResizeableBitset m_coverage; - size_t m_resolution; + int m_resolution; - bool haveColumn(size_t column) const; - void fillColumn(size_t column) const; + bool haveColumn(int column) const; + void fillColumn(int column) const; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/DenseThreeDimensionalModel.h --- a/data/model/DenseThreeDimensionalModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/DenseThreeDimensionalModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -33,17 +33,17 @@ /** * Return the number of sample frames covered by each column of bins. */ - virtual size_t getResolution() const = 0; + virtual int getResolution() const = 0; /** * Return the number of columns of bins in the model. */ - virtual size_t getWidth() const = 0; + virtual int getWidth() const = 0; /** * Return the number of bins in each column. */ - virtual size_t getHeight() const = 0; + virtual int getHeight() const = 0; /** * Return the minimum permissible value in each bin. @@ -62,25 +62,25 @@ * If this function returns false, it may still be possible to * retrieve the column, but its values may have to be calculated. */ - virtual bool isColumnAvailable(size_t column) const = 0; + virtual bool isColumnAvailable(int column) const = 0; typedef QVector Column; /** * Get data from the given column of bin values. */ - virtual Column getColumn(size_t column) const = 0; + virtual Column getColumn(int column) const = 0; /** * Get the single data point from the n'th bin of the given column. */ - virtual float getValueAt(size_t column, size_t n) const = 0; + virtual float getValueAt(int column, int n) const = 0; /** * Get the name of a given bin (i.e. a label to associate with * that bin across all columns). */ - virtual QString getBinName(size_t n) const = 0; + virtual QString getBinName(int n) const = 0; /** * Return true if the bins have values as well as names. If this @@ -93,7 +93,7 @@ * value which does not vary from one column to the next. This is * only meaningful if hasBinValues() returns true. */ - virtual float getBinValue(size_t n) const { return n; } + virtual float getBinValue(int n) const { return n; } /** * Obtain the name of the unit of the values returned from @@ -111,7 +111,7 @@ * Utility function to query whether a given bin is greater than * its (vertical) neighbours. */ - bool isLocalPeak(size_t x, size_t y) { + bool isLocalPeak(int x, int y) { float value = getValueAt(x, y); if (y > 0 && value < getValueAt(x, y - 1)) return false; if (y < getHeight() - 1 && value < getValueAt(x, y + 1)) return false; @@ -122,7 +122,7 @@ * Utility function to query whether a given bin is greater than a * certain threshold. */ - bool isOverThreshold(size_t x, size_t y, float threshold) { + bool isOverThreshold(int x, int y, float threshold) { return getValueAt(x, y) > threshold; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/DenseTimeValueModel.cpp --- a/data/model/DenseTimeValueModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/DenseTimeValueModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -29,32 +29,32 @@ } QString -DenseTimeValueModel::toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const +DenseTimeValueModel::toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const { - size_t ch = getChannelCount(); + int ch = getChannelCount(); cerr << "f0 = " << f0 << ", f1 = " << f1 << endl; if (f1 <= f0) return ""; float **all = new float *[ch]; - for (size_t c = 0; c < ch; ++c) { + for (int c = 0; c < ch; ++c) { all[c] = new float[f1 - f0]; } - size_t n = getData(0, ch - 1, f0, f1 - f0, all); + int n = getData(0, ch - 1, f0, f1 - f0, all); QStringList list; - for (size_t i = 0; i < n; ++i) { + for (int i = 0; i < n; ++i) { QStringList parts; parts << QString("%1").arg(f0 + i); - for (size_t c = 0; c < ch; ++c) { + for (int c = 0; c < ch; ++c) { parts << QString("%1").arg(all[c][i]); } list << parts.join(delimiter); } - for (size_t c = 0; c < ch; ++c) { + for (int c = 0; c < ch; ++c) { delete[] all[c]; } delete[] all; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/DenseTimeValueModel.h --- a/data/model/DenseTimeValueModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/DenseTimeValueModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -53,7 +53,7 @@ /** * Return the number of distinct channels for this model. */ - virtual size_t getChannelCount() const = 0; + virtual int getChannelCount() const = 0; /** * Get the specified set of samples from the given channel of the @@ -62,7 +62,7 @@ * If the channel is given as -1, mix all available channels and * return the result. */ - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, float *buffer) const = 0; /** @@ -72,7 +72,7 @@ * If the channel is given as -1, mix all available channels and * return the result. */ - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, double *buffer) const = 0; /** @@ -80,14 +80,14 @@ * of channels of the model in single-precision floating-point * format. Return the number of sample frames actually retrieved. */ - virtual size_t getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, + virtual int getData(int fromchannel, int tochannel, + int start, int count, float **buffers) const = 0; virtual bool canPlay() const { return true; } virtual QString getDefaultPlayClipId() const { return ""; } - virtual QString toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const; + virtual QString toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const; QString getTypeName() const { return tr("Dense Time-Value"); } }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/EditableDenseThreeDimensionalModel.cpp --- a/data/model/EditableDenseThreeDimensionalModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -29,9 +29,9 @@ #include "system/System.h" -EditableDenseThreeDimensionalModel::EditableDenseThreeDimensionalModel(size_t sampleRate, - size_t resolution, - size_t yBinCount, +EditableDenseThreeDimensionalModel::EditableDenseThreeDimensionalModel(int sampleRate, + int resolution, + int yBinCount, CompressionType compression, bool notifyOnAdd) : m_startFrame(0), @@ -55,25 +55,25 @@ return true; } -size_t +int EditableDenseThreeDimensionalModel::getSampleRate() const { return m_sampleRate; } -size_t +int EditableDenseThreeDimensionalModel::getStartFrame() const { return m_startFrame; } void -EditableDenseThreeDimensionalModel::setStartFrame(size_t f) +EditableDenseThreeDimensionalModel::setStartFrame(int f) { m_startFrame = f; } -size_t +int EditableDenseThreeDimensionalModel::getEndFrame() const { return m_resolution * m_data.size() + (m_resolution - 1); @@ -92,39 +92,39 @@ model->m_maximum = m_maximum; model->m_haveExtents = m_haveExtents; - for (size_t i = 0; i < m_data.size(); ++i) { + for (int i = 0; i < m_data.size(); ++i) { model->setColumn(i, m_data.at(i)); } return model; } -size_t +int EditableDenseThreeDimensionalModel::getResolution() const { return m_resolution; } void -EditableDenseThreeDimensionalModel::setResolution(size_t sz) +EditableDenseThreeDimensionalModel::setResolution(int sz) { m_resolution = sz; } -size_t +int EditableDenseThreeDimensionalModel::getWidth() const { return m_data.size(); } -size_t +int EditableDenseThreeDimensionalModel::getHeight() const { return m_yBinCount; } void -EditableDenseThreeDimensionalModel::setHeight(size_t sz) +EditableDenseThreeDimensionalModel::setHeight(int sz) { m_yBinCount = sz; } @@ -154,28 +154,28 @@ } EditableDenseThreeDimensionalModel::Column -EditableDenseThreeDimensionalModel::getColumn(size_t index) const +EditableDenseThreeDimensionalModel::getColumn(int index) const { QReadLocker locker(&m_lock); - if (index >= m_data.size()) return Column(); + if (int(index) >= m_data.size()) return Column(); return expandAndRetrieve(index); } float -EditableDenseThreeDimensionalModel::getValueAt(size_t index, size_t n) const +EditableDenseThreeDimensionalModel::getValueAt(int index, int n) const { Column c = getColumn(index); - if (n < c.size()) return c.at(n); + if (int(n) < c.size()) return c.at(n); return m_minimum; } //static int given = 0, stored = 0; void -EditableDenseThreeDimensionalModel::truncateAndStore(size_t index, +EditableDenseThreeDimensionalModel::truncateAndStore(int index, const Column &values) { - assert(index < m_data.size()); + assert(int(index) < m_data.size()); //cout << "truncateAndStore(" << index << ", " << values.size() << ")" << endl; @@ -187,7 +187,7 @@ m_trunc[index] = 0; if (index == 0 || m_compression == NoCompression || - values.size() != m_yBinCount) { + values.size() != int(m_yBinCount)) { // given += values.size(); // stored += values.size(); m_data[index] = values; @@ -283,11 +283,11 @@ } EditableDenseThreeDimensionalModel::Column -EditableDenseThreeDimensionalModel::expandAndRetrieve(size_t index) const +EditableDenseThreeDimensionalModel::expandAndRetrieve(int index) const { // See comment above m_trunc declaration in header - assert(index < m_data.size()); + assert(int(index) < m_data.size()); Column c = m_data.at(index); if (index == 0) { return c; @@ -301,7 +301,7 @@ if (trunc < 0) { top = false; tdist = -trunc; } Column p = expandAndRetrieve(index - tdist); int psize = p.size(), csize = c.size(); - if (psize != m_yBinCount) { + if (psize != int(m_yBinCount)) { cerr << "WARNING: EditableDenseThreeDimensionalModel::expandAndRetrieve: Trying to expand from incorrectly sized column" << endl; } if (top) { @@ -326,12 +326,12 @@ } void -EditableDenseThreeDimensionalModel::setColumn(size_t index, +EditableDenseThreeDimensionalModel::setColumn(int index, const Column &values) { QWriteLocker locker(&m_lock); - while (index >= m_data.size()) { + while (int(index) >= m_data.size()) { m_data.push_back(Column()); m_trunc.push_back(0); } @@ -340,7 +340,7 @@ // if (values.size() > m_yBinCount) m_yBinCount = values.size(); - for (size_t i = 0; i < values.size(); ++i) { + for (int i = 0; i < values.size(); ++i) { float value = values[i]; if (ISNAN(value) || ISINF(value)) { continue; @@ -388,16 +388,16 @@ } QString -EditableDenseThreeDimensionalModel::getBinName(size_t n) const +EditableDenseThreeDimensionalModel::getBinName(int n) const { - if (m_binNames.size() > n) return m_binNames[n]; + if ((int)m_binNames.size() > n) return m_binNames[n]; else return ""; } void -EditableDenseThreeDimensionalModel::setBinName(size_t n, QString name) +EditableDenseThreeDimensionalModel::setBinName(int n, QString name) { - while (m_binNames.size() <= n) m_binNames.push_back(""); + while ((int)m_binNames.size() <= n) m_binNames.push_back(""); m_binNames[n] = name; emit modelChanged(); } @@ -416,9 +416,9 @@ } float -EditableDenseThreeDimensionalModel::getBinValue(size_t n) const +EditableDenseThreeDimensionalModel::getBinValue(int n) const { - if (n < m_binValues.size()) return m_binValues[n]; + if (n < (int)m_binValues.size()) return m_binValues[n]; else return 0.f; } @@ -449,7 +449,7 @@ QVector n; for (int i = 0; i < 10; ++i) { - size_t index = i * 10; + int index = i * 10; if (index < m_data.size()) { const Column &c = m_data.at(index); while (c.size() > sample.size()) { @@ -504,9 +504,9 @@ { QReadLocker locker(&m_lock); QString s; - for (size_t i = 0; i < m_data.size(); ++i) { + for (int i = 0; i < m_data.size(); ++i) { QStringList list; - for (size_t j = 0; j < m_data.at(i).size(); ++j) { + for (int j = 0; j < m_data.at(i).size(); ++j) { list << QString("%1").arg(m_data.at(i).at(j)); } s += list.join(delimiter) + "\n"; @@ -515,15 +515,15 @@ } QString -EditableDenseThreeDimensionalModel::toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const +EditableDenseThreeDimensionalModel::toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const { QReadLocker locker(&m_lock); QString s; - for (size_t i = 0; i < m_data.size(); ++i) { - size_t fr = m_startFrame + i * m_resolution; - if (fr >= f0 && fr < f1) { + for (int i = 0; i < m_data.size(); ++i) { + int fr = m_startFrame + i * m_resolution; + if (fr >= int(f0) && fr < int(f1)) { QStringList list; - for (size_t j = 0; j < m_data.at(i).size(); ++j) { + for (int j = 0; j < m_data.at(i).size(); ++j) { list << QString("%1").arg(m_data.at(i).at(j)); } s += list.join(delimiter) + "\n"; @@ -558,7 +558,7 @@ out << QString("\n") .arg(getObjectExportId(&m_data)); - for (size_t i = 0; i < m_binNames.size(); ++i) { + for (int i = 0; i < (int)m_binNames.size(); ++i) { if (m_binNames[i] != "") { out << indent + " "; out << QString("\n") @@ -566,10 +566,10 @@ } } - for (size_t i = 0; i < m_data.size(); ++i) { + for (int i = 0; i < (int)m_data.size(); ++i) { out << indent + " "; out << QString("").arg(i); - for (size_t j = 0; j < m_data.at(i).size(); ++j) { + for (int j = 0; j < (int)m_data.at(i).size(); ++j) { if (j > 0) out << " "; out << m_data.at(i).at(j); } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/EditableDenseThreeDimensionalModel.h --- a/data/model/EditableDenseThreeDimensionalModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/EditableDenseThreeDimensionalModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -42,17 +42,17 @@ BasicMultirateCompression }; - EditableDenseThreeDimensionalModel(size_t sampleRate, - size_t resolution, - size_t yBinCount, + EditableDenseThreeDimensionalModel(int sampleRate, + int resolution, + int yBinCount, CompressionType compression, bool notifyOnAdd = true); virtual bool isOK() const; - virtual size_t getSampleRate() const; - virtual size_t getStartFrame() const; - virtual size_t getEndFrame() const; + virtual int getSampleRate() const; + virtual int getStartFrame() const; + virtual int getEndFrame() const; virtual Model *clone() const; @@ -60,32 +60,32 @@ /** * Set the frame offset of the first column. */ - virtual void setStartFrame(size_t); + virtual void setStartFrame(int); /** * Return the number of sample frames covered by each set of bins. */ - virtual size_t getResolution() const; + virtual int getResolution() const; /** * Set the number of sample frames covered by each set of bins. */ - virtual void setResolution(size_t sz); + virtual void setResolution(int sz); /** * Return the number of columns. */ - virtual size_t getWidth() const; + virtual int getWidth() const; /** * Return the number of bins in each set of bins. */ - virtual size_t getHeight() const; + virtual int getHeight() const; /** * Set the number of bins in each set of bins. */ - virtual void setHeight(size_t sz); + virtual void setHeight(int sz); /** * Return the minimum value of the value in each bin. @@ -110,33 +110,33 @@ /** * Return true if there are data available for the given column. */ - virtual bool isColumnAvailable(size_t x) const { return x < getWidth(); } + virtual bool isColumnAvailable(int x) const { return x < getWidth(); } /** * Get the set of bin values at the given column. */ - virtual Column getColumn(size_t x) const; + virtual Column getColumn(int x) const; /** * Get a single value, from the n'th bin of the given column. */ - virtual float getValueAt(size_t x, size_t n) const; + virtual float getValueAt(int x, int n) const; /** * Set the entire set of bin values at the given column. */ - virtual void setColumn(size_t x, const Column &values); + virtual void setColumn(int x, const Column &values); /** * Return the name of bin n. This is a single label per bin that * does not vary from one column to the next. */ - virtual QString getBinName(size_t n) const; + virtual QString getBinName(int n) const; /** * Set the name of bin n. */ - virtual void setBinName(size_t n, QString); + virtual void setBinName(int n, QString); /** * Set the names of all bins. @@ -156,7 +156,7 @@ * value which does not vary from one column to the next. This is * only meaningful if hasBinValues() returns true. */ - virtual float getBinValue(size_t n) const; + virtual float getBinValue(int n) const; /** * Set the values of all bins (separate from their labels). These @@ -190,7 +190,7 @@ QString getTypeName() const { return tr("Editable Dense 3-D"); } virtual QString toDelimitedDataString(QString delimiter) const; - virtual QString toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const; + virtual QString toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const; virtual void toXml(QTextStream &out, QString indent = "", @@ -209,17 +209,17 @@ // value). If m_trunc[x] is 0 then the whole of column x is // stored. std::vector m_trunc; - void truncateAndStore(size_t index, const Column & values); - Column expandAndRetrieve(size_t index) const; + void truncateAndStore(int index, const Column & values); + Column expandAndRetrieve(int index) const; std::vector m_binNames; std::vector m_binValues; QString m_binValueUnit; - size_t m_startFrame; - size_t m_sampleRate; - size_t m_resolution; - size_t m_yBinCount; + int m_startFrame; + int m_sampleRate; + int m_resolution; + int m_yBinCount; CompressionType m_compression; float m_minimum; float m_maximum; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/FFTModel.cpp --- a/data/model/FFTModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/FFTModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -31,12 +31,12 @@ FFTModel::FFTModel(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn) : + int fillFromColumn) : //!!! ZoomConstraint! m_server(0), m_xshift(0), @@ -56,8 +56,8 @@ if (!m_server) return; // caller should check isOK() - size_t xratio = windowIncrement / m_server->getWindowIncrement(); - size_t yratio = m_server->getFFTSize() / fftSize; + int xratio = windowIncrement / m_server->getWindowIncrement(); + int yratio = m_server->getFFTSize() / fftSize; while (xratio > 1) { if (xratio & 0x1) { @@ -105,12 +105,12 @@ FFTModel::getServer(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria, - size_t fillFromColumn) + int fillFromColumn) { // Obviously, an FFT model of channel C (where C != -1) of an // aggregate model is the same as the FFT model of the appropriate @@ -159,21 +159,21 @@ fillFromColumn); } -size_t +int FFTModel::getSampleRate() const { return isOK() ? m_server->getModel()->getSampleRate() : 0; } FFTModel::Column -FFTModel::getColumn(size_t x) const +FFTModel::getColumn(int x) const { Profiler profiler("FFTModel::getColumn", false); Column result; result.clear(); - size_t h = getHeight(); + int h = getHeight(); result.reserve(h); #ifdef __GNUC__ @@ -184,34 +184,34 @@ if (m_server->getMagnitudesAt(x << m_xshift, magnitudes)) { - for (size_t y = 0; y < h; ++y) { + for (int y = 0; y < h; ++y) { result.push_back(magnitudes[y]); } } else { - for (size_t i = 0; i < h; ++i) result.push_back(0.f); + for (int i = 0; i < h; ++i) result.push_back(0.f); } return result; } QString -FFTModel::getBinName(size_t n) const +FFTModel::getBinName(int n) const { - size_t sr = getSampleRate(); + int sr = getSampleRate(); if (!sr) return ""; QString name = tr("%1 Hz").arg((n * sr) / ((getHeight()-1) * 2)); return name; } bool -FFTModel::estimateStableFrequency(size_t x, size_t y, float &frequency) +FFTModel::estimateStableFrequency(int x, int y, float &frequency) { if (!isOK()) return false; - size_t sampleRate = m_server->getModel()->getSampleRate(); + int sampleRate = m_server->getModel()->getSampleRate(); - size_t fftSize = m_server->getFFTSize() >> m_yshift; + int fftSize = m_server->getFFTSize() >> m_yshift; frequency = (float(y) * sampleRate) / fftSize; if (x+1 >= getWidth()) return false; @@ -228,7 +228,7 @@ float oldPhase = getPhaseAt(x, y); float newPhase = getPhaseAt(x+1, y); - size_t incr = getResolution(); + int incr = getResolution(); float expectedPhase = oldPhase + (2.0 * M_PI * y * incr) / fftSize; @@ -247,7 +247,7 @@ } FFTModel::PeakLocationSet -FFTModel::getPeaks(PeakPickType type, size_t x, size_t ymin, size_t ymax) +FFTModel::getPeaks(PeakPickType type, int x, int ymin, int ymax) { Profiler profiler("FFTModel::getPeaks"); @@ -270,7 +270,7 @@ float *values = (float *)alloca(n * sizeof(float)); #endif getMagnitudesAt(x, values, minbin, maxbin - minbin + 1); - for (size_t bin = ymin; bin <= ymax; ++bin) { + for (int bin = ymin; bin <= ymax; ++bin) { if (bin == minbin || bin == maxbin) continue; if (values[bin - minbin] > values[bin - minbin - 1] && values[bin - minbin] > values[bin - minbin + 1]) { @@ -291,26 +291,26 @@ // exceed the median. For pitch adaptivity, we adjust the window // size to a roughly constant pitch range (about four tones). - size_t sampleRate = getSampleRate(); + int sampleRate = getSampleRate(); std::deque window; - std::vector inrange; + std::vector inrange; float dist = 0.5; - size_t medianWinSize = getPeakPickWindowSize(type, sampleRate, ymin, dist); - size_t halfWin = medianWinSize/2; + int medianWinSize = getPeakPickWindowSize(type, sampleRate, ymin, dist); + int halfWin = medianWinSize/2; - size_t binmin; + int binmin; if (ymin > halfWin) binmin = ymin - halfWin; else binmin = 0; - size_t binmax; + int binmax; if (ymax + halfWin < values.size()) binmax = ymax + halfWin; else binmax = values.size()-1; - size_t prevcentre = 0; + int prevcentre = 0; - for (size_t bin = binmin; bin <= binmax; ++bin) { + for (int bin = binmin; bin <= binmax; ++bin) { float value = values[bin]; @@ -320,11 +320,11 @@ medianWinSize = getPeakPickWindowSize(type, sampleRate, bin, dist); halfWin = medianWinSize/2; - while (window.size() > medianWinSize) { + while ((int)window.size() > medianWinSize) { window.pop_front(); } - size_t actualSize = window.size(); + int actualSize = window.size(); if (type == MajorPitchAdaptivePeaks) { if (ymax + halfWin < values.size()) binmax = ymax + halfWin; @@ -335,7 +335,7 @@ std::sort(sorted.begin(), sorted.end()); float median = sorted[int(sorted.size() * dist)]; - size_t centrebin = 0; + int centrebin = 0; if (bin > actualSize/2) centrebin = bin - actualSize/2; while (centrebin > prevcentre || bin == binmin) { @@ -350,9 +350,9 @@ if (centre <= median || centrebin+1 == values.size()) { if (!inrange.empty()) { - size_t peakbin = 0; + int peakbin = 0; float peakval = 0.f; - for (size_t i = 0; i < inrange.size(); ++i) { + for (int i = 0; i < (int)inrange.size(); ++i) { if (i == 0 || values[inrange[i]] > peakval) { peakval = values[inrange[i]]; peakbin = inrange[i]; @@ -372,15 +372,15 @@ return peaks; } -size_t -FFTModel::getPeakPickWindowSize(PeakPickType type, size_t sampleRate, - size_t bin, float &percentile) const +int +FFTModel::getPeakPickWindowSize(PeakPickType type, int sampleRate, + int bin, float &percentile) const { percentile = 0.5; if (type == MajorPeaks) return 10; if (bin == 0) return 3; - size_t fftSize = m_server->getFFTSize() >> m_yshift; + int fftSize = m_server->getFFTSize() >> m_yshift; float binfreq = (sampleRate * bin) / fftSize; float hifreq = Pitch::getFrequencyForPitch(73, 0, binfreq); @@ -394,8 +394,8 @@ } FFTModel::PeakSet -FFTModel::getPeakFrequencies(PeakPickType type, size_t x, - size_t ymin, size_t ymax) +FFTModel::getPeakFrequencies(PeakPickType type, int x, + int ymin, int ymax) { Profiler profiler("FFTModel::getPeakFrequencies"); @@ -403,9 +403,9 @@ if (!isOK()) return peaks; PeakLocationSet locations = getPeaks(type, x, ymin, ymax); - size_t sampleRate = getSampleRate(); - size_t fftSize = m_server->getFFTSize() >> m_yshift; - size_t incr = getResolution(); + int sampleRate = getSampleRate(); + int fftSize = m_server->getFFTSize() >> m_yshift; + int incr = getResolution(); // This duplicates some of the work of estimateStableFrequency to // allow us to retrieve the phases in two separate vertical @@ -418,7 +418,7 @@ phases.push_back(getPhaseAt(x, *i)); } - size_t phaseIndex = 0; + int phaseIndex = 0; for (PeakLocationSet::iterator i = locations.begin(); i != locations.end(); ++i) { float oldPhase = phases[phaseIndex]; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/FFTModel.h --- a/data/model/FFTModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/FFTModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -58,54 +58,54 @@ FFTModel(const DenseTimeValueModel *model, int channel, WindowType windowType, - size_t windowSize, - size_t windowIncrement, - size_t fftSize, + int windowSize, + int windowIncrement, + int fftSize, bool polar, StorageAdviser::Criteria criteria = StorageAdviser::NoCriteria, - size_t fillFromColumn = 0); + int fillFromColumn = 0); ~FFTModel(); - inline float getMagnitudeAt(size_t x, size_t y) { + inline float getMagnitudeAt(int x, int y) { return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift); } - inline float getNormalizedMagnitudeAt(size_t x, size_t y) { + inline float getNormalizedMagnitudeAt(int x, int y) { return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift); } - inline float getMaximumMagnitudeAt(size_t x) { + inline float getMaximumMagnitudeAt(int x) { return m_server->getMaximumMagnitudeAt(x << m_xshift); } - inline float getPhaseAt(size_t x, size_t y) { + inline float getPhaseAt(int x, int y) { return m_server->getPhaseAt(x << m_xshift, y << m_yshift); } - inline void getValuesAt(size_t x, size_t y, float &real, float &imaginary) { + inline void getValuesAt(int x, int y, float &real, float &imaginary) { m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary); } - inline bool isColumnAvailable(size_t x) const { + inline bool isColumnAvailable(int x) const { return m_server->isColumnReady(x << m_xshift); } - inline bool getMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) { + inline bool getMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) { return m_server->getMagnitudesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio()); } - inline bool getNormalizedMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) { + inline bool getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) { return m_server->getNormalizedMagnitudesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio()); } - inline bool getPhasesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) { + inline bool getPhasesAt(int x, float *values, int minbin = 0, int count = 0) { return m_server->getPhasesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio()); } - inline bool getValuesAt(size_t x, float *reals, float *imaginaries, size_t minbin = 0, size_t count = 0) { + inline bool getValuesAt(int x, float *reals, float *imaginaries, int minbin = 0, int count = 0) { return m_server->getValuesAt(x << m_xshift, reals, imaginaries, minbin << m_yshift, count, getYRatio()); } - inline size_t getFillExtent() const { return m_server->getFillExtent(); } + inline int getFillExtent() const { return m_server->getFillExtent(); } // DenseThreeDimensionalModel and Model methods: // - inline virtual size_t getWidth() const { + inline virtual int getWidth() const { return m_server->getWidth() >> m_xshift; } - inline virtual size_t getHeight() const { + inline virtual int getHeight() const { // If there is no y-shift, the server's height (based on its // fftsize/2 + 1) is correct. If there is a shift, then the // server is using a larger fft size than we want, so we shift @@ -114,23 +114,23 @@ // fftsize/2 + 1). return (m_server->getHeight() >> m_yshift) + (m_yshift > 0 ? 1 : 0); } - virtual float getValueAt(size_t x, size_t y) const { + virtual float getValueAt(int x, int y) const { return const_cast(this)->getMagnitudeAt(x, y); } virtual bool isOK() const { return m_server && m_server->getModel(); } - virtual size_t getStartFrame() const { + virtual int getStartFrame() const { return 0; } - virtual size_t getEndFrame() const { + virtual int getEndFrame() const { return getWidth() * getResolution() + getResolution(); } - virtual size_t getSampleRate() const; - virtual size_t getResolution() const { + virtual int getSampleRate() const; + virtual int getResolution() const { return m_server->getWindowIncrement() << m_xshift; } - virtual size_t getYBinCount() const { + virtual int getYBinCount() const { return getHeight(); } virtual float getMinimumLevel() const { @@ -139,8 +139,8 @@ virtual float getMaximumLevel() const { return 1.f; // Can't provide } - virtual Column getColumn(size_t x) const; - virtual QString getBinName(size_t n) const; + virtual Column getColumn(int x) const; + virtual QString getBinName(int n) const; virtual bool shouldUseLogValueScale() const { return true; // Although obviously it's up to the user... @@ -151,7 +151,7 @@ * bin, using phase unwrapping. This will be completely wrong if * the signal is not stable here. */ - virtual bool estimateStableFrequency(size_t x, size_t y, float &frequency); + virtual bool estimateStableFrequency(int x, int y, float &frequency); enum PeakPickType { @@ -160,21 +160,21 @@ MajorPitchAdaptivePeaks /// Bigger window for higher frequencies }; - typedef std::set PeakLocationSet; // bin - typedef std::map PeakSet; // bin -> freq + typedef std::set PeakLocationSet; // bin + typedef std::map PeakSet; // bin -> freq /** * Return locations of peak bins in the range [ymin,ymax]. If * ymax is zero, getHeight()-1 will be used. */ - virtual PeakLocationSet getPeaks(PeakPickType type, size_t x, - size_t ymin = 0, size_t ymax = 0); + virtual PeakLocationSet getPeaks(PeakPickType type, int x, + int ymin = 0, int ymax = 0); /** * Return locations and estimated stable frequencies of peak bins. */ - virtual PeakSet getPeakFrequencies(PeakPickType type, size_t x, - size_t ymin = 0, size_t ymax = 0); + virtual PeakSet getPeakFrequencies(PeakPickType type, int x, + int ymin = 0, int ymax = 0); virtual int getCompletion() const { return m_server->getFillCompletion(); } virtual QString getError() const { return m_server->getError(); } @@ -199,15 +199,15 @@ int m_yshift; FFTDataServer *getServer(const DenseTimeValueModel *, - int, WindowType, size_t, size_t, size_t, - bool, StorageAdviser::Criteria, size_t); + int, WindowType, int, int, int, + bool, StorageAdviser::Criteria, int); - size_t getPeakPickWindowSize(PeakPickType type, size_t sampleRate, - size_t bin, float &percentile) const; + int getPeakPickWindowSize(PeakPickType type, int sampleRate, + int bin, float &percentile) const; - size_t getYRatio() { - size_t ys = m_yshift; - size_t r = 1; + int getYRatio() { + int ys = m_yshift; + int r = 1; while (ys) { --ys; r <<= 1; } return r; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/FlexiNoteModel.h --- a/data/model/FlexiNoteModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/FlexiNoteModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -43,14 +43,14 @@ { public: FlexiNote(long _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { } - FlexiNote(long _frame, float _value, size_t _duration, float _level, QString _label) : + FlexiNote(long _frame, float _value, int _duration, float _level, QString _label) : frame(_frame), value(_value), duration(_duration), level(_level), label(_label) { } int getDimensions() const { return 3; } long frame; float value; - size_t duration; + int duration; float level; QString label; @@ -66,7 +66,7 @@ .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -102,7 +102,7 @@ Q_OBJECT public: - FlexiNoteModel(size_t sampleRate, size_t resolution, + FlexiNoteModel(int sampleRate, int resolution, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, notifyOnAdd), m_valueQuantization(0) @@ -110,7 +110,7 @@ PlayParameterRepository::getInstance()->addPlayable(this); } - FlexiNoteModel(size_t sampleRate, size_t resolution, + FlexiNoteModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, @@ -231,12 +231,12 @@ return getNotes(getStartFrame(), getEndFrame()); } - NoteList getNotes(size_t startFrame, size_t endFrame) const + NoteList getNotes(int startFrame, int endFrame) const { PointList points = getPoints(startFrame, endFrame); NoteList notes; for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) { - size_t duration = pli->duration; + int duration = pli->duration; if (duration == 0 || duration == 1) { duration = getSampleRate() / 20; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/ImageModel.h --- a/data/model/ImageModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/ImageModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -55,7 +55,7 @@ .arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -89,7 +89,7 @@ Q_OBJECT public: - ImageModel(size_t sampleRate, size_t resolution, bool notifyOnAdd = true) : + ImageModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseModel(sampleRate, resolution, notifyOnAdd) { } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/IntervalModel.h --- a/data/model/IntervalModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/IntervalModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -29,12 +29,12 @@ class IntervalModel : public SparseValueModel { public: - IntervalModel(size_t sampleRate, size_t resolution, + IntervalModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseValueModel(sampleRate, resolution, notifyOnAdd) { } - IntervalModel(size_t sampleRate, size_t resolution, + IntervalModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : SparseValueModel(sampleRate, resolution, diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/Labeller.h --- a/data/model/Labeller.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/Labeller.h Tue Jun 17 14:33:42 2014 +0100 @@ -292,7 +292,7 @@ } else if (!prevPoint) { std::cerr << "ERROR: Labeller::getValueFor: Time difference required, but only one point provided" << std::endl; } else { - size_t f0 = prevPoint->frame, f1 = newPoint.frame; + int f0 = prevPoint->frame, f1 = newPoint.frame; if (m_type == ValueFromDurationToNext || m_type == ValueFromDurationFromPrevious) { value = float(f1 - f0) / m_rate; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/Model.cpp --- a/data/model/Model.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/Model.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -106,27 +106,27 @@ return m_alignment->getReferenceModel(); } -size_t -Model::alignToReference(size_t frame) const +int +Model::alignToReference(int frame) const { if (!m_alignment) { if (m_sourceModel) return m_sourceModel->alignToReference(frame); else return frame; } - size_t refFrame = m_alignment->toReference(frame); + int refFrame = m_alignment->toReference(frame); const Model *m = m_alignment->getReferenceModel(); if (m && refFrame > m->getEndFrame()) refFrame = m->getEndFrame(); return refFrame; } -size_t -Model::alignFromReference(size_t refFrame) const +int +Model::alignFromReference(int refFrame) const { if (!m_alignment) { if (m_sourceModel) return m_sourceModel->alignFromReference(refFrame); else return refFrame; } - size_t frame = m_alignment->fromReference(refFrame); + int frame = m_alignment->fromReference(refFrame); if (frame > getEndFrame()) frame = getEndFrame(); return frame; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/Model.h --- a/data/model/Model.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/Model.h Tue Jun 17 14:33:42 2014 +0100 @@ -50,23 +50,23 @@ /** * Return the first audio frame spanned by the model. */ - virtual size_t getStartFrame() const = 0; + virtual int getStartFrame() const = 0; /** * Return the last audio frame spanned by the model. */ - virtual size_t getEndFrame() const = 0; + virtual int getEndFrame() const = 0; /** * Return the frame rate in frames per second. */ - virtual size_t getSampleRate() const = 0; + virtual int getSampleRate() const = 0; /** * Return the frame rate of the underlying material, if the model * itself has already been resampled. */ - virtual size_t getNativeRate() const { return getSampleRate(); } + virtual int getNativeRate() const { return getSampleRate(); } /** * Return the "work title" of the model, if known. @@ -180,13 +180,13 @@ * Return the frame number of the reference model that corresponds * to the given frame number in this model. */ - virtual size_t alignToReference(size_t frame) const; + virtual int alignToReference(int frame) const; /** * Return the frame number in this model that corresponds to the * given frame number of the reference model. */ - virtual size_t alignFromReference(size_t referenceFrame) const; + virtual int alignFromReference(int referenceFrame) const; /** * Return the completion percentage for the alignment model: 100 @@ -214,9 +214,9 @@ QString extraAttributes = "") const; virtual QString toDelimitedDataString(QString delimiter) const { - return toDelimitedDataString(delimiter, getStartFrame(), getEndFrame()); + return toDelimitedDataStringSubset(delimiter, getStartFrame(), getEndFrame()); } - virtual QString toDelimitedDataString(QString, size_t /* f0 */, size_t /* f1 */) const { + virtual QString toDelimitedDataStringSubset(QString, int /* f0 */, int /* f1 */) const { return ""; } @@ -235,7 +235,7 @@ * Emitted when a model has been edited (or more data retrieved * from cache, in the case of a cached model that generates slowly) */ - void modelChanged(size_t startFrame, size_t endFrame); + void modelChanged(int startFrame, int endFrame); /** * Emitted when some internal processing has advanced a stage, but diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/ModelDataTableModel.cpp --- a/data/model/ModelDataTableModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/ModelDataTableModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -31,8 +31,8 @@ Model *baseModel = dynamic_cast(m); connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); - connect(baseModel, SIGNAL(modelChanged(size_t, size_t)), - this, SLOT(modelChanged(size_t, size_t))); + connect(baseModel, SIGNAL(modelChanged(int, int)), + this, SLOT(modelChanged(int, int))); connect(baseModel, SIGNAL(aboutToBeDeleted()), this, SLOT(modelAboutToBeDeleted())); } @@ -105,7 +105,7 @@ } Qt::ItemFlags -ModelDataTableModel::flags(const QModelIndex &index) const +ModelDataTableModel::flags(const QModelIndex &) const { Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsSelectable; @@ -127,13 +127,13 @@ } QModelIndex -ModelDataTableModel::index(int row, int column, const QModelIndex &parent) const +ModelDataTableModel::index(int row, int column, const QModelIndex &) const { return createIndex(row, column, (void *)0); } QModelIndex -ModelDataTableModel::parent(const QModelIndex &index) const +ModelDataTableModel::parent(const QModelIndex &) const { return QModelIndex(); } @@ -155,14 +155,14 @@ } QModelIndex -ModelDataTableModel::getModelIndexForFrame(size_t frame) const +ModelDataTableModel::getModelIndexForFrame(int frame) const { if (!m_model) return createIndex(0, 0); int row = m_model->getRowForFrame(frame); return createIndex(getSorted(row), 0, (void *)0); } -size_t +int ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const { if (!m_model) return 0; @@ -219,7 +219,7 @@ } void -ModelDataTableModel::modelChanged(size_t f0, size_t f1) +ModelDataTableModel::modelChanged(int, int) { //!!! inefficient clearSort(); @@ -250,7 +250,7 @@ resort(); } int result = 0; - if (row >= 0 && row < m_sort.size()) { + if (row >= 0 && row < (int)m_sort.size()) { result = m_sort[row]; } if (m_sortOrdering == Qt::DescendingOrder) { @@ -278,7 +278,7 @@ } int result = 0; - if (row >= 0 && row < m_sort.size()) { + if (row >= 0 && row < (int)m_sort.size()) { if (m_sortOrdering == Qt::AscendingOrder) { result = m_rsort[row]; } else { @@ -309,7 +309,7 @@ // rsort maps from sorted row number to original row number - for (int i = 0; i < m_rsort.size(); ++i) { + for (int i = 0; i < (int)m_rsort.size(); ++i) { tmp[m_rsort[i]] = i; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/ModelDataTableModel.h --- a/data/model/ModelDataTableModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/ModelDataTableModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -51,8 +51,8 @@ int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex getModelIndexForFrame(size_t frame) const; - size_t getFrameForModelIndex(const QModelIndex &) const; + QModelIndex getModelIndexForFrame(int frame) const; + int getFrameForModelIndex(const QModelIndex &) const; void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); @@ -62,14 +62,14 @@ int getCurrentRow() const; signals: - void frameSelected(size_t); + void frameSelected(int); void addCommand(Command *); void currentChanged(const QModelIndex &); void modelRemoved(); protected slots: void modelChanged(); - void modelChanged(size_t, size_t); + void modelChanged(int, int); void modelAboutToBeDeleted(); protected: diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/NoteData.h --- a/data/model/NoteData.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/NoteData.h Tue Jun 17 14:33:42 2014 +0100 @@ -21,12 +21,12 @@ struct NoteData { - NoteData(size_t _start, size_t _dur, int _mp, int _vel) : + NoteData(int _start, int _dur, int _mp, int _vel) : start(_start), duration(_dur), midiPitch(_mp), frequency(0), isMidiPitchQuantized(true), velocity(_vel) { }; - size_t start; // audio sample frame - size_t duration; // in audio sample frames + int start; // audio sample frame + int duration; // in audio sample frames int midiPitch; // 0-127 float frequency; // Hz, to be used if isMidiPitchQuantized false bool isMidiPitchQuantized; @@ -47,7 +47,7 @@ { public: virtual NoteList getNotes() const = 0; - virtual NoteList getNotes(size_t startFrame, size_t endFrame) const = 0; + virtual NoteList getNotesWithin(int startFrame, int endFrame) const = 0; }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/NoteModel.h --- a/data/model/NoteModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/NoteModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -39,14 +39,14 @@ { public: Note(long _frame) : frame(_frame), value(0.0f), duration(0), level(1.f) { } - Note(long _frame, float _value, size_t _duration, float _level, QString _label) : + Note(long _frame, float _value, int _duration, float _level, QString _label) : frame(_frame), value(_value), duration(_duration), level(_level), label(_label) { } int getDimensions() const { return 3; } long frame; float value; - size_t duration; + int duration; float level; QString label; @@ -62,7 +62,7 @@ .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -98,7 +98,7 @@ Q_OBJECT public: - NoteModel(size_t sampleRate, size_t resolution, + NoteModel(int sampleRate, int resolution, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, notifyOnAdd), m_valueQuantization(0) @@ -106,7 +106,7 @@ PlayParameterRepository::getInstance()->addPlayable(this); } - NoteModel(size_t sampleRate, size_t resolution, + NoteModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, @@ -221,10 +221,10 @@ */ NoteList getNotes() const { - return getNotes(getStartFrame(), getEndFrame()); + return getNotesWithin(getStartFrame(), getEndFrame()); } - NoteList getNotes(size_t startFrame, size_t endFrame) const { + NoteList getNotesWithin(int startFrame, int endFrame) const { PointList points = getPoints(startFrame, endFrame); NoteList notes; @@ -232,7 +232,7 @@ for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) { - size_t duration = pli->duration; + int duration = pli->duration; if (duration == 0 || duration == 1) { duration = getSampleRate() / 20; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/PathModel.h --- a/data/model/PathModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/PathModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -43,7 +43,7 @@ } QString toDelimitedDataString(QString delimiter, - size_t sampleRate) const { + int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); list << QString("%1").arg(mapframe); @@ -67,7 +67,7 @@ class PathModel : public SparseModel { public: - PathModel(size_t sampleRate, size_t resolution, bool notify = true) : + PathModel(int sampleRate, int resolution, bool notify = true) : SparseModel(sampleRate, resolution, notify) { } virtual void toXml(QTextStream &out, diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/PowerOfSqrtTwoZoomConstraint.cpp --- a/data/model/PowerOfSqrtTwoZoomConstraint.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/PowerOfSqrtTwoZoomConstraint.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -19,26 +19,26 @@ #include -size_t -PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(size_t blockSize, +int +PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(int blockSize, RoundingDirection dir) const { int type, power; - size_t rv = getNearestBlockSize(blockSize, type, power, dir); + int rv = getNearestBlockSize(blockSize, type, power, dir); return rv; } -size_t -PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(size_t blockSize, +int +PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(int blockSize, int &type, int &power, RoundingDirection dir) const { // cerr << "given " << blockSize << endl; - size_t minCachePower = getMinCachePower(); + int minCachePower = getMinCachePower(); - if (blockSize < (1U << minCachePower)) { + if (blockSize < (1 << minCachePower)) { type = -1; power = 0; float val = 1.0, prevVal = 1.0; @@ -46,27 +46,27 @@ prevVal = val; val *= sqrt(2.f); } - size_t rval; - if (dir == RoundUp) rval = size_t(val + 0.01); - else if (dir == RoundDown) rval = size_t(prevVal + 0.01); - else if (val - blockSize < blockSize - prevVal) rval = size_t(val + 0.01); - else rval = size_t(prevVal + 0.01); + int rval; + if (dir == RoundUp) rval = int(val + 0.01); + else if (dir == RoundDown) rval = int(prevVal + 0.01); + else if (val - blockSize < blockSize - prevVal) rval = int(val + 0.01); + else rval = int(prevVal + 0.01); // SVDEBUG << "returning " << rval << endl; return rval; } - unsigned int prevBase = (1 << minCachePower); - unsigned int prevPower = minCachePower; - unsigned int prevType = 0; + int prevBase = (1 << minCachePower); + int prevPower = minCachePower; + int prevType = 0; - size_t result = 0; + int result = 0; for (unsigned int i = 0; ; ++i) { power = minCachePower + i/2; type = i % 2; - unsigned int base; + int base; if (type == 0) { base = (1 << power); } else { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/PowerOfSqrtTwoZoomConstraint.h --- a/data/model/PowerOfSqrtTwoZoomConstraint.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/PowerOfSqrtTwoZoomConstraint.h Tue Jun 17 14:33:42 2014 +0100 @@ -21,17 +21,17 @@ class PowerOfSqrtTwoZoomConstraint : virtual public ZoomConstraint { public: - virtual size_t getNearestBlockSize(size_t requestedBlockSize, + virtual int getNearestBlockSize(int requestedBlockSize, RoundingDirection dir = RoundNearest) const; - virtual size_t getNearestBlockSize(size_t requestedBlockSize, + virtual int getNearestBlockSize(int requestedBlockSize, int &type, int &power, RoundingDirection dir = RoundNearest) const; - virtual size_t getMinCachePower() const { return 6; } + virtual int getMinCachePower() const { return 6; } }; #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/PowerOfTwoZoomConstraint.cpp --- a/data/model/PowerOfTwoZoomConstraint.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/PowerOfTwoZoomConstraint.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -15,13 +15,13 @@ #include "PowerOfTwoZoomConstraint.h" -size_t -PowerOfTwoZoomConstraint::getNearestBlockSize(size_t req, +int +PowerOfTwoZoomConstraint::getNearestBlockSize(int req, RoundingDirection dir) const { - size_t result = 0; + int result = 0; - for (size_t bs = 1; ; bs *= 2) { + for (int bs = 1; ; bs *= 2) { if (bs >= req) { if (dir == RoundNearest) { if (bs - req < req - bs/2) { diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/PowerOfTwoZoomConstraint.h --- a/data/model/PowerOfTwoZoomConstraint.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/PowerOfTwoZoomConstraint.h Tue Jun 17 14:33:42 2014 +0100 @@ -21,7 +21,7 @@ class PowerOfTwoZoomConstraint : virtual public ZoomConstraint { public: - virtual size_t getNearestBlockSize(size_t requestedBlockSize, + virtual int getNearestBlockSize(int requestedBlockSize, RoundingDirection dir = RoundNearest) const; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/RangeSummarisableTimeValueModel.h --- a/data/model/RangeSummarisableTimeValueModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/RangeSummarisableTimeValueModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -74,18 +74,18 @@ * parameter so as to return the block size that was actually * obtained. */ - virtual void getSummaries(size_t channel, size_t start, size_t count, + virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, - size_t &blockSize) const = 0; + int &blockSize) const = 0; /** * Return the range from the given start frame, corresponding to * the given number of underlying sample frames, summarised at a * block size equal to the distance between start and end frames. */ - virtual Range getSummary(size_t channel, size_t start, size_t count) const = 0; + virtual Range getSummary(int channel, int start, int count) const = 0; - virtual size_t getSummaryBlockSize(size_t desired) const = 0; + virtual int getSummaryBlockSize(int desired) const = 0; QString getTypeName() const { return tr("Range-Summarisable Time-Value"); } }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/RegionModel.h --- a/data/model/RegionModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/RegionModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -38,14 +38,14 @@ public: RegionRec() : frame(0), value(0.f), duration(0) { } RegionRec(long _frame) : frame(_frame), value(0.0f), duration(0) { } - RegionRec(long _frame, float _value, size_t _duration, QString _label) : + RegionRec(long _frame, float _value, int _duration, QString _label) : frame(_frame), value(_value), duration(_duration), label(_label) { } int getDimensions() const { return 3; } long frame; float value; - size_t duration; + int duration; QString label; QString getLabel() const { return label; } @@ -60,7 +60,7 @@ .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -94,7 +94,7 @@ Q_OBJECT public: - RegionModel(size_t sampleRate, size_t resolution, + RegionModel(int sampleRate, int resolution, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, notifyOnAdd), m_valueQuantization(0), @@ -102,7 +102,7 @@ { } - RegionModel(size_t sampleRate, size_t resolution, + RegionModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : IntervalModel(sampleRate, resolution, diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/SparseModel.h --- a/data/model/SparseModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/SparseModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -43,14 +43,14 @@ public TabularModel { public: - SparseModel(size_t sampleRate, size_t resolution, + SparseModel(int sampleRate, int resolution, bool notifyOnAdd = true); virtual ~SparseModel() { } virtual bool isOK() const { return true; } - virtual size_t getStartFrame() const; - virtual size_t getEndFrame() const; - virtual size_t getSampleRate() const { return m_sampleRate; } + virtual int getStartFrame() const; + virtual int getEndFrame() const; + virtual int getSampleRate() const { return m_sampleRate; } virtual Model *clone() const; @@ -59,10 +59,10 @@ // then every point in this model will be at a multiple of 10 // sample frames and should be considered to cover a window ending // 10 sample frames later. - virtual size_t getResolution() const { + virtual int getResolution() const { return m_resolution ? m_resolution : 1; } - virtual void setResolution(size_t resolution); + virtual void setResolution(int resolution); typedef PointType Point; typedef std::multiset int(m_rows.size())) return m_points.end(); - size_t frame = m_rows[row]; + int frame = m_rows[row]; int indexAtFrame = 0; int ri = row; while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } @@ -434,7 +434,7 @@ if (m_rows.empty()) rebuildRowVector(); if (row < 0 || row + 1 > int(m_rows.size())) return m_points.end(); - size_t frame = m_rows[row]; + int frame = m_rows[row]; int indexAtFrame = 0; int ri = row; while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } @@ -465,8 +465,8 @@ template -SparseModel::SparseModel(size_t sampleRate, - size_t resolution, +SparseModel::SparseModel(int sampleRate, + int resolution, bool notifyOnAdd) : m_sampleRate(sampleRate), m_resolution(resolution), @@ -480,11 +480,11 @@ } template -size_t +int SparseModel::getStartFrame() const { QMutexLocker locker(&m_mutex); - size_t f = 0; + int f = 0; if (!m_points.empty()) { f = m_points.begin()->frame; } @@ -492,11 +492,11 @@ } template -size_t +int SparseModel::getEndFrame() const { QMutexLocker locker(&m_mutex); - size_t f = 0; + int f = 0; if (!m_points.empty()) { PointListConstIterator i(m_points.end()); f = (--i)->frame; @@ -526,7 +526,7 @@ } template -size_t +int SparseModel::getPointCount() const { return m_pointCount; @@ -676,7 +676,7 @@ template void -SparseModel::setResolution(size_t resolution) +SparseModel::setResolution(int resolution) { { QMutexLocker locker(&m_mutex); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/SparseOneDimensionalModel.h --- a/data/model/SparseOneDimensionalModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/SparseOneDimensionalModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -26,12 +26,12 @@ struct OneDimensionalPoint { public: - OneDimensionalPoint(long _frame) : frame(_frame) { } - OneDimensionalPoint(long _frame, QString _label) : frame(_frame), label(_label) { } + OneDimensionalPoint(int _frame) : frame(_frame) { } + OneDimensionalPoint(int _frame, QString _label) : frame(_frame), label(_label) { } int getDimensions() const { return 1; } - long frame; + int frame; QString label; QString getLabel() const { return label; } @@ -45,7 +45,7 @@ .arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -76,7 +76,7 @@ Q_OBJECT public: - SparseOneDimensionalModel(size_t sampleRate, size_t resolution, + SparseOneDimensionalModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseModel(sampleRate, resolution, notifyOnAdd) { @@ -184,10 +184,10 @@ */ NoteList getNotes() const { - return getNotes(getStartFrame(), getEndFrame()); + return getNotesWithin(getStartFrame(), getEndFrame()); } - NoteList getNotes(size_t startFrame, size_t endFrame) const { + NoteList getNotesWithin(int startFrame, int endFrame) const { PointList points = getPoints(startFrame, endFrame); NoteList notes; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/SparseTimeValueModel.h --- a/data/model/SparseTimeValueModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/SparseTimeValueModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -49,7 +49,7 @@ .arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -81,7 +81,7 @@ Q_OBJECT public: - SparseTimeValueModel(size_t sampleRate, size_t resolution, + SparseTimeValueModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseValueModel(sampleRate, resolution, notifyOnAdd) @@ -91,7 +91,7 @@ PlayParameterRepository::getInstance()->addPlayable(this); } - SparseTimeValueModel(size_t sampleRate, size_t resolution, + SparseTimeValueModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : SparseValueModel(sampleRate, resolution, diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/SparseValueModel.h --- a/data/model/SparseValueModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/SparseValueModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -31,7 +31,7 @@ class SparseValueModel : public SparseModel { public: - SparseValueModel(size_t sampleRate, size_t resolution, + SparseValueModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseModel(sampleRate, resolution, notifyOnAdd), m_valueMinimum(0.f), @@ -39,7 +39,7 @@ m_haveExtents(false) { } - SparseValueModel(size_t sampleRate, size_t resolution, + SparseValueModel(int sampleRate, int resolution, float valueMinimum, float valueMaximum, bool notifyOnAdd = true) : SparseModel(sampleRate, resolution, notifyOnAdd), diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/TextModel.h --- a/data/model/TextModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/TextModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -51,7 +51,7 @@ .arg(encodeEntities(label)).arg(extraAttributes); } - QString toDelimitedDataString(QString delimiter, size_t sampleRate) const + QString toDelimitedDataString(QString delimiter, int sampleRate) const { QStringList list; list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str(); @@ -85,7 +85,7 @@ Q_OBJECT public: - TextModel(size_t sampleRate, size_t resolution, bool notifyOnAdd = true) : + TextModel(int sampleRate, int resolution, bool notifyOnAdd = true) : SparseModel(sampleRate, resolution, notifyOnAdd) { } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/WaveFileModel.cpp --- a/data/model/WaveFileModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/WaveFileModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -35,7 +35,7 @@ PowerOfSqrtTwoZoomConstraint WaveFileModel::m_zoomConstraint; -WaveFileModel::WaveFileModel(FileSource source, size_t targetRate) : +WaveFileModel::WaveFileModel(FileSource source, int targetRate) : m_source(source), m_path(source.getLocation()), m_myReader(true), @@ -126,32 +126,32 @@ return model; } -size_t +int WaveFileModel::getFrameCount() const { if (!m_reader) return 0; return m_reader->getFrameCount(); } -size_t +int WaveFileModel::getChannelCount() const { if (!m_reader) return 0; return m_reader->getChannelCount(); } -size_t +int WaveFileModel::getSampleRate() const { if (!m_reader) return 0; return m_reader->getSampleRate(); } -size_t +int WaveFileModel::getNativeRate() const { if (!m_reader) return 0; - size_t rate = m_reader->getNativeRate(); + int rate = m_reader->getNativeRate(); if (rate == 0) rate = getSampleRate(); return rate; } @@ -179,8 +179,8 @@ return ""; } -size_t -WaveFileModel::getData(int channel, size_t start, size_t count, +int +WaveFileModel::getData(int channel, int start, int count, float *buffer) const { // Always read these directly from the file. @@ -194,7 +194,7 @@ if (start >= m_startFrame) { start -= m_startFrame; } else { - for (size_t i = 0; i < count; ++i) buffer[i] = 0.f; + for (int i = 0; i < count; ++i) buffer[i] = 0.f; if (count <= m_startFrame - start) { return 0; } else { @@ -204,7 +204,7 @@ } if (!m_reader || !m_reader->isOK() || count == 0) { - for (size_t i = 0; i < count; ++i) buffer[i] = 0.f; + for (int i = 0; i < count; ++i) buffer[i] = 0.f; return 0; } @@ -218,7 +218,7 @@ SampleBlock frames(count * channels); m_reader->getInterleavedFrames(start, count, frames); - size_t i = 0; + int i = 0; int ch0 = channel, ch1 = channel; if (channel == -1) { @@ -232,8 +232,8 @@ for (int ch = ch0; ch <= ch1; ++ch) { - size_t index = i * channels + ch; - if (index >= frames.size()) break; + int index = i * channels + ch; + if (index >= (int)frames.size()) break; float sample = frames[index]; buffer[i] += sample; @@ -245,8 +245,8 @@ return i; } -size_t -WaveFileModel::getData(int channel, size_t start, size_t count, +int +WaveFileModel::getData(int channel, int start, int count, double *buffer) const { #ifdef DEBUG_WAVE_FILE_MODEL @@ -256,7 +256,7 @@ if (start > m_startFrame) { start -= m_startFrame; } else { - for (size_t i = 0; i < count; ++i) buffer[i] = 0.0; + for (int i = 0; i < count; ++i) buffer[i] = 0.0; if (count <= m_startFrame - start) { return 0; } else { @@ -266,7 +266,7 @@ } if (!m_reader || !m_reader->isOK() || count == 0) { - for (size_t i = 0; i < count; ++i) buffer[i] = 0.0; + for (int i = 0; i < count; ++i) buffer[i] = 0.0; return 0; } @@ -275,7 +275,7 @@ SampleBlock frames(count * channels); m_reader->getInterleavedFrames(start, count, frames); - size_t i = 0; + int i = 0; int ch0 = channel, ch1 = channel; if (channel == -1) { @@ -289,8 +289,8 @@ for (int ch = ch0; ch <= ch1; ++ch) { - size_t index = i * channels + ch; - if (index >= frames.size()) break; + int index = i * channels + ch; + if (index >= (int)frames.size()) break; float sample = frames[index]; buffer[i] += sample; @@ -302,16 +302,16 @@ return i; } -size_t -WaveFileModel::getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, +int +WaveFileModel::getData(int fromchannel, int tochannel, + int start, int count, float **buffer) const { #ifdef DEBUG_WAVE_FILE_MODEL cout << "WaveFileModel::getData[" << this << "]: " << fromchannel << "," << tochannel << ", " << start << ", " << count << ", " << buffer << endl; #endif - size_t channels = getChannelCount(); + int channels = getChannelCount(); if (fromchannel > tochannel) { cerr << "ERROR: WaveFileModel::getData: fromchannel (" @@ -331,7 +331,7 @@ return getData(fromchannel, start, count, buffer[0]); } - size_t reqchannels = (tochannel - fromchannel) + 1; + int reqchannels = (tochannel - fromchannel) + 1; // Always read these directly from the file. // This is used for e.g. audio playback. @@ -340,8 +340,8 @@ if (start >= m_startFrame) { start -= m_startFrame; } else { - for (size_t c = 0; c < reqchannels; ++c) { - for (size_t i = 0; i < count; ++i) buffer[c][i] = 0.f; + for (int c = 0; c < reqchannels; ++c) { + for (int i = 0; i < count; ++i) buffer[c][i] = 0.f; } if (count <= m_startFrame - start) { return 0; @@ -352,8 +352,8 @@ } if (!m_reader || !m_reader->isOK() || count == 0) { - for (size_t c = 0; c < reqchannels; ++c) { - for (size_t i = 0; i < count; ++i) buffer[c][i] = 0.f; + for (int c = 0; c < reqchannels; ++c) { + for (int i = 0; i < count; ++i) buffer[c][i] = 0.f; } return 0; } @@ -361,19 +361,17 @@ SampleBlock frames(count * channels); m_reader->getInterleavedFrames(start, count, frames); - size_t i = 0; + int i = 0; - int ch0 = fromchannel, ch1 = tochannel; - - size_t index = 0, available = frames.size(); + int index = 0, available = frames.size(); while (i < count) { if (index >= available) break; - size_t destc = 0; + int destc = 0; - for (size_t c = 0; c < channels; ++c) { + for (int c = 0; c < channels; ++c) { if (c >= fromchannel && c <= tochannel) { buffer[destc][i] = frames[index]; @@ -389,12 +387,12 @@ return i; } -size_t -WaveFileModel::getSummaryBlockSize(size_t desired) const +int +WaveFileModel::getSummaryBlockSize(int desired) const { int cacheType = 0; int power = m_zoomConstraint.getMinCachePower(); - size_t roundedBlockSize = m_zoomConstraint.getNearestBlockSize + int roundedBlockSize = m_zoomConstraint.getNearestBlockSize (desired, cacheType, power, ZoomConstraint::RoundDown); if (cacheType != 0 && cacheType != 1) { // We will be reading directly from file, so can satisfy any @@ -406,8 +404,8 @@ } void -WaveFileModel::getSummaries(size_t channel, size_t start, size_t count, - RangeBlock &ranges, size_t &blockSize) const +WaveFileModel::getSummaries(int channel, int start, int count, + RangeBlock &ranges, int &blockSize) const { ranges.clear(); if (!isOK()) return; @@ -422,10 +420,10 @@ int cacheType = 0; int power = m_zoomConstraint.getMinCachePower(); - size_t roundedBlockSize = m_zoomConstraint.getNearestBlockSize + int roundedBlockSize = m_zoomConstraint.getNearestBlockSize (blockSize, cacheType, power, ZoomConstraint::RoundDown); - size_t channels = getChannelCount(); + int channels = getChannelCount(); if (cacheType != 0 && cacheType != 1) { @@ -449,12 +447,12 @@ } float max = 0.0, min = 0.0, total = 0.0; - size_t i = 0, got = 0; + int i = 0, got = 0; while (i < count) { - size_t index = i * channels + channel; - if (index >= m_directRead.size()) break; + int index = i * channels + channel; + if (index >= (int)m_directRead.size()) break; float sample = m_directRead[index]; if (sample > max || got == 0) max = sample; @@ -487,7 +485,7 @@ blockSize = roundedBlockSize; - size_t cacheBlock, div; + int cacheBlock, div; if (cacheType == 0) { cacheBlock = (1 << m_zoomConstraint.getMinCachePower()); @@ -497,11 +495,11 @@ div = ((unsigned int)((1 << power) * sqrt(2.) + 0.01)) / cacheBlock; } - size_t startIndex = start / cacheBlock; - size_t endIndex = (start + count) / cacheBlock; + int startIndex = start / cacheBlock; + int endIndex = (start + count) / cacheBlock; float max = 0.0, min = 0.0, total = 0.0; - size_t i = 0, got = 0; + int i = 0, got = 0; #ifdef DEBUG_WAVE_FILE_MODEL cerr << "blockSize is " << blockSize << ", cacheBlock " << cacheBlock << ", start " << start << ", count " << count << " (frame count " << getFrameCount() << "), power is " << power << ", div is " << div << ", startIndex " << startIndex << ", endIndex " << endIndex << endl; @@ -509,8 +507,8 @@ for (i = 0; i <= endIndex - startIndex; ) { - size_t index = (i + startIndex) * channels + channel; - if (index >= cache.size()) break; + int index = (i + startIndex) * channels + channel; + if (index >= (int)cache.size()) break; const Range &range = cache[index]; if (range.max() > max || got == 0) max = range.max(); @@ -539,7 +537,7 @@ } WaveFileModel::Range -WaveFileModel::getSummary(size_t channel, size_t start, size_t count) const +WaveFileModel::getSummary(int channel, int start, int count) const { Range range; if (!isOK()) return range; @@ -551,21 +549,21 @@ start = 0; } - size_t blockSize; + int blockSize; for (blockSize = 1; blockSize <= count; blockSize *= 2); if (blockSize > 1) blockSize /= 2; bool first = false; - size_t blockStart = (start / blockSize) * blockSize; - size_t blockEnd = ((start + count) / blockSize) * blockSize; + int blockStart = (start / blockSize) * blockSize; + int blockEnd = ((start + count) / blockSize) * blockSize; if (blockStart < start) blockStart += blockSize; if (blockEnd > blockStart) { RangeBlock ranges; getSummaries(channel, blockStart, blockEnd - blockStart, ranges, blockSize); - for (size_t i = 0; i < ranges.size(); ++i) { + for (int i = 0; i < (int)ranges.size(); ++i) { if (first || ranges[i].min() < range.min()) range.setMin(ranges[i].min()); if (first || ranges[i].max() > range.max()) range.setMax(ranges[i].max()); if (first || ranges[i].absmean() < range.absmean()) range.setAbsmean(ranges[i].absmean()); @@ -614,7 +612,7 @@ WaveFileModel::fillTimerTimedOut() { if (m_fillThread) { - size_t fillExtent = m_fillThread->getFillExtent(); + int fillExtent = m_fillThread->getFillExtent(); #ifdef DEBUG_WAVE_FILE_MODEL SVDEBUG << "WaveFileModel::fillTimerTimedOut: extent = " << fillExtent << endl; #endif @@ -652,18 +650,18 @@ void WaveFileModel::RangeCacheFillThread::run() { - size_t cacheBlockSize[2]; + int cacheBlockSize[2]; cacheBlockSize[0] = (1 << m_model.m_zoomConstraint.getMinCachePower()); cacheBlockSize[1] = ((unsigned int)((1 << m_model.m_zoomConstraint.getMinCachePower()) * sqrt(2.) + 0.01)); - size_t frame = 0; + int frame = 0; int readBlockSize = 16384; SampleBlock block; if (!m_model.isOK()) return; - size_t channels = m_model.getChannelCount(); + int channels = m_model.getChannelCount(); bool updating = m_model.m_reader->isUpdating(); if (updating) { @@ -676,7 +674,7 @@ Range *range = new Range[2 * channels]; float *means = new float[2 * channels]; - size_t count[2]; + int count[2]; count[0] = count[1] = 0; for (int i = 0; i < 2 * channels; ++i) { means[i] = 0.f; @@ -703,7 +701,7 @@ for (int i = 0; i < readBlockSize; ++i) { - if (channels * i + channels > block.size()) break; + if (channels * i + channels > (int)block.size()) break; for (int ch = 0; ch < channels; ++ch) { @@ -727,12 +725,12 @@ QMutexLocker locker(&m_model.m_mutex); - for (size_t ct = 0; ct < 2; ++ct) { + for (int ct = 0; ct < 2; ++ct) { if (++count[ct] == cacheBlockSize[ct]) { - for (size_t ch = 0; ch < size_t(channels); ++ch) { - size_t rangeIndex = ch * 2 + ct; + for (int ch = 0; ch < int(channels); ++ch) { + int rangeIndex = ch * 2 + ct; means[rangeIndex] /= count[ct]; range[rangeIndex].setAbsmean(means[rangeIndex]); m_model.m_cache[ct].push_back(range[rangeIndex]); @@ -766,12 +764,12 @@ QMutexLocker locker(&m_model.m_mutex); - for (size_t ct = 0; ct < 2; ++ct) { + for (int ct = 0; ct < 2; ++ct) { if (count[ct] > 0) { - for (size_t ch = 0; ch < size_t(channels); ++ch) { - size_t rangeIndex = ch * 2 + ct; + for (int ch = 0; ch < int(channels); ++ch) { + int rangeIndex = ch * 2 + ct; means[rangeIndex] /= count[ct]; range[rangeIndex].setAbsmean(means[rangeIndex]); m_model.m_cache[ct].push_back(range[rangeIndex]); @@ -793,7 +791,7 @@ m_fillExtent = m_frameCount; #ifdef DEBUG_WAVE_FILE_MODEL - for (size_t ct = 0; ct < 2; ++ct) { + for (int ct = 0; ct < 2; ++ct) { cerr << "Cache type " << ct << " now contains " << m_model.m_cache[ct].size() << " ranges" << endl; } #endif diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/WaveFileModel.h --- a/data/model/WaveFileModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/WaveFileModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -34,7 +34,7 @@ Q_OBJECT public: - WaveFileModel(FileSource source, size_t targetRate = 0); + WaveFileModel(FileSource source, int targetRate = 0); WaveFileModel(FileSource source, AudioFileReader *reader); ~WaveFileModel(); @@ -43,10 +43,10 @@ const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; } - size_t getFrameCount() const; - size_t getChannelCount() const; - size_t getSampleRate() const; - size_t getNativeRate() const; + int getFrameCount() const; + int getChannelCount() const; + int getSampleRate() const; + int getNativeRate() const; QString getTitle() const; QString getMaker() const; @@ -57,28 +57,28 @@ float getValueMinimum() const { return -1.0f; } float getValueMaximum() const { return 1.0f; } - virtual size_t getStartFrame() const { return m_startFrame; } - virtual size_t getEndFrame() const { return m_startFrame + getFrameCount(); } + virtual int getStartFrame() const { return m_startFrame; } + virtual int getEndFrame() const { return m_startFrame + getFrameCount(); } - void setStartFrame(size_t startFrame) { m_startFrame = startFrame; } + void setStartFrame(int startFrame) { m_startFrame = startFrame; } - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, float *buffer) const; - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, double *buffer) const; - virtual size_t getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, + virtual int getData(int fromchannel, int tochannel, + int start, int count, float **buffers) const; - virtual size_t getSummaryBlockSize(size_t desired) const; + virtual int getSummaryBlockSize(int desired) const; - virtual void getSummaries(size_t channel, size_t start, size_t count, + virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, - size_t &blockSize) const; + int &blockSize) const; - virtual Range getSummary(size_t channel, size_t start, size_t count) const; + virtual Range getSummary(int channel, int start, int count) const; QString getTypeName() const { return tr("Wave File"); } @@ -100,13 +100,13 @@ m_model(model), m_fillExtent(0), m_frameCount(model.getFrameCount()) { } - size_t getFillExtent() const { return m_fillExtent; } + int getFillExtent() const { return m_fillExtent; } virtual void run(); protected: WaveFileModel &m_model; - size_t m_fillExtent; - size_t m_frameCount; + int m_fillExtent; + int m_frameCount; }; void fillCache(); @@ -116,19 +116,19 @@ AudioFileReader *m_reader; bool m_myReader; - size_t m_startFrame; + int m_startFrame; RangeBlock m_cache[2]; // interleaved at two base resolutions mutable QMutex m_mutex; RangeCacheFillThread *m_fillThread; QTimer *m_updateTimer; - size_t m_lastFillExtent; + int m_lastFillExtent; bool m_exiting; static PowerOfSqrtTwoZoomConstraint m_zoomConstraint; mutable SampleBlock m_directRead; - mutable size_t m_lastDirectReadStart; - mutable size_t m_lastDirectReadCount; + mutable int m_lastDirectReadStart; + mutable int m_lastDirectReadCount; mutable QMutex m_directReadMutex; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/WritableWaveFileModel.cpp --- a/data/model/WritableWaveFileModel.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/WritableWaveFileModel.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -30,8 +30,8 @@ //#define DEBUG_WRITABLE_WAVE_FILE_MODEL 1 -WritableWaveFileModel::WritableWaveFileModel(size_t sampleRate, - size_t channels, +WritableWaveFileModel::WritableWaveFileModel(int sampleRate, + int channels, QString path) : m_model(0), m_writer(0), @@ -86,8 +86,8 @@ m_model->setStartFrame(m_startFrame); connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); - connect(m_model, SIGNAL(modelChanged(size_t, size_t)), - this, SIGNAL(modelChanged(size_t, size_t))); + connect(m_model, SIGNAL(modelChanged(int, int)), + this, SIGNAL(modelChanged(int, int))); } WritableWaveFileModel::~WritableWaveFileModel() @@ -98,14 +98,14 @@ } void -WritableWaveFileModel::setStartFrame(size_t startFrame) +WritableWaveFileModel::setStartFrame(int startFrame) { m_startFrame = startFrame; if (m_model) m_model->setStartFrame(startFrame); } bool -WritableWaveFileModel::addSamples(float **samples, size_t count) +WritableWaveFileModel::addSamples(float **samples, int count) { if (!m_writer) return false; @@ -162,7 +162,7 @@ } } -size_t +int WritableWaveFileModel::getFrameCount() const { // SVDEBUG << "WritableWaveFileModel::getFrameCount: count = " << m_frameCount << endl; @@ -176,42 +176,42 @@ return 0; } -size_t -WritableWaveFileModel::getData(int channel, size_t start, size_t count, +int +WritableWaveFileModel::getData(int channel, int start, int count, float *buffer) const { if (!m_model || m_model->getChannelCount() == 0) return 0; return m_model->getData(channel, start, count, buffer); } -size_t -WritableWaveFileModel::getData(int channel, size_t start, size_t count, +int +WritableWaveFileModel::getData(int channel, int start, int count, double *buffer) const { if (!m_model || m_model->getChannelCount() == 0) return 0; return m_model->getData(channel, start, count, buffer); } -size_t -WritableWaveFileModel::getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, +int +WritableWaveFileModel::getData(int fromchannel, int tochannel, + int start, int count, float **buffers) const { if (!m_model || m_model->getChannelCount() == 0) return 0; return m_model->getData(fromchannel, tochannel, start, count, buffers); } -size_t -WritableWaveFileModel::getSummaryBlockSize(size_t desired) const +int +WritableWaveFileModel::getSummaryBlockSize(int desired) const { if (!m_model) return desired; return m_model->getSummaryBlockSize(desired); } void -WritableWaveFileModel::getSummaries(size_t channel, size_t start, size_t count, +WritableWaveFileModel::getSummaries(int channel, int start, int count, RangeBlock &ranges, - size_t &blockSize) const + int &blockSize) const { ranges.clear(); if (!m_model || m_model->getChannelCount() == 0) return; @@ -219,7 +219,7 @@ } WritableWaveFileModel::Range -WritableWaveFileModel::getSummary(size_t channel, size_t start, size_t count) const +WritableWaveFileModel::getSummary(int channel, int start, int count) const { if (!m_model || m_model->getChannelCount() == 0) return Range(); return m_model->getSummary(channel, start, count); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/model/WritableWaveFileModel.h --- a/data/model/WritableWaveFileModel.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/model/WritableWaveFileModel.h Tue Jun 17 14:33:42 2014 +0100 @@ -26,7 +26,7 @@ Q_OBJECT public: - WritableWaveFileModel(size_t sampleRate, size_t channels, QString path = ""); + WritableWaveFileModel(int sampleRate, int channels, QString path = ""); ~WritableWaveFileModel(); /** @@ -35,7 +35,7 @@ * progress of this file, if it has a known end point, and should * call setCompletion(100) when the file has been written. */ - virtual bool addSamples(float **samples, size_t count); + virtual bool addSamples(float **samples, int count); bool isOK() const; bool isReady(int *) const; @@ -48,36 +48,36 @@ return &zc; } - size_t getFrameCount() const; - size_t getChannelCount() const { return m_channels; } - size_t getSampleRate() const { return m_sampleRate; } + int getFrameCount() const; + int getChannelCount() const { return m_channels; } + int getSampleRate() const { return m_sampleRate; } virtual Model *clone() const; float getValueMinimum() const { return -1.0f; } float getValueMaximum() const { return 1.0f; } - virtual size_t getStartFrame() const { return m_startFrame; } - virtual size_t getEndFrame() const { return m_startFrame + getFrameCount(); } + virtual int getStartFrame() const { return m_startFrame; } + virtual int getEndFrame() const { return m_startFrame + getFrameCount(); } - void setStartFrame(size_t startFrame); + void setStartFrame(int startFrame); - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, float *buffer) const; - virtual size_t getData(int channel, size_t start, size_t count, + virtual int getData(int channel, int start, int count, double *buffer) const; - virtual size_t getData(size_t fromchannel, size_t tochannel, - size_t start, size_t count, + virtual int getData(int fromchannel, int tochannel, + int start, int count, float **buffer) const; - virtual size_t getSummaryBlockSize(size_t desired) const; + virtual int getSummaryBlockSize(int desired) const; - virtual void getSummaries(size_t channel, size_t start, size_t count, - RangeBlock &ranges, size_t &blockSize) const; + virtual void getSummaries(int channel, int start, int count, + RangeBlock &ranges, int &blockSize) const; - virtual Range getSummary(size_t channel, size_t start, size_t count) const; + virtual Range getSummary(int channel, int start, int count) const; QString getTypeName() const { return tr("Writable Wave File"); } @@ -89,10 +89,10 @@ WaveFileModel *m_model; WavFileWriter *m_writer; WavFileReader *m_reader; - size_t m_sampleRate; - size_t m_channels; - size_t m_frameCount; - size_t m_startFrame; + int m_sampleRate; + int m_channels; + int m_frameCount; + int m_startFrame; int m_completion; }; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/osc/OSCMessage.cpp --- a/data/osc/OSCMessage.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/osc/OSCMessage.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -38,14 +38,14 @@ m_args.push_back(arg); } -size_t +int OSCMessage::getArgCount() const { return m_args.size(); } const QVariant & -OSCMessage::getArg(size_t i) const +OSCMessage::getArg(int i) const { return m_args[i]; } diff -r 6a94bb528e9d -r 59e7fe1b1003 data/osc/OSCMessage.h --- a/data/osc/OSCMessage.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/osc/OSCMessage.h Tue Jun 17 14:33:42 2014 +0100 @@ -47,8 +47,8 @@ void clearArgs(); void addArg(QVariant arg); - size_t getArgCount() const; - const QVariant &getArg(size_t i) const; + int getArgCount() const; + const QVariant &getArg(int i) const; private: int m_target; diff -r 6a94bb528e9d -r 59e7fe1b1003 data/osc/OSCQueue.cpp --- a/data/osc/OSCQueue.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/data/osc/OSCQueue.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -142,7 +142,7 @@ return url; } -size_t +int OSCQueue::getMessagesAvailable() const { return m_buffer.getReadSpace(); diff -r 6a94bb528e9d -r 59e7fe1b1003 data/osc/OSCQueue.h --- a/data/osc/OSCQueue.h Tue Jun 17 13:52:07 2014 +0100 +++ b/data/osc/OSCQueue.h Tue Jun 17 14:33:42 2014 +0100 @@ -42,7 +42,7 @@ bool isOK() const; bool isEmpty() const { return getMessagesAvailable() == 0; } - size_t getMessagesAvailable() const; + int getMessagesAvailable() const; OSCMessage readMessage(); QString getOSCURL() const; diff -r 6a94bb528e9d -r 59e7fe1b1003 plugin/DSSIPluginFactory.cpp --- a/plugin/DSSIPluginFactory.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/plugin/DSSIPluginFactory.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -281,7 +281,7 @@ void -DSSIPluginFactory::discoverPlugins(QString soname) +DSSIPluginFactory::discoverPluginsFrom(QString soname) { Profiler profiler("DSSIPluginFactory::discoverPlugins"); diff -r 6a94bb528e9d -r 59e7fe1b1003 plugin/DSSIPluginFactory.h --- a/plugin/DSSIPluginFactory.h Tue Jun 17 13:52:07 2014 +0100 +++ b/plugin/DSSIPluginFactory.h Tue Jun 17 14:33:42 2014 +0100 @@ -52,7 +52,7 @@ virtual std::vector getLRDFPath(QString &baseUri); - virtual void discoverPlugins(QString soName); + virtual void discoverPluginsFrom(QString soName); virtual const LADSPA_Descriptor *getLADSPADescriptor(QString identifier); virtual const DSSI_Descriptor *getDSSIDescriptor(QString identifier); diff -r 6a94bb528e9d -r 59e7fe1b1003 plugin/LADSPAPluginFactory.cpp --- a/plugin/LADSPAPluginFactory.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/plugin/LADSPAPluginFactory.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -672,13 +672,13 @@ QDir pluginDir(*i, PLUGIN_GLOB); for (unsigned int j = 0; j < pluginDir.count(); ++j) { - discoverPlugins(QString("%1/%2").arg(*i).arg(pluginDir[j])); + discoverPluginsFrom(QString("%1/%2").arg(*i).arg(pluginDir[j])); } } } void -LADSPAPluginFactory::discoverPlugins(QString soname) +LADSPAPluginFactory::discoverPluginsFrom(QString soname) { void *libraryHandle = DLOPEN(soname, RTLD_LAZY); diff -r 6a94bb528e9d -r 59e7fe1b1003 plugin/LADSPAPluginFactory.h --- a/plugin/LADSPAPluginFactory.h Tue Jun 17 13:52:07 2014 +0100 +++ b/plugin/LADSPAPluginFactory.h Tue Jun 17 14:33:42 2014 +0100 @@ -67,7 +67,7 @@ virtual std::vector getLRDFPath(QString &baseUri); - virtual void discoverPlugins(QString soName); + virtual void discoverPluginsFrom(QString soName); virtual void generateTaxonomy(QString uri, QString base); virtual void generateFallbackCategories(); diff -r 6a94bb528e9d -r 59e7fe1b1003 plugin/PluginXml.cpp --- a/plugin/PluginXml.cpp Tue Jun 17 13:52:07 2014 +0100 +++ b/plugin/PluginXml.cpp Tue Jun 17 14:33:42 2014 +0100 @@ -214,7 +214,7 @@ QDomNamedNodeMap attrNodes = pluginElt.attributes(); QXmlAttributes attrs; - for (unsigned int i = 0; i < attrNodes.length(); ++i) { + for (int i = 0; i < attrNodes.length(); ++i) { QDomAttr attr = attrNodes.item(i).toAttr(); if (attr.isNull()) continue; // SVDEBUG << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name()// << "\" with value \"" << attr.value() << "\"" << endl;