From c5539b4e4e948825c0116194e06ddf3dbde3ed17 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 26 May 2009 11:35:35 +0000 Subject: [PATCH] SCI: Preparing to transform sfx_player_t into a class svn-id: r40911 --- engines/sci/module.mk | 2 +- engines/sci/sfx/player.h | 4 +- .../sfx/player/{player.cpp => new_player.cpp} | 7 ++-- engines/sci/sfx/player/new_player.h | 37 +++++++++++++++++++ engines/sci/sfx/player/polled.cpp | 4 +- engines/sci/sfx/player/polled.h | 37 +++++++++++++++++++ engines/sci/sfx/player/realtime.cpp | 4 +- .../sfx/player/{players.cpp => realtime.h} | 29 +++------------ 8 files changed, 87 insertions(+), 37 deletions(-) rename engines/sci/sfx/player/{player.cpp => new_player.cpp} (97%) create mode 100644 engines/sci/sfx/player/new_player.h create mode 100644 engines/sci/sfx/player/polled.h rename engines/sci/sfx/player/{players.cpp => realtime.h} (70%) diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 979bf08cd99..6521aa4cac9 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -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 \ diff --git a/engines/sci/sfx/player.h b/engines/sci/sfx/player.h index e2bf952d280..5a5da2c673c 100644 --- a/engines/sci/sfx/player.h +++ b/engines/sci/sfx/player.h @@ -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); diff --git a/engines/sci/sfx/player/player.cpp b/engines/sci/sfx/player/new_player.cpp similarity index 97% rename from engines/sci/sfx/player/player.cpp rename to engines/sci/sfx/player/new_player.cpp index 5c811f8ab87..deb4d06d340 100644 --- a/engines/sci/sfx/player/player.cpp +++ b/engines/sci/sfx/player/new_player.cpp @@ -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, diff --git a/engines/sci/sfx/player/new_player.h b/engines/sci/sfx/player/new_player.h new file mode 100644 index 00000000000..79c6d93acd8 --- /dev/null +++ b/engines/sci/sfx/player/new_player.h @@ -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 diff --git a/engines/sci/sfx/player/polled.cpp b/engines/sci/sfx/player/polled.cpp index 842b7c5df52..a326eb508af 100644 --- a/engines/sci/sfx/player/polled.cpp +++ b/engines/sci/sfx/player/polled.cpp @@ -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 */ /*=======================*/ diff --git a/engines/sci/sfx/player/polled.h b/engines/sci/sfx/player/polled.h new file mode 100644 index 00000000000..9a1e31e44b5 --- /dev/null +++ b/engines/sci/sfx/player/polled.h @@ -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 diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp index b279e919088..08c355388b1 100644 --- a/engines/sci/sfx/player/realtime.cpp +++ b/engines/sci/sfx/player/realtime.cpp @@ -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) { diff --git a/engines/sci/sfx/player/players.cpp b/engines/sci/sfx/player/realtime.h similarity index 70% rename from engines/sci/sfx/player/players.cpp rename to engines/sci/sfx/player/realtime.h index d84d9cdd33f..bdf2777708b 100644 --- a/engines/sci/sfx/player/players.cpp +++ b/engines/sci/sfx/player/realtime.h @@ -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