aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorMax Horn2009-02-15 14:46:42 +0000
committerMax Horn2009-02-15 14:46:42 +0000
commit9daed50e0165f387f597fec4d06b57805e1f717c (patch)
treeeca2f45cf9f2b90ef83be380e42d32e99ecb1862 /engines/sci/sfx
parent0082a84b8d956bf25c6aaef153d401d641f0923d (diff)
downloadscummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.tar.gz
scummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.tar.bz2
scummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.zip
Fixed lots of warnings and errors (on my system) by backporting a patch I had sent the FreeSCI folks some time ago (but apparently it never made it, or only made it to a branch not imported?)
svn-id: r38245
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/core.cpp4
-rw-r--r--engines/sci/sfx/device.h3
-rw-r--r--engines/sci/sfx/mixer/soft.cpp11
-rw-r--r--engines/sci/sfx/player/realtime.cpp4
-rw-r--r--engines/sci/sfx/seq/instrument-map.cpp7
-rw-r--r--engines/sci/sfx/seq/map-mt32-to-gm.cpp16
-rw-r--r--engines/sci/sfx/softseq.h10
-rw-r--r--engines/sci/sfx/softseq/SN76496.cpp2
-rw-r--r--engines/sci/sfx/softseq/amiga.cpp2
-rw-r--r--engines/sci/sfx/softseq/fluidsynth.cpp2
-rw-r--r--engines/sci/sfx/softseq/mt32.cpp2
-rw-r--r--engines/sci/sfx/softseq/opl2.cpp2
-rw-r--r--engines/sci/sfx/softseq/pcspeaker.cpp2
-rw-r--r--engines/sci/sfx/softseq/softsequencers.cpp2
14 files changed, 30 insertions, 39 deletions
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp
index 5555af4dfe..1516af3b21 100644
--- a/engines/sci/sfx/core.cpp
+++ b/engines/sci/sfx/core.cpp
@@ -863,8 +863,6 @@ static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0,
static const song_handle_t midi_send_base = 0xffff0000;
-static song_handle_t midi_send_handle = 0xffff0000;
-
int
sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
int command, int arg1, int arg2)
@@ -875,7 +873,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
/* Yes, in that order. SCI channel mutes are actually done via
a counting semaphore. 0 means to decrement the counter, 1
to increment it. */
- static char *channel_state[] = {"ON","OFF"};
+ static const char *channel_state[] = {"ON","OFF"};
if (command == 0xb0 &&
arg1 == SCI_MIDI_CHANNEL_MUTE)
diff --git a/engines/sci/sfx/device.h b/engines/sci/sfx/device.h
index 49bc017c7b..19a17726a2 100644
--- a/engines/sci/sfx/device.h
+++ b/engines/sci/sfx/device.h
@@ -52,6 +52,9 @@ struct _midi_device {
*/
};
+// FIXME: This evil hack below is needed to create the
+// decorated_midi_writer struct in instrumen-map.c -- in C++, this can
+// be replaced by simple subclassing.
#define MIDI_WRITER_BODY \
char *name; /* Name description of the device */ \
\
diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp
index d4ab7232bc..4d2d86947c 100644
--- a/engines/sci/sfx/mixer/soft.cpp
+++ b/engines/sci/sfx/mixer/soft.cpp
@@ -250,17 +250,6 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed)
BREAKPOINT();
}
-#if 0
-// Unreferenced - removed
-static void
-mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed)
-{
- ACQUIRE_LOCK();
- _mix_unsubscribe(self, feed);
- RELEASE_LOCK();
-}
-#endif
-
static void
mix_exit(sfx_pcm_mixer_t *self)
{
diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp
index d3fbae5800..a88056162c 100644
--- a/engines/sci/sfx/player/realtime.cpp
+++ b/engines/sci/sfx/player/realtime.cpp
@@ -159,7 +159,7 @@ rt_timer_callback(void)
}
static resource_t *
-find_patch(resource_mgr_t *resmgr, const char *seq, int patchfile)
+find_patch(resource_mgr_t *resmgr, const char *seq_name, int patchfile)
{
resource_t *res = NULL;
@@ -167,7 +167,7 @@ find_patch(resource_mgr_t *resmgr, const char *seq, int patchfile)
res = scir_find_resource(resmgr, sci_patch, patchfile, 0);
if (!res) {
fprintf(stderr, "[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found\n",
- patchfile, seq);
+ patchfile, seq_name);
}
}
diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp
index 0d829a0582..204ecfdc34 100644
--- a/engines/sci/sfx/seq/instrument-map.cpp
+++ b/engines/sci/sfx/seq/instrument-map.cpp
@@ -219,6 +219,7 @@ sfx_instrument_map_load_sci(byte *data, size_t size)
/* Output with the instrument map */
#define MIDI_CHANNELS_NR 0x10
+// FIXME: Replace this ugly hack with simple subclassing once converting to C++
typedef struct decorated_midi_writer {
MIDI_WRITER_BODY
@@ -271,7 +272,7 @@ close_decorated(decorated_midi_writer_t *self)
sfx_instrument_map_free(self->map);
self->map = NULL;
self->writer->close(self->writer);
- sci_free(self->name);
+ sci_free((void *)self->name);
self->name = NULL;
sci_free(self);
}
@@ -279,7 +280,7 @@ close_decorated(decorated_midi_writer_t *self)
#define BOUND_127(x) (((x) < 0)? 0 : (((x) > 0x7f)? 0x7f : (x)))
static int
-bound_hard_127(int i, char *descr)
+bound_hard_127(int i, const char *descr)
{
int r = BOUND_127(i);
if (r != i)
@@ -325,7 +326,7 @@ write_decorated(decorated_midi_writer_t *self, byte *buf, int len)
assert (len >= 1);
if (op == 0xC0 && chan != MIDI_RHYTHM_CHANNEL) { /* Program change */
- int patch = bound_hard_127(buf[1], "program change");
+ /*int*/ patch = bound_hard_127(buf[1], "program change");
int instrument = map->patch_map[patch].patch;
int bend_range = map->patch_bend_range[patch];
diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp
index bcaf3556f1..b4c56f2602 100644
--- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp
+++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp
@@ -37,7 +37,7 @@
#define DEBUG_MT32_TO_GM
-static char
+static const char
*GM_Instrument_Names[] = {
/*000*/ "Acoustic Grand Piano",
/*001*/ "Bright Acoustic Piano",
@@ -170,7 +170,7 @@ static char
};
/* The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI */
-static char
+static const char
*GM_Percussion_Names[] = {
/*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -232,7 +232,7 @@ static char
static struct {
- char *name;
+ const char *name;
gint8 gm_instr;
gint8 gm_rhythm_key;
} MT32_PresetTimbreMaps[] = {
@@ -367,7 +367,7 @@ static struct {
};
static struct {
- char *name;
+ const char *name;
gint8 gm_instr;
gint8 gm_rhythmkey;
} MT32_RhythmTimbreMaps[] = {
@@ -428,7 +428,7 @@ MT32_PresetRhythmKeymap[] = {
??? - I'm clueless?
R - Rhythm... */
static struct {
- char *name;
+ const char *name;
gint8 gm_instr;
gint8 gm_rhythm_key;
} MT32_MemoryTimbreMaps[] = {
@@ -562,11 +562,11 @@ static struct {
{"Wind2 MS", SFX_UNMAPPED, SFX_UNMAPPED}, /* ? (CoC) */
{"Woodpecker", 115, SFX_UNMAPPED}, /* ? (CB) */
{"WtrFall MS", SFX_UNMAPPED, SFX_UNMAPPED}, /* ? (CoC, HQ, iceMan) */
- {0, 0}
+ {0, 0, 0}
};
static gint8
-lookup_instrument(char *iname)
+lookup_instrument(const char *iname)
{
int i = 0;
@@ -579,7 +579,7 @@ lookup_instrument(char *iname)
}
static gint8
-lookup_rhythm_key(char *iname)
+lookup_rhythm_key(const char *iname)
{
int i = 0;
diff --git a/engines/sci/sfx/softseq.h b/engines/sci/sfx/softseq.h
index 6284aef8ec..d790f87229 100644
--- a/engines/sci/sfx/softseq.h
+++ b/engines/sci/sfx/softseq.h
@@ -42,11 +42,11 @@ typedef struct sfx_softseq {
const char *version;
int
- (*set_option)(struct sfx_softseq *self, char *name, char *value);
+ (*set_option)(struct sfx_softseq *self, const char *name, const char *value);
/* Sets an option for the sequencer
** Parameters: (sfx_softseq_t *) self: Self reference
- ** (char *) name: Name of the option to set
- ** (char *0 value: Value to set the option to
+ ** (const char *) name: Name of the option to set
+ ** (const char *) value: Value to set the option to
** Returns : (int) GFX_OK on success, or GFX_ERROR if not supported
*/
@@ -125,9 +125,9 @@ typedef struct sfx_softseq {
sfx_softseq_t *
-sfx_find_softseq(char *name);
+sfx_find_softseq(const char *name);
/* Finds a given or default software sequencer
-** Parameters: (char *) name: Name of the sequencer to look up, or NULL for default
+** Parameters: (const char *) name: Name of the sequencer to look up, or NULL for default
** Returns : (sfx_softseq_t *) The requested sequencer, or NULL if not found
*/
diff --git a/engines/sci/sfx/softseq/SN76496.cpp b/engines/sci/sfx/softseq/SN76496.cpp
index 6ecd72bf9e..0bacc295ea 100644
--- a/engines/sci/sfx/softseq/SN76496.cpp
+++ b/engines/sci/sfx/softseq/SN76496.cpp
@@ -48,7 +48,7 @@ extern sfx_softseq_t sfx_softseq_pcspeaker;
static int
-SN76496_set_option(sfx_softseq_t *self, char *name, char *value)
+SN76496_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp
index 8595899718..ca0d40b689 100644
--- a/engines/sci/sfx/softseq/amiga.cpp
+++ b/engines/sci/sfx/softseq/amiga.cpp
@@ -466,7 +466,7 @@ static instrument_t *read_instrument(FILE *file, int *id)
}
static int
-ami_set_option(sfx_softseq_t *self, char *name, char *value)
+ami_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/fluidsynth.cpp b/engines/sci/sfx/softseq/fluidsynth.cpp
index a44d75e5bd..750891d60c 100644
--- a/engines/sci/sfx/softseq/fluidsynth.cpp
+++ b/engines/sci/sfx/softseq/fluidsynth.cpp
@@ -229,7 +229,7 @@ fluidsynth_volume(sfx_softseq_t *self, int volume)
}
static int
-fluidsynth_set_option(sfx_softseq_t *self, char *name, char *value)
+fluidsynth_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/mt32.cpp b/engines/sci/sfx/softseq/mt32.cpp
index 6b37673c9e..3389a286e5 100644
--- a/engines/sci/sfx/softseq/mt32.cpp
+++ b/engines/sci/sfx/softseq/mt32.cpp
@@ -197,7 +197,7 @@ mt32_volume(sfx_softseq_t *self, int volume)
}
static int
-mt32_set_option(sfx_softseq_t *self, char *name, char *value)
+mt32_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp
index c19de1388a..dc1237ae66 100644
--- a/engines/sci/sfx/softseq/opl2.cpp
+++ b/engines/sci/sfx/softseq/opl2.cpp
@@ -682,7 +682,7 @@ opl2_volume(sfx_softseq_t *self, int volume)
}
int
-opl2_set_option(sfx_softseq_t *self, char *name, char *value)
+opl2_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/pcspeaker.cpp b/engines/sci/sfx/softseq/pcspeaker.cpp
index 727b1f9e5a..cde71ae62e 100644
--- a/engines/sci/sfx/softseq/pcspeaker.cpp
+++ b/engines/sci/sfx/softseq/pcspeaker.cpp
@@ -42,7 +42,7 @@ extern sfx_softseq_t sfx_softseq_pcspeaker;
static int
-sps_set_option(sfx_softseq_t *self, char *name, char *value)
+sps_set_option(sfx_softseq_t *self, const char *name, const char *value)
{
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/softsequencers.cpp b/engines/sci/sfx/softseq/softsequencers.cpp
index d0f544190e..a63500ebd5 100644
--- a/engines/sci/sfx/softseq/softsequencers.cpp
+++ b/engines/sci/sfx/softseq/softsequencers.cpp
@@ -54,7 +54,7 @@ static sfx_softseq_t *sw_sequencers[] = {
sfx_softseq_t *
-sfx_find_softseq(char *name)
+sfx_find_softseq(const char *name)
{
if (!name)
return sw_sequencers[0];