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
This commit is contained in:
sinamas 2012-07-10 22:54:03 +00:00
parent 09b949005d
commit f3d875e288
5 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -47,4 +47,4 @@ const ResamplerInfo ResamplerInfo::resamplers[] = {
{ "Highest quality (CIC + sinc chain)", ChainSincInfo<Kaiser70Sinc>::create }
};
const unsigned ResamplerInfo::num_ = sizeof(ResamplerInfo::resamplers) / sizeof(ResamplerInfo);
const std::size_t ResamplerInfo::num_ = sizeof ResamplerInfo::resamplers / sizeof *ResamplerInfo::resamplers;

View File

@ -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);
}

View File

@ -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> callback, QObject *parent)
int aelatency, std::size_t resamplerNo, std::auto_ptr<Callback> 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);
}

View File

@ -139,7 +139,7 @@ protected:
public:
MediaWorker(MediaSource *source, class AudioEngine *ae, int aerate, int aelatency,
unsigned resamplerNo, std::auto_ptr<Callback> callback, QObject *parent = 0);
std::size_t resamplerNo, std::auto_ptr<Callback> 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);