mirror of
https://github.com/libretro/gambatte-libretro.git
synced 2024-11-23 16:00:06 +00:00
a5f83a3719
Add RateEst reset method. Initialize RateEst count to 1. Less refresh rate estimation averaging. Allow more refresh rate estimation deviation. Return NULL paintEngine in windows blitters that use the PaintToScreen attribute. Add checks for things not being initialized in DirectDraw-blitter and QPainterBlitter paintEvents. Don't reparent blitters (mainly to make a bug in Qt 4.4.3 win less annoying, widgets that do internal reparenting are still affected). Check for window position less than screen top-left after mode change, before full screen, to avoid Qt moving it to the primary screen. Add rate estimation to DirectSound engine. Better underrun detection in DirectSound engine. git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@182 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
52 lines
2.0 KiB
C++
52 lines
2.0 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2008 by Sindre Aamås *
|
|
* aamas@stud.ntnu.no *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License version 2 as *
|
|
* published by the Free Software Foundation. *
|
|
* *
|
|
* This program is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU General Public License version 2 for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU General Public License *
|
|
* version 2 along with this program; if not, write to the *
|
|
* Free Software Foundation, Inc., *
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
***************************************************************************/
|
|
#ifndef RATEEST_H
|
|
#define RATEEST_H
|
|
|
|
#include "usec.h"
|
|
|
|
class RateEst {
|
|
public:
|
|
struct Result {
|
|
long est;
|
|
long var;
|
|
};
|
|
|
|
private:
|
|
enum { UPSHIFT = 5 };
|
|
enum { UP = 1 << UPSHIFT };
|
|
|
|
Result srate;
|
|
usec_t last;
|
|
long reference;
|
|
long samples;
|
|
unsigned count;
|
|
|
|
public:
|
|
RateEst(long srate = 0) { init(srate); }
|
|
RateEst(long srate, long reference) { init(srate, reference); }
|
|
void init(long srate) { init(srate, srate); }
|
|
void init(long srate, long reference);
|
|
void reset() { count = 1; last = 0; }
|
|
void feed(long samples);
|
|
const Result result() const { const Result res = { (srate.est + UP / 2) >> UPSHIFT, (srate.var + UP / 2) >> UPSHIFT }; return res; }
|
|
};
|
|
|
|
#endif
|