183 Commits

Author SHA1 Message Date
sinamas
0bda30dc27 Adjustable base frame rate.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@250 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-03 23:52:46 +00:00
sinamas
0e8ae6a18c refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@249 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-01 21:28:14 +00:00
sinamas
84e9d3820a Increase start threashold to full buffer. Block rate estimation when pcm not in running state. Default custom device plughw rather than hw.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@248 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-01 21:27:24 +00:00
sinamas
b3446fd934 - one more decimal position in refresh rate representation.
- use xrandr screen names
- hide empty full mode comboboxes
- windowed resolution -> window size
- lots of refactoring.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@247 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-01 06:01:08 +00:00
sinamas
05a8259f4d - Get rid of potential double free of unusable blitter.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@242 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-04-01 21:40:00 +00:00
sinamas
cec6c4288a - ignore() keyPress/keyRelease events so that global keys still function.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@241 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-04-01 19:23:35 +00:00
sinamas
82459cf24d - Document libgambatte better.
- Document resampling framework better.
- Use a single constant for setting number of resampler channels rather 
than two.
- thread-safety -> thread safety


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@239 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-04 00:14:08 +00:00
sinamas
3345e8ef21 - Move uncopyable.h to common.
- ScalingMethod header.
- length of video frame -> duration of video frame.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@238 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-03 20:00:38 +00:00
sinamas
94c1bbda43 - Document Qt media framework better.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@237 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-03 18:00:19 +00:00
sinamas
629b35a30c - Move resample files around to separate interface files from
implementation files.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@236 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 23:09:04 +00:00
sinamas
c083a4ef57 - Move Qt media framework files around to separate interface from
implementation somewhat.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@235 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 22:47:39 +00:00
sinamas
470b627fa8 - Redesign Qt multimedia framework to use a worker thread for MediaSource updates. This was a ton of work, but should make underruns a lot less likely. The majority of
underruns are caused by video I/O blocking (even when not syncing to vblank). It also means that vsync blocking is a non-issue. Lots of thread-safety considerations had to 
be done. Lots of tools developed to deal with new problems. Things redesigned to be asynchronous to avoid blocking the worker thread. New interfaces developed to give 
clients access to these things without too much pain, as clients need to deal with thread-safety issues, and be able to do things asynchronously to avoid blocking and 
unnecessary synchronization. Things developed and then scrapped as I changed my mind. Lots of thinking and testing to ensure video smoothness.
- Make configuration of the multimedia framework way more flexible, by adding methods for configuring video and sound, rather than forcing the use of the SoundDialog or 
VideoDialog. Thus clients can make their own GUI for such things.
- Pass raw input events to MediaSources so that clients will not have to use the InputDialog with its Button system.
- Split BlitterWidget blitting into three methods: blit, draw, and sync, such that blitting is supposedly a fast pixel copy or buffer swap, while draw prepares for 
presentation, and sync presents the completed video frame ASAP. Blit needs to be fast to avoid blocking the worker thread to avoid underruns.
- Allow heavy MediaSource video work to be skipped when frames are skipped.
- Do some work in parallel on SMP systems.
- Adjust low audio buffer detection to make it more robust.
- Move variance calculation to the user of estimations, because the variance calculated by estimators is not well defined anyway.
- Add support for adjustable fast-forward speed.
- Fast-forward now outputs audio, by skipping entire segments of audio when skipping frames.
- Adjust blitters to conform to the new threaded model.
- Direct3DBlitter: Apparently vertices point to the center of pixels. Subtract 0.5 from vertex coordinates.
- DirectDrawBlitter: Sleep more when far from vblank.
- QGLBlitter: Get rid of makeCurrent calls, because they apparently block and can be slow and don't seem to be needed anyway. They also seem to cause instability with some 
drivers.
- XvBlitter: Double buffer to delay updates to sync time.
- X11Blitter: Double buffer when not scaling to delay updates to sync time.
- QPainterBlitter: Double buffer when not scaling to delay updates to sync time.
- SdlBlitter: Delay updates to sync time.
- AlsaEngine: Set max periods to 16 to work around stupid ALSA plugins and drivers that advertise smaller period sizes than properly supported. ALSA always picks the 
maximum number of periods allowed, which means it picks the smallest period size allowed for a given buffer size.
- QPainterBlitter: Don't disable updates when not paused, because this breaks macx.
- Support pause on focus out.
- Add MiscDialog to allow user configuration of fast-forward speed and focus policy.
- Separate sync to refresh rate logic from sync to vblank logic.
- Sync to refresh rate menu option.
- Use semi-bilinear filtering rather than bilinear filtering for soft-scaling blitters.
- MakeSincKernel: Consider rounding effects when computing absolute gain.
- MakeSincKernel: Use a function pointer rather than a template argument to reduce code bloat.
- Reorder sinc kernel phases.
- PolyPhaseConvoluter: Simplify some calculations.
- Replace Hamming and Blackman windowed sincs with Kaiser windowed sinc of appropriate betas, because they require a lower number of taps to achieve the same specs.
- Use rounding shifts in resamplers for higher precision and performance.
- libgambatte: Update returns on video frame completion rather than using a callback for notification.
- libgambatte: Move video filters and color conversion out of the library.
- libgambatte: Get rid of unnecessarily complex VideoBlitter interface.
- libgambatte: Use bit flags rather bools for input state.
- Change some parameters to constants in 2xsai and hqx video filters.
- Probably other stuff I've forgotten about.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@234 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 21:30:46 +00:00
sinamas
523ae5ed40 - swscale.h: Add semiLinear scaler, which is almost as sharp and fast as nearestNeighbor for large scales, yet reduces aliasing like the linear scaler.
- swscale.h: Center nearest neighbor bias.
- swscale.h: Optimize a bit more.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@233 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-07-18 23:04:06 +00:00
sinamas
ad9455f9ff - ossengine: Reduce number of requested fragments again slightly to 6, because OSSv4 has a default minimum fragment size of about 10 ms causing excessive minimum latency.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@232 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-07-11 00:09:23 +00:00
sinamas
f267e2a5cd - ossengine: Fix horribly broken rate estimation on OSS4 (and possibly other implementations) by using GETOPTR rather than GETOSPACE.
- ossengine: Increase number of fragments requested from 4 to 8 for more accurate OSPACE/OPTR information with OSS4 (and possibly other implementations).
- ossengine: Minor include corrections and namespace fixes. Use log(x)/log(2) rather than non-c++98 log2. Minor rounding fix in fragment size calculation.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@231 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-07-10 04:13:48 +00:00
sinamas
2ca5d845b2 AlsaEngine: Set start threshold to half the buffer size, to avoid (possibly infinite) repeated xruns due to ALSA's default threshold of 1 frame.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@230 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-07-08 18:18:32 +00:00
sinamas
0d83920ade - Use RGBA internal texture format, as it usually means less conversion.
- Get rid of pointless initialization of OpenGL state that is equal to 
the default, or otherwise meaningless. Enable GL_CULL_FACE in case it's 
slightly faster in some configurations.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@229 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-05-07 17:16:22 +00:00
sinamas
f6e052b7fb - Esc exits fullscreen on macx.
- Drop OpenAL from default macx binary.
- Add some useful but commented build flags for macx to .pro files.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@224 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-10 21:52:05 +00:00
sinamas
323dd056df - AlsaEngine: Make use of sample period limit feature of RateEst. Don't
increase estimated sample rate on underrun.
- OssEngine: Make use of sample period limit feature of RateEst. Don't
  increase estimated sample rate on underrun.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@222 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-10 04:20:23 +00:00
sinamas
6bf00db2ac - XvBlitter: Set NosystemBackground attribute rather than
OpaquePaintEvent. Reimplement paintEngine to return NULL.
- X11Blitter: Reimplement paintEngine to return NULL.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@221 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-10 04:19:12 +00:00
sinamas
7ec341818a - DirectSoundEngine: Provide the integrated read and status get write method optimization.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@220 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 23:00:31 +00:00
sinamas
1e4fe51206 - WasapiEngine: Use default device if there's only one device available, since we don't show the combobox anyway.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@219 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 21:49:18 +00:00
sinamas
0bafc3004d - WasapiEngine: Add device selection.
- WasapiEngine: Add static isUsable() method. Only listed if isUsable(). Default engine if isUsable().


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@218 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 08:00:18 +00:00
sinamas
4b4d05e309 - Add basic WASAPI engine with exclusive mode support. Latency and rate estimation is generally better than DirectSound, and
in exclusive mode there is less blocking as well as exclusive mode being better than shared mode in the other areas too.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@217 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 04:02:29 +00:00
sinamas
b3203b984b - DirectSoundEngine: Make use of the sample period limit feature of RateEst, rather than duplicating the feature.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@216 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 03:57:16 +00:00
sinamas
d9edc2e78d - Direct3DBlitter and DirectDrawBlitter: Force blocking updates when sync to vblank is enabled.
Some updates only block if there's a prior unfinished update in progress. This screws up frame time estimation
  in turn screwing up vsync. To fix this we do a double update (and extra blit) if close to a frame time
  period has passed since the last update when sync to vblank is enabled. I really should have noticed this earlier
  as it pretty much breaks vsync adaption completely.
- Direct3DBlitter: Use the D3DCREATE_FPU_PRESERVE flag when creating device. Omitting this flag can screw up floating point
  calculations in other parts of the code. For instance WASAPI cursor timestamps get utterly screwed up here.
- Direct3DBlitter: It appears that managed textures are updated before they are unlocked, which screws up redraws, making
  things appear choppy in some situations. Use a default memory texture and a system memory texture and the UpdateTexure
  method instead.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@214 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-09 01:59:53 +00:00
sinamas
e3f1d0ecb1 Replace "Game Boy / Game Boy Color emulator" with "Game Boy Color emulator" for now to avoid misleading anyone on the current status.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@213 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-06 04:23:55 +00:00
sinamas
0b9dbbcf94 Rewrite most of DirectSoundEngine, supporting primary buffer option, making it more robust, correct and hopefully cleaner.
Only use part of the primary buffer if the desired buffer size is lower than the primary buffer size.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@212 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-06 03:07:20 +00:00
sinamas
3e64d3902b Use wildcards for platform detection to avoid being unnecessarily compiler/architecture specific. Fixes bug 2377772.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@211 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-04 17:01:34 +00:00
sinamas
3305a5ad2f Pause audio on win32 titlebar clicks/drags to avoid looping audio due to underruns from blocked timerEvents.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@210 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-01 15:19:03 +00:00
sinamas
10bcbfbcd0 - DirectDrawBlitter: Add triple buffering option.
- Direct3DBlitter: Use D3DSWAPEFFECT_DISCARD in non-exclusive mode.
- Direct3DBlitter: Allow triple buffering and vblank-only updates in non-excusive mode.
- Rename "Page flipping" in Direct3D and DirectDraw blitters to "Exclusive full screen".


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@209 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-01 04:21:03 +00:00
sinamas
beb4f51f5f - Adaptively skip BlitterWidget syncs if audio buffer is low, in a manner that should minimize wasted skips in sync to vblank situation, and tries to be non-disturbing. This replaces frame time halving, and blitter specific rescueing.
- Clear display buffers in DirectDrawBlitter and Direct3DBlitter in exclusive mode, since blits don't necessarily cover the entire buffers.
- DirectDrawBlitter: Make sure that a minimum amount of time has passed between calls to WaitForVerticalBlank, since it can return in the same vblank period twice on a fast system.
- DirectDrawBlitter: Support vsync for refresh rate ~= 2x frame rate
- DirectDrawBlitter: Refactor somewhat and get rid of a couple minor potential bugs.
- DirectDrawBlitter: Some tweaks to get updates closer to sync time in certain situations.
- DirectDrawBlitter: Some tweaks to better support DO_NOT_WAIT.
- DirectDrawBlitter: Make only updating during vblank while page flipping optional.
- Direct3DBlitter: Some tweaks to get updates closer to sync time in certain situations.
- Filter out very short frame times in frame time estimation.
- Don't adjust frame time during turbo, but rather skip BlitterWidget syncs to speed up, which avoids vsync limits without disabling vsync.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@208 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-31 06:10:38 +00:00
sinamas
0a952e7c48 Up default audio buffer latency to 100 ms (some common system audio servers require a lot of buffering to work well).
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@207 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-26 17:56:19 +00:00
sinamas
d7203ffd32 QGLBlitter: Do a cheap front blit rather than a vsynced flip if audio buffers are low.
Allow BlitterWidgets to opt in to get paintEvents while unpaused. Do so for QGLBlitter since it may need to clear buffers afterwards.
QGLBlitter: Try to blit right after sync in the case of single buffering.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@206 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-26 17:50:13 +00:00
sinamas
6056b96c0e Disable BlitterWidget updates (paintEvents) while not paused.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@205 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-26 02:32:43 +00:00
sinamas
9932b1f4ac Substantially improved rate estimation averaging.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@204 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-12-25 23:45:53 +00:00
sinamas
4e44f80818 silly ifdef typo
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@201 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-27 23:41:57 +00:00
sinamas
d34af28a8c work around annoying random non-updating OpenGL on Mac OS X after full screen.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@199 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-27 19:53:21 +00:00
sinamas
498c85f467 Add "force DMG mode" option.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@188 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 05:09:37 +00:00
sinamas
afb6721583 Update SDL_Joystick to SDL-1.2 SVN. #undef UNICODE in win32/SDL_mmjoystick.c to avoid joystick name mangling.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@187 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 04:04:12 +00:00
sinamas
363c886f85 Fix CoreAudio engine reporting buffer status in samples rather than frames.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@186 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 03:02:32 +00:00
sinamas
9feeeed04d - Add CoreAudio engine with rate estimation and buffer status support. Default engine on Mac OS X.
- 44100 Hz default sample rate on OS X, since OS X tends to resample everything to 44100 Hz.
- Get rid of buffer status averaging in OpenAlEngine, since it makes assumptions on usage pattern that shouldn't be made.
- Extend ringbuffer.h to support resetting size, and move it to common dir since gambatte_qt/coreaudioengine uses it too now.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@185 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 02:51:13 +00:00
sinamas
bc437e4079 Use RateEst.reset rather than re-initing on pause.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@184 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-19 20:58:05 +00:00
sinamas
11545e9b0e Don't duplicate blitter pointer in mainwindow.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@183 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-19 20:55:16 +00:00
sinamas
e42aa432d2 Fractional bits for intermediate rate estimation averages.
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
2008-10-19 20:24:27 +00:00
sinamas
7568a3a45d use crtc mode dimensions rather than crtc dimensions when discarding modes since crtc dimensions may be rotated
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@181 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-17 07:46:44 +00:00
sinamas
561c25e522 Add support for XRandR 1.2 multi-head
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@180 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-17 07:08:05 +00:00
sinamas
ae365541fc postpone buffered x11 blits to after sync.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@179 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-16 21:31:46 +00:00
sinamas
e961397fef Move Qt media framework to a separate subdir
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@177 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-16 20:41:51 +00:00
sinamas
21a5062e7d Don't bother allowing sources the choice of which output sample rates are selecrable,
as it's not really a per source thing at this point. If resampling avoidance is desired, then that
should rather be a user option (to depend on the OS for resampling, which is mostly nonsensical for the Game Boy/NES/PSG-system case btw).


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@176 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-16 17:17:30 +00:00