From f3d875e288255dde5e9e330e2c2939d2e7e2f72c Mon Sep 17 00:00:00 2001 From: sinamas Date: Tue, 10 Jul 2012 22:54:03 +0000 Subject: [PATCH] index resamplers with size_t rather than unsigned int. git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@322 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24 --- common/resample/resamplerinfo.h | 6 +++--- common/resample/src/resamplerinfo.cpp | 2 +- gambatte_qt/src/framework/src/mediawidget.h | 2 +- gambatte_qt/src/framework/src/mediaworker.cpp | 14 +++++++------- gambatte_qt/src/framework/src/mediaworker.h | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/resample/resamplerinfo.h b/common/resample/resamplerinfo.h index 294034ac..bfeead18 100644 --- a/common/resample/resamplerinfo.h +++ b/common/resample/resamplerinfo.h @@ -39,14 +39,14 @@ struct ResamplerInfo { Resampler* (*create)(long inRate, long outRate, std::size_t periodSz); /** Returns the number of ResamplerInfos that can be gotten with get(). */ - static unsigned num() { return num_; } + static std::size_t num() { return num_; } /** Returns ResamplerInfo number n. Where n is less than num(). */ - static const ResamplerInfo& get(unsigned n) { return resamplers[n]; } + static const ResamplerInfo& get(std::size_t n) { return resamplers[n]; } private: static const ResamplerInfo resamplers[]; - static const unsigned num_; + static const std::size_t num_; }; #endif diff --git a/common/resample/src/resamplerinfo.cpp b/common/resample/src/resamplerinfo.cpp index 27fb26f8..df3311d5 100644 --- a/common/resample/src/resamplerinfo.cpp +++ b/common/resample/src/resamplerinfo.cpp @@ -47,4 +47,4 @@ const ResamplerInfo ResamplerInfo::resamplers[] = { { "Highest quality (CIC + sinc chain)", ChainSincInfo::create } }; -const unsigned ResamplerInfo::num_ = sizeof(ResamplerInfo::resamplers) / sizeof(ResamplerInfo); +const std::size_t ResamplerInfo::num_ = sizeof ResamplerInfo::resamplers / sizeof *ResamplerInfo::resamplers; diff --git a/gambatte_qt/src/framework/src/mediawidget.h b/gambatte_qt/src/framework/src/mediawidget.h index d3582cd0..f2fc1018 100644 --- a/gambatte_qt/src/framework/src/mediawidget.h +++ b/gambatte_qt/src/framework/src/mediawidget.h @@ -187,7 +187,7 @@ public: const ConstAudioEngineConf audioEngineConf(std::size_t aeNo) const { return ConstAudioEngineConf(audioEngines[aeNo]); } std::size_t numAudioEngines() const { return audioEngines.size(); } - void setAudioOut(std::size_t engineNo, unsigned srateHz, unsigned msecLatency, unsigned resamplerNo) { + void setAudioOut(std::size_t engineNo, unsigned srateHz, unsigned msecLatency, std::size_t resamplerNo) { worker->setAudioOut(audioEngines[engineNo], srateHz, msecLatency, resamplerNo); } diff --git a/gambatte_qt/src/framework/src/mediaworker.cpp b/gambatte_qt/src/framework/src/mediaworker.cpp index 07685dc9..fecbe5a2 100755 --- a/gambatte_qt/src/framework/src/mediaworker.cpp +++ b/gambatte_qt/src/framework/src/mediaworker.cpp @@ -50,16 +50,16 @@ void MediaWorker::MeanQueue::push(const long i) { class MediaWorker::AudioOut : Uncopyable { AudioEngine &ae_; + const std::size_t resamplerNo_; const long rate_; const unsigned latency_; - const unsigned resamplerNo_; long estrate_; bool inited_; public: - AudioOut(AudioEngine &ae, long rate, unsigned latency, unsigned resamplerNo) - : ae_(ae), rate_(rate), latency_(latency), resamplerNo_(resamplerNo), estrate_(rate), inited_(false) + AudioOut(AudioEngine &ae, long rate, unsigned latency, std::size_t resamplerNo) + : ae_(ae), resamplerNo_(resamplerNo), rate_(rate), latency_(latency), estrate_(rate), inited_(false) { } @@ -88,7 +88,7 @@ public: bool flushPausedBuffers() const { return ae_.flushPausedBuffers(); } long rate() const { return ae_.rate() > 0 ? ae_.rate() : rate_; } long estimatedRate() const { return estrate_; } - unsigned resamplerNo() const { return resamplerNo_; } + std::size_t resamplerNo() const { return resamplerNo_; } bool initialized() const { return inited_; } bool successfullyInitialized() const { return inited_ && ae_.rate() > 0; } @@ -132,7 +132,7 @@ void MediaWorker::PauseVar::waitWhilePaused(MediaWorker::Callback *const cb, Aud } MediaWorker::MediaWorker(MediaSource *source, AudioEngine *ae, int aerate, - int aelatency, unsigned resamplerNo, std::auto_ptr callback, QObject *parent) + int aelatency, std::size_t resamplerNo, std::auto_ptr callback, QObject *parent) : QThread(parent), callback(callback), meanQueue(0, 0), @@ -198,7 +198,7 @@ void MediaWorker::resetAudio() { } struct MediaWorker::SetAudioOut { - MediaWorker &w; AudioEngine *const ae; const int rate; const int latency; const unsigned resamplerNo; + MediaWorker &w; AudioEngine *const ae; const int rate; const int latency; const std::size_t resamplerNo; void operator()() const { const bool inited = w.ao_->initialized(); @@ -210,7 +210,7 @@ struct MediaWorker::SetAudioOut { } }; -void MediaWorker::setAudioOut(AudioEngine *newAe, int rate, int latency, unsigned resamplerNo) { +void MediaWorker::setAudioOut(AudioEngine *newAe, int rate, int latency, std::size_t resamplerNo) { const SetAudioOut setAudioOutStruct = { *this, newAe, rate, latency, resamplerNo }; pushCall(setAudioOutStruct); } diff --git a/gambatte_qt/src/framework/src/mediaworker.h b/gambatte_qt/src/framework/src/mediaworker.h index a725c1e4..444e0251 100755 --- a/gambatte_qt/src/framework/src/mediaworker.h +++ b/gambatte_qt/src/framework/src/mediaworker.h @@ -139,7 +139,7 @@ protected: public: MediaWorker(MediaSource *source, class AudioEngine *ae, int aerate, int aelatency, - unsigned resamplerNo, std::auto_ptr callback, QObject *parent = 0); + std::size_t resamplerNo, std::auto_ptr callback, QObject *parent = 0); MediaSource* source() /*const */{ return sampleBuffer.source(); } SyncVar& waitingForSync() /*const */{ return waitingForSync_; } void start(); @@ -152,7 +152,7 @@ public: bool paused() const { return pauseVar.waitingForUnpause(); } void resetAudio(); - void setAudioOut(class AudioEngine *newAe, int rate, int latency, unsigned resamplerNo); + void setAudioOut(class AudioEngine *newAe, int rate, int latency, std::size_t resamplerNo); void setFrameTime(Rational ft); void setSamplesPerFrame(Rational spf);