Removed timerproc and soundproc.

svn-id: r24455
This commit is contained in:
Marcus Comstedt 2006-10-22 18:35:49 +00:00
parent fbb5a2d773
commit dde7244f2d
5 changed files with 15 additions and 96 deletions

View file

@ -24,6 +24,7 @@
#include <common/stdafx.h>
#include <common/scummsys.h>
#include "engines/engine.h"
#include "sound/mixer.h"
#include "dc.h"
EXTERN_C void *memcpy4s(void *s1, const void *s2, unsigned int n);
@ -36,28 +37,12 @@ void initSound()
do_sound_command(CMD_SET_BUFFER(SOUND_BUFFER_SHIFT));
}
bool OSystem_Dreamcast::setSoundCallback(SoundProc proc, void *param)
{
assert(SAMPLE_MODE == 0);
_sound_proc_param = param;
_sound_proc = proc;
return true;
}
void OSystem_Dreamcast::clearSoundCallback()
{
_sound_proc = NULL;
_sound_proc_param = NULL;
}
void OSystem_Dreamcast::checkSound()
{
int n;
int curr_ring_buffer_samples;
if(!_sound_proc)
if(!_mixer)
return;
if(read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY)
@ -75,7 +60,7 @@ void OSystem_Dreamcast::checkSound()
if(n<100)
return;
_sound_proc(_sound_proc_param, (byte*)temp_sound_buffer,
Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,
2*SAMPLES_TO_BYTES(n));
if(fillpos+n > curr_ring_buffer_samples) {

View file

@ -23,6 +23,7 @@
#include <common/system.h>
#include <ronin/soundcommon.h>
#include "backends/timer/default/default-timer.h"
#define NUM_BUFFERS 4
#define SOUND_BUFFER_SHIFT 3
@ -38,19 +39,6 @@ class Interactive
class OSystem_Dreamcast : public OSystem {
private:
// Set function that generates samples
typedef void (*SoundProc)(void *param, byte *buf, int len);
bool setSoundCallback(SoundProc proc, void *param);
void clearSoundCallback();
// Add a callback timer
typedef int (*TimerProc)(int interval);
void setTimerCallback(TimerProc callback, int timer);
Common::SaveFileManager *createSavefileManager();
public:
OSystem_Dreamcast();
@ -200,7 +188,7 @@ class OSystem_Dreamcast : public OSystem {
Common::SaveFileManager *_savefile;
Audio::Mixer *_mixer;
Common::TimerManager *_timer;
DefaultTimerManager *_timer;
SoftKeyboard _softkbd;
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
@ -209,18 +197,12 @@ class OSystem_Dreamcast : public OSystem {
int _overlay_x, _overlay_y;
unsigned char *_ms_buf;
unsigned char _ms_keycolor;
SoundProc _sound_proc;
void *_sound_proc_param;
bool _overlay_visible, _overlay_dirty, _screen_dirty;
int _screen_buffer, _overlay_buffer, _mouse_buffer;
bool _aspect_stretch, _softkbd_on, _enable_cursor_palette;
float _overlay_fade, _xscale, _yscale, _top_offset;
int _softkbd_motion;
uint32 _timer_duration, _timer_next_expiry;
bool _timer_active;
int (*_timer_callback) (int);
unsigned char *screen;
unsigned short *mouse;
unsigned short *overlay;
@ -237,6 +219,8 @@ class OSystem_Dreamcast : public OSystem {
unsigned char *buf, bool visible);
void setScaling();
Common::SaveFileManager *createSavefileManager();
};

View file

@ -32,7 +32,6 @@
#include <common/config-manager.h>
#include "backends/plugins/dc/dc-provider.h"
#include "backends/timer/default/default-timer.h"
#include "sound/mixer.h"
@ -42,7 +41,7 @@ const char *gGameName;
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
_ms_buf(NULL), _sound_proc(NULL), _timer_active(false),
_ms_buf(NULL), _timer(NULL), _mixer(NULL), _savefile(NULL),
_current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false),
_softkbd_motion(0), _enable_cursor_palette(false)
{
@ -51,19 +50,11 @@ OSystem_Dreamcast::OSystem_Dreamcast()
memset(ovl_tx, 0, sizeof(ovl_tx));
}
static int timer_handler(int t) {
DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
tm->handler();
return t;
}
void OSystem_Dreamcast::initBackend()
{
_savefile = createSavefileManager();
_mixer = new Audio::Mixer();
_timer = new DefaultTimerManager();
setSoundCallback(Audio::Mixer::mixCallback, _mixer);
setTimerCallback(&timer_handler, 10);
}

View file

@ -191,10 +191,8 @@ bool OSystem_Dreamcast::pollEvent(Event &event)
{
unsigned int t = Timer();
if(_timer_active && ((int)(t-_timer_next_expiry))>=0) {
_timer_duration = _timer_callback(_timer_duration);
_timer_next_expiry = t+USEC_TO_TIMER(1000*_timer_duration);
}
if(_timer != NULL)
_timer->handler();
if(((int)(t-_devpoll))<0)
return false;

View file

@ -49,49 +49,10 @@ void OSystem_Dreamcast::delayMillis(uint msecs)
getMillis();
unsigned int t, start = Timer();
int time = (((unsigned int)msecs)*100000U)>>11;
while(((int)((t = Timer())-start))<time)
while(((int)((t = Timer())-start))<time) {
if(_timer != NULL)
_timer->handler();
checkSound();
}
getMillis();
}
void OSystem_Dreamcast::setTimerCallback(TimerProc callback, int timer)
{
if (callback != NULL) {
_timer_duration = timer;
_timer_next_expiry = Timer() + USEC_TO_TIMER(1000*timer);
_timer_callback = callback;
_timer_active = true;
} else {
_timer_active = false;
}
}
/*
void waitForTimer(Scumm *s, int time)
{
if(time<0)
return;
unsigned int start = Timer();
unsigned int devpoll = start+USEC_TO_TIMER(25000);
unsigned int t;
int oldmousex = s->mouse.x, oldmousey = s->mouse.y;
time = (((unsigned int)time)*100000U)>>11;
int mask = getimask();
while(((int)((t = Timer())-start))<time)
if(((int)(t-devpoll))>0) {
setimask(15);
checkSound();
handleInput(locked_get_pads(), s->mouse.x, s->mouse.y,
s->_leftBtnPressed, s->_rightBtnPressed, s->_keyPressed);
setimask(mask);
devpoll += USEC_TO_TIMER(17000);
if(s->mouse.x != oldmousex || s->mouse.y != oldmousey) {
extern void updateScreen(Scumm *s);
updateScreen(s);
oldmousex = s->mouse.x;
oldmousey = s->mouse.y;
}
}
}
*/