refactoring.

git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@267 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
sinamas 2011-09-15 22:21:40 +00:00
parent af220500e7
commit 1bcfec5a76
4 changed files with 7 additions and 5 deletions

View File

@ -50,7 +50,9 @@ public:
virtual long rateEstimate() const { return rate_; }
virtual const BufferState bufferState() const { static const BufferState s = { BufferState::NOT_SUPPORTED, BufferState::NOT_SUPPORTED }; return s; }
virtual void pause() {}
virtual bool drainsBuffersWhenPaused() const { return false; }
/** @return success */
virtual bool flushPausedBuffers() const { return false; }
virtual int write(void *buffer, unsigned samples, BufferState &preBufState_out, long &rate_out) {
preBufState_out = bufferState();

View File

@ -44,7 +44,7 @@ public:
long rateEstimate() const { return est.result(); }
const BufferState bufferState() const;
void pause() { prevfur = 0; est.reset(); }
bool drainsBuffersWhenPaused() const { return true; }
bool flushPausedBuffers() const { return true; }
QWidget* settingsWidget() const { return conf.settingsWidget(); }
void rejectSettings() const { conf.rejectSettings(); }
};

View File

@ -44,7 +44,7 @@ public:
long rateEstimate() const { return est.result(); }
const BufferState bufferState() const;
void pause() { prevbytes = 0; est.reset(); }
bool drainsBuffersWhenPaused() const { return true; }
bool flushPausedBuffers() const { return true; }
QWidget* settingsWidget() const { return conf.settingsWidget(); }
void rejectSettings() const { conf.rejectSettings(); }
};

View File

@ -84,7 +84,7 @@ public:
ae_.pause();
}
bool drainsBuffersWhenPaused() const { return ae_.drainsBuffersWhenPaused(); }
bool flushPausedBuffers() const { return ae_.flushPausedBuffers(); }
long rate() const { return ae_.rate() > 0 ? ae_.rate() : rate_; }
long estimatedRate() const { return estrate_; }
bool initialized() const { return inited_; }
@ -183,7 +183,7 @@ struct MediaWorker::ResetAudio {
MediaWorker &w;
void operator()() const {
if (w.ao_->initialized() && !w.ao_->drainsBuffersWhenPaused()) {
if (w.ao_->initialized() && !w.ao_->flushPausedBuffers()) {
w.ao_->uninit();
w.initAudioEngine();
}