[Scummvm-cvs-logs] CVS: scummvm/backends/wince wince-sdl.cpp,1.1,1.2 wince-sdl.h,1.1,1.2
Nicolas Bacca
arisme at users.sourceforge.net
Mon Jan 26 14:44:29 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: tools md5.txt,1.13,1.14
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/insane insane.cpp,1.8,1.9 insane.h,1.5,1.6 insane_iact.cpp,1.6,1.7 insane_scenes.cpp,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11425
Modified Files:
wince-sdl.cpp wince-sdl.h
Log Message:
Fix Ogg Vorbis, Zak and low sample rate
Index: wince-sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- wince-sdl.cpp 26 Jan 2004 08:20:26 -0000 1.1
+++ wince-sdl.cpp 26 Jan 2004 22:38:07 -0000 1.2
@@ -42,6 +42,9 @@
#include "sound/fmopl.h"
+#ifdef USE_VORBIS
+#include <vorbis/vorbisfile.h>
+#endif
using namespace CEGUI;
@@ -81,6 +84,7 @@
// ********************************************************************************************
void drawError(char *error) {
+ OutputDebugString(TEXT("Error !\r\n"));
}
bool isSmartphone(void) {
@@ -117,6 +121,9 @@
if (!_forcePanelInvisible && !_panelStateForced) {
_panelVisible = !_panelVisible;
_toolbarHandler.setVisible(_panelVisible);
+ // FIXME
+ add_dirty_rect(0, 200, 320, 40);
+ update_screen();
}
}
@@ -163,25 +170,59 @@
memset(buf, 0, len);
}
-bool OSystem_WINCE3::set_sound_proc(SoundProc proc, void *param, SoundFormat format) {
- SDL_AudioSpec desired;
- int thread_priority;
+#ifdef USE_VORBIS
+bool OSystem_WINCE3::checkOggHighSampleRate() {
+ char trackFile[255];
+ FILE *testFile;
+ OggVorbis_File *test_ov_file = new OggVorbis_File;
- memset(&desired, 0, sizeof(desired));
+ sprintf(trackFile,"%sTrack1.ogg", ConfMan.get("path").c_str());
+ // Check if we have an OGG audio track
+ testFile = fopen(trackFile, "rb");
+ if (testFile) {
+ if (!ov_open(testFile, test_ov_file, NULL, 0)) {
+ bool highSampleRate = (ov_info(test_ov_file, -1)->rate == 22050);
+ ov_clear(test_ov_file);
+ return highSampleRate;
+ }
+ }
- _originalSoundProc = proc;
+ // Do not test for OGG samples - too big and too slow anyway :)
+
+ return false;
+}
+#endif
+
+void OSystem_WINCE3::get_sample_rate() {
// See if the output frequency is forced by the game
if ((_gameDetector._game.features & Scumm::GF_DIGI_IMUSE) ||
_gameDetector._targetName == "queen" ||
strncmp(_gameDetector._targetName.c_str(), "sword", 5) == 0 ||
strncmp(_gameDetector._targetName.c_str(), "sky", 3) == 0)
- desired.freq = SAMPLES_PER_SEC_NEW;
+ _sampleRate = SAMPLES_PER_SEC_NEW;
else {
if (ConfMan.getBool("CE_high_sample_rate"))
- desired.freq = SAMPLES_PER_SEC_NEW;
+ _sampleRate = SAMPLES_PER_SEC_NEW;
else
- desired.freq = SAMPLES_PER_SEC_OLD;
+ _sampleRate = SAMPLES_PER_SEC_OLD;
}
+
+#ifdef USE_VORBIS
+ // Modify the sample rate on the fly if OGG is involved
+ if (_sampleRate == SAMPLES_PER_SEC_OLD)
+ if (checkOggHighSampleRate())
+ _sampleRate = SAMPLES_PER_SEC_NEW;
+#endif
+}
+
+bool OSystem_WINCE3::set_sound_proc(SoundProc proc, void *param, SoundFormat format) {
+ SDL_AudioSpec desired;
+ int thread_priority;
+
+ memset(&desired, 0, sizeof(desired));
+
+ _originalSoundProc = proc;
+ desired.freq = _sampleRate;
desired.format = AUDIO_S16SYS;
desired.channels = 2;
//desired.samples = 2048;
@@ -570,12 +611,17 @@
SDL_Rect dst;
uint32 srcPitch, dstPitch;
SDL_Rect *last_rect = _dirty_rect_list + _num_dirty_rects;
+ bool toolbarVisible = _toolbarHandler.visible();
if (_scaler_proc == Normal1x && !_adjustAspectRatio) {
SDL_Surface *target = _overlayVisible ? _tmpscreen : _screen;
for (r = _dirty_rect_list; r != last_rect; ++r) {
dst = *r;
-
+
+ // Check if the toolbar is overwritten
+ if (!_forceFull && toolbarVisible && r->y + r->h >= 200)
+ _toolbarHandler.forceRedraw();
+
if (_overlayVisible) {
// FIXME: I don't understand why this is necessary...
dst.x--;
@@ -607,6 +653,10 @@
register int dst_h = 0;
register int orig_dst_y = 0;
+ // Check if the toolbar is overwritten
+ if (!_forceFull && toolbarVisible && r->y + r->h >= 200)
+ _toolbarHandler.forceRedraw();
+
if (dst_y < _screenHeight) {
dst_h = r->h;
if (dst_h > _screenHeight - dst_y)
@@ -731,6 +781,10 @@
default:
return 0;
}
+ } else if (param == PROP_GET_SAMPLE_RATE) {
+ if (!_sampleRate)
+ get_sample_rate();
+ return _sampleRate;
} else if (param == PROP_GET_FMOPL_ENV_BITS) { // imuse FM quality
if (ConfMan.getBool("CE_FM_high_quality"))
return FMOPL_ENV_BITS_HQ;
Index: wince-sdl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- wince-sdl.h 26 Jan 2004 08:20:26 -0000 1.1
+++ wince-sdl.h 26 Jan 2004 22:38:08 -0000 1.2
@@ -84,16 +84,23 @@
private:
+#ifdef USE_VORBIS
+ bool checkOggHighSampleRate();
+#endif
+
static void private_sound_proc(void *param, byte *buf, int len);
static SoundProc _originalSoundProc;
void create_toolbar();
void update_game_settings();
void update_keyboard();
+ void get_sample_rate();
CEKEYS::KeysBuffer *_keysBuffer;
CEGUI::ToolbarHandler _toolbarHandler;
+ uint16 _sampleRate; // current audio sample rate
+
bool _freeLook; // freeLook mode (do not send mouse button events)
bool _forceHideMouse; // force invisible mouse cursor
- Previous message: [Scummvm-cvs-logs] CVS: tools md5.txt,1.13,1.14
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/insane insane.cpp,1.8,1.9 insane.h,1.5,1.6 insane_iact.cpp,1.6,1.7 insane_scenes.cpp,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list