SCI: Preparing to transform sfx_player_t into a class

svn-id: r40911
This commit is contained in:
Max Horn 2009-05-26 11:35:35 +00:00
parent 7fbbaff990
commit c5539b4e4e
8 changed files with 87 additions and 37 deletions

View File

@ -63,7 +63,7 @@ MODULE_OBJS = \
sfx/iterator.o \
sfx/songlib.o \
sfx/device/devices.o \
sfx/player/player.o \
sfx/player/new_player.o \
sfx/player/players.o \
sfx/player/polled.o \
sfx/player/realtime.o \

View File

@ -28,11 +28,11 @@
#ifndef SCI_SFX_SFX_PLAYER_H
#define SCI_SFX_SFX_PLAYER_H
#include "common/scummsys.h"
#include "sci/resource.h"
#include "sci/sfx/iterator.h"
#include "common/scummsys.h"
namespace Sci {
typedef void tell_synth_func(int buf_nr, byte *buf);

View File

@ -24,7 +24,7 @@
*/
#include "sci/tools.h"
#include "sci/sfx/player.h"
#include "sci/sfx/player/new_player.h"
#include "sci/sfx/sequencer.h"
#include "sci/sfx/iterator.h"
#include "sci/sfx/core.h"
@ -36,7 +36,6 @@
namespace Sci {
extern sfx_player_t sfx_player_player;
static MidiPlayer *mididrv;
static SongIterator *play_it = NULL;
@ -135,7 +134,7 @@ static Common::Error player_init(ResourceManager *resmgr, int expected_latency)
assert(mididrv);
sfx_player_player.polyphony = mididrv->getPolyphony();
sfx_new_player.polyphony = mididrv->getPolyphony();
tempo = mididrv->getBaseTempo();
uint32 time = g_system->getMillis();
@ -230,7 +229,7 @@ static Common::Error player_exit(void) {
return Common::kNoError;
}
sfx_player_t sfx_player_player = {
sfx_player_t sfx_new_player = {
"new",
"0.1",
&player_set_option,

View File

@ -0,0 +1,37 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 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 for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#ifndef SCI_SFX_SFX_PLAYER_NEW_H
#define SCI_SFX_SFX_PLAYER_NEW_H
#include "sci/sfx/player.h"
namespace Sci {
extern sfx_player_t sfx_new_player;
} // End of namespace Sci
#endif

View File

@ -27,7 +27,7 @@
#include "common/util.h"
#include "common/file.h"
#include "sci/sfx/player.h"
#include "sci/sfx/player/polled.h"
#include "sci/sfx/softseq.h"
#include "sci/sfx/iterator.h"
@ -253,8 +253,6 @@ static int ppf_poll(int frame_size, byte *dest, int size) {
return size; /* Apparently, we wrote all that was requested */
}
extern sfx_player_t sfx_player_polled;
/*=======================*/
/* Player implementation */
/*=======================*/

View File

@ -0,0 +1,37 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 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 for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#ifndef SCI_SFX_SFX_PLAYER_POLLED_H
#define SCI_SFX_SFX_PLAYER_POLLED_H
#include "sci/sfx/player.h"
namespace Sci {
extern sfx_player_t sfx_player_polled;
} // End of namespace Sci
#endif

View File

@ -28,7 +28,7 @@
** enough, I guess. */
#include "sci/tools.h"
#include "sci/sfx/player.h"
#include "sci/sfx/player/realtime.h"
#include "sci/sfx/sequencer.h"
#include "sci/sfx/iterator.h"
#include "sci/sfx/core.h"
@ -39,8 +39,6 @@ namespace Sci {
static sfx_sequencer_t *seq;
extern sfx_player_t sfx_player_realtime;
/* Playing mechanism */
static inline int delta_time(const uint32 comp, const uint32 base) {

View File

@ -23,34 +23,15 @@
*
*/
#ifndef SCI_SFX_SFX_PLAYER_REALTIME_H
#define SCI_SFX_SFX_PLAYER_REALTIME_H
#include "sci/sfx/player.h"
namespace Sci {
extern sfx_player_t sfx_player_realtime;
extern sfx_player_t sfx_player_polled;
extern sfx_player_t sfx_player_player;
sfx_player_t *sfx_players[] = {
&sfx_player_player,
&sfx_player_polled,
&sfx_player_realtime,
NULL
};
sfx_player_t *sfx_find_player(char *name) {
if (!name) {
/* Implement platform policy here */
return sfx_players[0];
} else {
int n = 0;
while (sfx_players[n] &&
scumm_stricmp(sfx_players[n]->name, name))
++n;
return sfx_players[n];
}
}
} // End of namespace Sci
#endif