[Scummvm-cvs-logs] SF.net SVN: scummvm:[40517] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed May 13 01:31:55 CEST 2009


Revision: 40517
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40517&view=rev
Author:   fingolfin
Date:     2009-05-12 23:31:55 +0000 (Tue, 12 May 2009)

Log Message:
-----------
SCI: Replaced SFX_OK/SFX_ERROR by Common::Error, and got rid of sfx/sfx.h

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/core.h
    scummvm/trunk/engines/sci/sfx/device/alsa-midi.cpp
    scummvm/trunk/engines/sci/sfx/device/camd-midi.cpp
    scummvm/trunk/engines/sci/sfx/device/unixraw-midi.cpp
    scummvm/trunk/engines/sci/sfx/device.h
    scummvm/trunk/engines/sci/sfx/player/player.cpp
    scummvm/trunk/engines/sci/sfx/player/polled.cpp
    scummvm/trunk/engines/sci/sfx/player/realtime.cpp
    scummvm/trunk/engines/sci/sfx/player.h
    scummvm/trunk/engines/sci/sfx/sci_midi.h
    scummvm/trunk/engines/sci/sfx/seq/gm.cpp
    scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp
    scummvm/trunk/engines/sci/sfx/seq/oss-adlib.cpp
    scummvm/trunk/engines/sci/sfx/sequencer.h
    scummvm/trunk/engines/sci/sfx/sfx_pcm.h
    scummvm/trunk/engines/sci/sfx/softseq/SN76496.cpp
    scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp
    scummvm/trunk/engines/sci/sfx/softseq/fluidsynth.cpp
    scummvm/trunk/engines/sci/sfx/softseq/opl2.cpp
    scummvm/trunk/engines/sci/sfx/softseq/pcspeaker.cpp
    scummvm/trunk/engines/sci/sfx/softseq.h

Removed Paths:
-------------
    scummvm/trunk/engines/sci/sfx/sfx.h

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -370,8 +370,6 @@
 	return s->r_acc;
 }
 
-int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
-	int command, int arg1, int arg2);
 
 reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	uint16 command = UKPV(0);
@@ -673,9 +671,6 @@
 	return s->r_acc;
 }
 
-int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
-	int command, int arg1, int arg2);
-
 reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	uint16 command = UKPV(0);
 	reg_t obj = KP_ALT(1, NULL_REG);

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -707,7 +707,7 @@
 
 static const song_handle_t midi_send_base = 0xffff0000;
 
-int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
+Common::Error sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
 	int command, int arg1, int arg2) {
 	byte buffer[5];
 	tell_synth_func *tell = sfx_get_player_tell_func();
@@ -724,7 +724,7 @@
 		/* We need to have a GET_PLAYMASK interface to use
 		   here. SET_PLAYMASK we've got.
 		*/
-		return SFX_OK;
+		return Common::kNoError;
 	}
 
 	buffer[0] = channel | command; /* No channel remapping yet */
@@ -745,12 +745,12 @@
 		break;
 	default:
 		sciprintf("Unexpected explicit MIDI command %02x\n", command);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	if (tell)
 		tell(MIDI_cmdlen[command >> 4], buffer);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 int sfx_get_volume(sfx_state_t *self) {

Modified: scummvm/trunk/engines/sci/sfx/core.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/core.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -27,7 +27,7 @@
 #ifndef SCI_SFX_SFX_ENGINE_H
 #define SCI_SFX_SFX_ENGINE_H
 
-#include "sci/sfx/sfx.h"
+#include "common/error.h"
 #include "sci/sfx/songlib.h"
 #include "sci/scicore/resource.h"
 
@@ -162,6 +162,12 @@
 **             (fade_params_t *) fade_setup: The precise fade-out configuration to use
 */
 
+
+// Previously undocumented:
+Common::Error sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
+	int command, int arg1, int arg2);
+
+
 } // End of namespace Sci
 
 #endif // SCI_SFX_SFX_ENGINE_H

Modified: scummvm/trunk/engines/sci/sfx/device/alsa-midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/device/alsa-midi.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/device/alsa-midi.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -71,16 +71,16 @@
 }
 
 
-static int am_subscribe_to_ports(void) {
+static Common::Error am_subscribe_to_ports(void) {
 	if ((port_out = snd_seq_connect_to(seq, port_out, port_nr, subport_nr)) < 0) {
 		fprintf(stderr, "[SFX] Could not connect to ALSA sequencer port: %s\n", snd_strerror(port_out));
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 
-static int aminit(midi_writer_t *self) {
+static Common::Error aminit(midi_writer_t *self) {
 	int err;
 
 	snd_midi_event_new(4096, &parser);
@@ -91,7 +91,7 @@
 	if (snd_seq_open(&seq, seq_name, SND_SEQ_OPEN_OUTPUT, SND_SEQ_NONBLOCK)) {
 		fprintf(stderr, "[SFX] Failed to open ALSA MIDI sequencer '%s' for output\n",
 		        seq_name);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	if ((port_out = snd_seq_create_simple_port(seq, "FreeSCI",
@@ -100,11 +100,11 @@
 	                SND_SEQ_PORT_CAP_READ,
 	                SND_SEQ_PORT_TYPE_MIDI_GENERIC)) < 0) {
 		fprintf(stderr, "[SFX] Could not create ALSA sequencer port\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	if (am_subscribe_to_ports())
-		return SFX_ERROR;
+		return Common::kUnknownError;
 
 	queue = snd_seq_alloc_queue(seq);
 	_set_tempo();
@@ -115,18 +115,18 @@
 		fflush(NULL);
 		fprintf(stderr, "[SFX] Error while draining: %s\n",
 		        snd_strerror(err));
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int amsetopt(midi_writer_t *self, char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error amsetopt(midi_writer_t *self, char *name, char *value) {
+	return Common::kUnknownError;
 }
 
 
-static int amwrite(midi_writer_t *self, unsigned char *buf, int len) {
+static Common::Error amwrite(midi_writer_t *self, unsigned char *buf, int len) {
 	snd_seq_event_t evt;
 
 #if 0
@@ -162,7 +162,7 @@
 #endif
 
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void amdelay(midi_writer_t *self, int ticks) {

Modified: scummvm/trunk/engines/sci/sfx/device/camd-midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/device/camd-midi.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/device/camd-midi.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -58,10 +58,10 @@
 			sciprintf("[SFX] CAMD driver: ");	\
 			sciprintf(m);				\
 			sciprintf("\n");			\
-			return SFX_ERROR;			\
+			return Common::kUnknownError;			\
 	}
 
-static int camd_init(midi_writer_t *self) {
+static Common::Error camd_init(midi_writer_t *self) {
 	sciprintf("[SFX] Initialising CAMD raw MIDI backend, v%s\n", SCI_CAMD_MIDI_VERSION);
 
 	CamdBase = IExec->OpenLibrary("camd.library", 36L);
@@ -82,18 +82,18 @@
 
 	sciprintf("[SFX] CAMD initialisation completed\n");
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int camd_set_option(midi_writer_t *self, char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error camd_set_option(midi_writer_t *self, char *name, char *value) {
+	return Common::kUnknownError;
 }
 
 #define MAX_MIDI_LEN 3
 
-static int camd_write(midi_writer_t *self, unsigned char *buffer, int len) {
+static Common::Error camd_write(midi_writer_t *self, unsigned char *buffer, int len) {
 	if (len == 0)
-		return SFX_OK;
+		return Common::kNoError;
 
 	if (buffer[0] == SYSEX_PREFIX) {
 		/* Must send this as a SysEx */
@@ -117,7 +117,7 @@
 		ICamd->PutMidi(midi_link, data);
 	}
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void camd_delay(midi_writer_t *self, int ticks) {

Modified: scummvm/trunk/engines/sci/sfx/device/unixraw-midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/device/unixraw-midi.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/device/unixraw-midi.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -41,29 +41,29 @@
 static int fd;
 static const char *devicename = "/dev/midi";
 
-static int unixraw_init(midi_writer_t *self) {
+static Common::Error unixraw_init(midi_writer_t *self) {
 	sciprintf("[SFX] Initialising UNIX raw MIDI backend, v%s\n", SCI_UNIXRAW_MIDI_VERSION);
 
 	fd = open(devicename, O_WRONLY | O_SYNC);
 
 	if (!IS_VALID_FD(fd)) {
 		sciprintf("[SFX] Failed to open %s\n", devicename);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int unixraw_set_option(midi_writer_t *self, char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error unixraw_set_option(midi_writer_t *self, char *name, char *value) {
+	return Common::kUnknownError;
 }
 
-static int unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) {
+static Common::Error unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) {
 	if (write(fd, buffer, len) != len) {
 		sciprintf("[SFX] MIDI write error\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void unixraw_delay(midi_writer_t *self, int ticks) {

Modified: scummvm/trunk/engines/sci/sfx/device.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/device.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/device.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -29,6 +29,7 @@
 #define SCI_SFX_DEVICE_H
 
 #include "common/scummsys.h"
+#include "common/error.h"
 
 namespace Sci {
 
@@ -40,43 +41,43 @@
 struct _midi_device {
 	const char *name;
 
-	int (*init)(struct _midi_device *self);
+	Common::Error (*init)(struct _midi_device *self);
 	/* Initializes the device
 	** Parameters: (midi_device_t *) self: Self reference
-	** Returns   : (int) SFX_OK on success, SFX_ERROR if the device could not be
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError if the device could not be
 	**                   opened
 	*/
 
-	int (*set_option)(struct _midi_device *self, char *name, char *value);
+	Common::Error (*set_option)(struct _midi_device *self, char *name, char *value);
 	/* Sets an option for the device
 	** Parameters: (char *) name: Name of the option to set
 	**             (char *) value: Value of the option to set
-	** Returns   : (int) SFX_OK on success, SFX_ERROR otherwise (unsupported option)
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError otherwise (unsupported option)
 	*/
 };
 
 struct midi_writer_t {
 	char *name; /* Name description of the device */
 
-	int (*init)(midi_writer_t *self);
+	Common::Error (*init)(midi_writer_t *self);
 	/* Initializes the writer
 	** Parameters: (midi_writer_t *) self: Self reference
-	** Returns   : (int) SFX_OK on success, SFX_ERROR if the device could not be
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError if the device could not be
 	**                   opened
 	*/
 
-	int (*set_option)(midi_writer_t *self, char *name, char *value);
+	Common::Error (*set_option)(midi_writer_t *self, char *name, char *value);
 	/* Sets an option for the writer
 	** Parameters: (char *) name: Name of the option to set
 	**             (char *) value: Value of the option to set
-	** Returns   : (int) SFX_OK on success, SFX_ERROR otherwise (unsupported option)
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError otherwise (unsupported option)
 	*/
 
-	int (*write)(midi_writer_t *self, unsigned char *buf, int len);
+	Common::Error (*write)(midi_writer_t *self, unsigned char *buf, int len);
 	/* Writes some bytes to the MIDI stream
 	** Parameters: (char *) buf: The buffer to write
 	**             (int) len: Number of bytes to write
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	** No delta time is expected here.
 	*/
 

Modified: scummvm/trunk/engines/sci/sfx/player/player.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/player/player.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/player/player.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -112,11 +112,11 @@
 
 /* API implementation */
 
-static int player_set_option(char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error player_set_option(char *name, char *value) {
+	return Common::kUnknownError;
 }
 
-static int player_init(ResourceManager *resmgr, int expected_latency) {
+static Common::Error player_init(ResourceManager *resmgr, int expected_latency) {
 	MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB);
 
 	switch(musicDriver) {
@@ -148,10 +148,10 @@
 	mididrv->open(resmgr);
 	mididrv->setVolume(volume);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_add_iterator(SongIterator *it, uint32 start_time) {
+static Common::Error player_add_iterator(SongIterator *it, uint32 start_time) {
 	mutex->lock();
 	SIMSG_SEND(it, SIMSG_SET_PLAYMASK(mididrv->getPlayMask()));
 	SIMSG_SEND(it, SIMSG_SET_RHYTHM(mididrv->hasRhythmChannel()));
@@ -166,15 +166,15 @@
 	play_it_done = 0;
 	mutex->unlock();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_fade_out(void) {
+static Common::Error player_fade_out(void) {
 	warning("Attempt to fade out - not implemented yet");
-	return SFX_ERROR;
+	return Common::kUnknownError;
 }
 
-static int player_stop(void) {
+static Common::Error player_stop(void) {
 	debug(3, "Player: Stopping song iterator %p", (void *)play_it);
 	mutex->lock();
 	delete play_it;
@@ -183,23 +183,23 @@
 		static_cast<MidiDriver *>(mididrv)->send(0xb0 + i, SCI_MIDI_CHANNEL_NOTES_OFF, 0);
 	mutex->unlock();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_send_iterator_message(const SongIterator::Message &msg) {
+static Common::Error player_send_iterator_message(const SongIterator::Message &msg) {
 	mutex->lock();
 	if (!play_it) {
 		mutex->unlock();
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	songit_handle_message(&play_it, msg);
 	mutex->unlock();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_pause(void) {
+static Common::Error player_pause(void) {
 	mutex->lock();
 	play_paused = 1;
 	play_pause_diff = wakeup_time.msecsDiff(current_time);
@@ -207,27 +207,27 @@
 	mididrv->playSwitch(false);
 	mutex->unlock();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_resume(void) {
+static Common::Error player_resume(void) {
 	mutex->lock();
 	wakeup_time = Audio::Timestamp(current_time.msecs() + play_pause_diff, SFX_TICKS_PER_SEC);
 	mididrv->playSwitch(true);
 	play_paused = 0;
 	mutex->unlock();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int player_exit(void) {
+static Common::Error player_exit(void) {
 	mididrv->close();
 	delete mididrv;
 	delete mutex;
 	delete play_it;
 	play_it = NULL;
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 sfx_player_t sfx_player_player = {

Modified: scummvm/trunk/engines/sci/sfx/player/polled.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/player/polled.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/player/polled.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -268,13 +268,13 @@
 	/* Hey, we're polled anyway ;-) */
 }
 
-static int pp_set_option(char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error pp_set_option(char *name, char *value) {
+	return Common::kUnknownError;
 }
 
-static int pp_init(ResourceManager *resmgr, int expected_latency) {
+static Common::Error pp_init(ResourceManager *resmgr, int expected_latency) {
 	if (!g_system->getMixer()->isReady())
-		return SFX_ERROR;
+		return Common::kUnknownError;
 
 	Resource *res = NULL, *res2 = NULL;
 
@@ -286,7 +286,7 @@
 
 	if (!seq) {
 		sciprintf("[sfx:seq:polled] Initialisation failed: Could not find software sequencer\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	if (seq->patch_nr != SFX_SEQ_PATCHFILE_NONE) {
@@ -304,7 +304,7 @@
 	              (res2) ? res2->size : 0)) {
 		sciprintf("[sfx:seq:polled] Initialisation failed: Sequencer '%s', v%s failed to initialise\n",
 		          seq->name, seq->version);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	seq->set_volume(seq, volume);
@@ -314,10 +314,10 @@
 	g_system->getMixer()->playInputStream(Audio::Mixer::kSFXSoundType, 0, newStream);
 
 	sfx_player_polled.polyphony = seq->polyphony;
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_add_iterator(SongIterator *it, uint32 start_time) {
+static Common::Error pp_add_iterator(SongIterator *it, uint32 start_time) {
 	SongIterator *old = play_it;
 
 	SIMSG_SEND(it, SIMSG_SET_PLAYMASK(seq->playmask));
@@ -339,15 +339,15 @@
 		new_song = 1;
 	}
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_fade_out() {
+static Common::Error pp_fade_out() {
 	warning(__FILE__": Attempt to fade out- not implemented yet");
-	return SFX_ERROR;
+	return Common::kUnknownError;
 }
 
-static int pp_stop() {
+static Common::Error pp_stop() {
 	SongIterator *it = play_it;
 
 	play_it = NULL;
@@ -356,28 +356,28 @@
 
 	seq->allstop(seq);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_send_iterator_message(const SongIterator::Message &msg) {
+static Common::Error pp_send_iterator_message(const SongIterator::Message &msg) {
 	if (!play_it)
-		return SFX_ERROR;
+		return Common::kUnknownError;
 
 	songit_handle_message(&play_it, msg);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_pause() {
+static Common::Error pp_pause() {
 	play_paused = 1;
 	seq->set_volume(seq, 0);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_resume() {
+static Common::Error pp_resume() {
 	if (!play_it) {
 		play_paused = 0;
-		return SFX_OK; /* Nothing to resume */
+		return Common::kNoError; /* Nothing to resume */
 	}
 
 	if (play_paused)
@@ -387,15 +387,15 @@
 
 	play_paused = 0;
 	seq->set_volume(seq, volume);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int pp_exit() {
+static Common::Error pp_exit() {
 	seq->exit(seq);
 	delete play_it;
 	play_it = NULL;
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 sfx_player_t sfx_player_polled = {

Modified: scummvm/trunk/engines/sci/sfx/player/realtime.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/player/realtime.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/player/realtime.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -137,7 +137,7 @@
 	if (patchfile != SFX_SEQ_PATCHFILE_NONE) {
 		res = resmgr->findResource(kResourceTypePatch, patchfile, 0);
 		if (!res) {
-			fprintf(stderr, "[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found\n",
+			warning("[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found",
 			        patchfile, seq_name);
 		}
 	}
@@ -147,19 +147,19 @@
 
 /* API implementation */
 
-static int rt_set_option(char *name, char *value) {
-	return SFX_ERROR;
+static Common::Error rt_set_option(char *name, char *value) {
+	return Common::kUnknownError;
 }
 
-static int rt_init(ResourceManager *resmgr, int expected_latency) {
+static Common::Error rt_init(ResourceManager *resmgr, int expected_latency) {
 	Resource *res = NULL, *res2 = NULL;
 	void *seq_dev = NULL;
 
 	seq = sfx_find_sequencer(NULL);
 
 	if (!seq) {
-		fprintf(stderr, "[SFX] " __FILE__": Could not find sequencer\n");
-		return SFX_ERROR;
+		warning("[SFX] " __FILE__": Could not find sequencer");
+		return Common::kUnknownError;
 	}
 
 	sfx_player_realtime.polyphony = seq->polyphony;
@@ -175,8 +175,8 @@
 	              res2 ? res2->size : 0,
 	              res2 ? res2->data : NULL,
 	              seq_dev)) {
-		fprintf(stderr, "[SFX] " __FILE__": Sequencer failed to initialize\n");
-		return SFX_ERROR;
+		warning("[SFX] " __FILE__": Sequencer failed to initialize");
+		return Common::kUnknownError;
 	}
 
 	play_writeahead = expected_latency;
@@ -188,10 +188,10 @@
 	if (seq->reset_timer)
 		seq->reset_timer(0);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int rt_add_iterator(SongIterator *it, uint32 start_time) {
+static Common::Error rt_add_iterator(SongIterator *it, uint32 start_time) {
 	if (seq->reset_timer) /* Restart timer counting if possible */
 		seq->reset_timer(start_time);
 
@@ -203,15 +203,15 @@
 	play_it_done = 0;
 	play_moredelay = 0;
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int rt_fade_out(void) {
-	fprintf(stderr, __FILE__": Attempt to fade out- not implemented yet\n");
-	return SFX_ERROR;
+static Common::Error rt_fade_out(void) {
+	warning(__FILE__": Attempt to fade out- not implemented yet");
+	return Common::kUnknownError;
 }
 
-static int rt_stop(void) {
+static Common::Error rt_stop(void) {
 	SongIterator *it = play_it;
 
 	play_it = NULL;
@@ -220,45 +220,42 @@
 	if (seq && seq->allstop)
 		seq->allstop();
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int rt_send_iterator_message(const SongIterator::Message &msg) {
+static Common::Error rt_send_iterator_message(const SongIterator::Message &msg) {
 	if (!play_it)
-		return SFX_ERROR;
+		return Common::kUnknownError;
 
 	songit_handle_message(&play_it, msg);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int rt_pause(void) {
+static Common::Error rt_pause(void) {
 	play_pause_started = g_system->getMillis();
-	/* Also, indicate that we haven't modified the time counter
-	** yet  */
+	// Also, indicate that we haven't modified the time counter yet
 	play_pause_counter = play_pause_started;
 
 	play_paused = 1;
 	if (!seq->allstop) {
 		sciprintf("[SFX] Cannot suspend sequencer, sound will continue for a bit\n");
-		return SFX_OK;
+		return Common::kNoError;
 	} else
 		return seq->allstop();
 }
 
-static int rt_resume(void) {
+static Common::Error rt_resume(void) {
 	play_paused = 0;
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int rt_exit(void) {
-	int retval = SFX_OK;
-
+static Common::Error rt_exit(void) {
 	if (seq->close()) {
-		fprintf(stderr, "[SFX] Sequencer reported error on close\n");
-		retval = SFX_ERROR;
+		warning("[SFX] Sequencer reported error on close");
+		return Common::kUnknownError;
 	}
 
-	return retval;
+	return Common::kNoError;
 }
 
 sfx_player_t sfx_player_realtime = {

Modified: scummvm/trunk/engines/sci/sfx/player.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/player.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/player.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -41,65 +41,65 @@
 	const char *name;
 	const char *version;
 
-	int (*set_option)(char *name, char *value);
+	Common::Error (*set_option)(char *name, char *value);
 	/* Sets an option for player timing mechanism
 	** Parameters: (char *) name: The name describing what to set
 	**             (char *) value: The value to set
-	** Returns   : (int) SFX_OK, or SFX_ERROR if the name wasn't understood
+	** Returns   : (int) Common::kNoError, or Common::kUnknownError if the name wasn't understood
 	*/
 
-	int (*init)(ResourceManager *resmgr, int expected_latency);
+	Common::Error (*init)(ResourceManager *resmgr, int expected_latency);
 	/* Initializes the player
 	** Parameters: (ResourceManager *) resmgr: A resource manager for driver initialization
 	**             (int) expected_latency: Expected delay in between calls to 'maintenance'
 	**                   (in microseconds)
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
-	int (*add_iterator)(SongIterator *it, uint32 start_time);
+	Common::Error (*add_iterator)(SongIterator *it, uint32 start_time);
 	/* Adds an iterator to the song player
 	** Parameters: (songx_iterator_t *) it: The iterator to play
 	**             (uint32) start_time: The time to assume as the
 	**                        time the first MIDI command executes at
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	** The iterator should not be cloned (to avoid memory leaks) and
 	** may be modified according to the needs of the player.
 	** Implementors may use the 'sfx_iterator_combine()' function
 	** to add iterators onto their already existing iterators
 	*/
 
-	int (*fade_out)();
+	Common::Error (*fade_out)();
 	/* Fades out the currently playing song (within two seconds
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
-	int (*stop)();
+	Common::Error (*stop)();
 	/* Stops the currently playing song and deletes the associated iterator
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
-	int (*iterator_message)(const SongIterator::Message &msg);
+	Common::Error (*iterator_message)(const SongIterator::Message &msg);
 	/* Transmits a song iterator message to the active song
 	** Parameters: (SongIterator::Message) msg: The message to transmit
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	** OPTIONAL -- may be NULL
 	** If this method is not present, sending messages will stop
 	** and re-start playing, so it is preferred that it is present
 	*/
 
-	int (*pause)(); /* OPTIONAL -- may be NULL */
+	Common::Error (*pause)(); /* OPTIONAL -- may be NULL */
 	/* Pauses song playing
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
-	int (*resume)(); /* OPTIONAL -- may be NULL */
+	Common::Error (*resume)(); /* OPTIONAL -- may be NULL */
 	/* Resumes song playing after a pause
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
-	int (*exit)();
+	Common::Error (*exit)();
 	/* Stops the player
-	** Returns   : (int) SFX_OK on success, SFX_ERROR on failure
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError on failure
 	*/
 
 	void (*maintenance)(); /* OPTIONAL -- may be NULL */

Modified: scummvm/trunk/engines/sci/sfx/sci_midi.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sci_midi.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/sci_midi.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -28,12 +28,17 @@
 
 #include "sound/mididrv.h"
 #include "sound/softsynth/emumidi.h"
-#include "sci/sfx/sfx.h"
+#include "common/error.h"
 
 namespace Sci {
 
 class ResourceManager;
 
+enum {
+	MIDI_CHANNELS = 16
+};
+
+
 #define MIDI_RHYTHM_CHANNEL 9
 
 /* Special SCI sound stuff */

Modified: scummvm/trunk/engines/sci/sfx/seq/gm.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/seq/gm.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/seq/gm.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -32,7 +32,7 @@
 
 static midi_writer_t *writer = NULL;
 
-static int midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) {
+static Common::Error midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) {
 	sfx_instrument_map_t *instrument_map = sfx_instrument_map_load_sci(data, patch_len);
 
 	if (!instrument_map) {
@@ -43,19 +43,19 @@
 	writer = sfx_mapped_writer((midi_writer_t *) device, instrument_map);
 
 	if (!writer)
-		return SFX_ERROR;
+		return Common::kUnknownError;
 
 	if (writer->reset_timer)
 		writer->reset_timer(writer);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_close(void) {
-	return SFX_OK;
+static Common::Error midi_gm_close(void) {
+	return Common::kNoError;
 }
 
-static int midi_gm_event(byte command, int argc, byte *argv) {
+static Common::Error midi_gm_event(byte command, int argc, byte *argv) {
 	byte data[4];
 
 	assert(argc < 4);
@@ -64,24 +64,24 @@
 
 	writer->write(writer, data, argc + 1);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_delay(int ticks) {
+static Common::Error midi_gm_delay(int ticks) {
 	writer->delay(writer, ticks);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_reset_timer(uint32 ts) {
+static Common::Error midi_gm_reset_timer(uint32 ts) {
 	writer->reset_timer(writer);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 #define MIDI_MASTER_VOLUME_LEN 8
 
-static int midi_gm_volume(uint8 volume) {
+static Common::Error midi_gm_volume(uint8 volume) {
 	byte data[MIDI_MASTER_VOLUME_LEN] = {
 		0xf0,
 		0x7f,
@@ -97,10 +97,10 @@
 	if (writer->flush)
 		writer->flush(writer);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_allstop(void) {
+static Common::Error midi_gm_allstop(void) {
 	byte data[3] = { 0xb0,
 	                 0x78, /* all sound off */
 	                 0
@@ -115,10 +115,10 @@
 	if (writer->flush)
 		writer->flush(writer);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_reverb(int reverb) {
+static Common::Error midi_gm_reverb(int reverb) {
 	byte data[3] = { 0xb0,
 	                 91, /* set reverb */
 	                 reverb
@@ -134,11 +134,11 @@
 	if (writer->flush)
 		writer->flush(writer);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int midi_gm_set_option(char *x, char *y) {
-	return SFX_ERROR;
+static Common::Error midi_gm_set_option(char *x, char *y) {
+	return Common::kUnknownError;
 }
 
 sfx_sequencer_t sfx_sequencer_gm = {

Modified: scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -258,31 +258,31 @@
 	return r;
 }
 
-static int set_bend_range(midi_writer_t *writer, int channel, int range) {
+static Common::Error set_bend_range(midi_writer_t *writer, int channel, int range) {
 	byte buf[3] = {0xb0, 0x65, 0x00};
 
 	buf[0] |= channel & 0xf;
-	if (writer->write(writer, buf, 3) != SFX_OK)
-		return SFX_ERROR;
+	if (writer->write(writer, buf, 3) != Common::kNoError)
+		return Common::kUnknownError;
 
 	buf[1] = 0x64;
-	if (writer->write(writer, buf, 3) != SFX_OK)
-		return SFX_ERROR;
+	if (writer->write(writer, buf, 3) != Common::kNoError)
+		return Common::kUnknownError;
 
 	buf[1] = 0x06;
 	buf[2] = BOUND_127(range);
-	if (writer->write(writer, buf, 3) != SFX_OK)
-		return SFX_ERROR;
+	if (writer->write(writer, buf, 3) != Common::kNoError)
+		return Common::kUnknownError;
 
 	buf[1] = 0x26;
 	buf[2] = 0;
-	if (writer->write(writer, buf, 3) != SFX_OK)
-		return SFX_ERROR;
+	if (writer->write(writer, buf, 3) != Common::kNoError)
+		return Common::kUnknownError;
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
-static int write_decorated(decorated_midi_writer_t *self, byte *buf, int len) {
+static Common::Error write_decorated(decorated_midi_writer_t *self, byte *buf, int len) {
 	sfx_instrument_map_t *map = self->map;
 	int op = *buf & 0xf0;
 	int chan = *buf & 0x0f;
@@ -300,18 +300,18 @@
 		self->patches[chan] = map->patch_map[patch];
 
 		if (instrument == SFX_UNMAPPED || instrument == SFX_MAPPED_TO_RHYTHM)
-			return SFX_OK;
+			return Common::kNoError;
 
 		assert(len >= 2);
 		buf[1] = bound_hard_127(instrument, "patch lookup");
 
-		if (self->writer->write(self->writer, buf, len) != SFX_OK)
-			return SFX_ERROR;
+		if (self->writer->write(self->writer, buf, len) != Common::kNoError)
+			return Common::kUnknownError;
 
 		if (bend_range != SFX_UNMAPPED)
 			return set_bend_range(self->writer, chan, bend_range);
 
-		return SFX_OK;
+		return Common::kNoError;
 	}
 
 	if (chan == MIDI_RHYTHM_CHANNEL || patch == SFX_MAPPED_TO_RHYTHM) {
@@ -332,7 +332,7 @@
 			}
 
 			if (instrument == SFX_UNMAPPED)
-				return SFX_OK;
+				return Common::kNoError;
 
 			assert(len >= 3);
 
@@ -365,7 +365,7 @@
 		/* Instrument channel handling */
 
 		if (patch == SFX_UNMAPPED)
-			return SFX_OK;
+			return Common::kNoError;
 
 		switch (op) {
 		case 0x80:
@@ -485,9 +485,9 @@
 	strcpy(retval->name, writer->name);
 	strcat(retval->name, NAME_SUFFIX);
 
-	retval->init = (int (*)(midi_writer_t *)) init_decorated;
-	retval->set_option = (int (*)(midi_writer_t *, char *, char *)) set_option_decorated;
-	retval->write = (int (*)(midi_writer_t *, byte *, int)) write_decorated;
+	retval->init = (Common::Error (*)(midi_writer_t *)) init_decorated;
+	retval->set_option = (Common::Error (*)(midi_writer_t *, char *, char *)) set_option_decorated;
+	retval->write = (Common::Error (*)(midi_writer_t *, byte *, int)) write_decorated;
 	retval->delay = (void (*)(midi_writer_t *, int)) delay_decorated;
 	retval->flush = (void (*)(midi_writer_t *)) flush_decorated;
 	retval->reset_timer = (void (*)(midi_writer_t *)) reset_timer_decorated;

Modified: scummvm/trunk/engines/sci/sfx/seq/oss-adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/seq/oss-adlib.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/seq/oss-adlib.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -322,11 +322,11 @@
 
 static int midi_adlib_delay(int ticks) {
 	SEQ_DELTA_TIME(ticks);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static int midi_adlib_set_option(char *name, char *value) {
-	return SFX_ERROR; /* No options are supported at this time */
+	return Common::kUnknownError; /* No options are supported at this time */
 }
 
 /* the driver struct */

Modified: scummvm/trunk/engines/sci/sfx/sequencer.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sequencer.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/sequencer.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -29,7 +29,7 @@
 
 #include "common/scummsys.h"
 
-#include "sci/sfx/sfx.h"
+#include "common/error.h"
 #include "sci/sfx/device.h"
 
 namespace Sci {
@@ -42,20 +42,20 @@
 
 	int device;  /* Type of device the sequencer depends on, may be SFX_DEVICE_NONE. */
 
-	int (*set_option)(char *name, char *value);
+	Common::Error (*set_option)(char *name, char *value);
 	/* Sets an option for the sequencing mechanism
 	** Parameters: (char *) name: The name describing what to set
 	**             (char *) value: The value to set
-	** Returns   : (int) SFX_OK, or SFX_ERROR if the name wasn't understood
+	** Returns   : (int) Common::kNoError, or Common::kUnknownError if the name wasn't understood
 	*/
 
-	int (*open)(int patch_len, byte *patch, int patch2_len, byte *patch2, void *device);
+	Common::Error (*open)(int patch_len, byte *patch, int patch2_len, byte *patch2, void *device);
 	/* Opens the sequencer for writing
 	** Parameters: (int) patch_len, patch2_len: Length of the patch data
 	**             (byte *) patch, patch2: Bulk patch data
 	**             (void *) device: A device matching the 'device' property, or NULL
 	**                              if the property is null.
-	** Returns   : (int) SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError otherwise
 	** The device should be initialized to a tick frequency of 60 Hz.
 	** 'patch' and 'patch_len' refer to the patch resource passed to open,
 	** as specified by the 'patchfile' property. 'patch' may be NULL if the
@@ -65,50 +65,50 @@
 	** data.
 	*/
 
-	int (*close)();
+	Common::Error (*close)();
 	/* Closes the sequencer
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
-	int (*event)(byte command, int argc, byte *argv);
+	Common::Error (*event)(byte command, int argc, byte *argv);
 	/* Plays a MIDI event
 	** Parameters: (byte) command: MIDI command to play
 	**             (int) argc: Number of arguments to the command
 	**             (byte *) argv: Pointer to additional arguments
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	** argv is guaranteed to point to a sufficiently large number of
 	** arguments, as indicated by 'command' and the MIDI standard.
 	** No 'running status' will be passed, 'command' will always be
 	** explicit.
 	*/
-	int (*delay)(int ticks); /* OPTIONAL -- may be NULL, but highly recommended */
+	Common::Error (*delay)(int ticks); /* OPTIONAL -- may be NULL, but highly recommended */
 	/* Inserts a delay (delta time) into the sequencer cue
 	** Parameters: (int) ticks: Number of 60 Hz ticks to delay
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
-	int (*reset_timer)(uint32 ts);
+	Common::Error (*reset_timer)(uint32 ts);
 	/* OPTIONAL -- may be NULL, but highly recommended in combination with delay() */
 	/* Resets the timer counter associated with the 'delay()' function
 	** Parameters: (uint32) ts: Timestamp of the base time
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
-	int (*allstop)(); /* OPTIONAL -- may be NULL */
+	Common::Error (*allstop)(); /* OPTIONAL -- may be NULL */
 	/* Stops playing everything in the sequencer queue
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
-	int (*volume)(uint8 volume);  /* OPTIONAL -- can be NULL */
+	Common::Error (*volume)(uint8 volume);  /* OPTIONAL -- can be NULL */
 	/* Sets the sequencer volume
 	** Parameters; (byte) volume: The volume to set, with 0 being mute and 127 full volume
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
-	int (*reverb)(int param); /* OPTIONAL -- may be NULL */
+	Common::Error (*reverb)(int param); /* OPTIONAL -- may be NULL */
 	/* Sets the device reverb
 	** Parameters; (int) param: The reverb to set
-	** Returns   : SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : Common::kNoError on success, Common::kUnknownError otherwise
 	*/
 
 	int patchfile, patchfile2; /* Patch resources to pass into the call to open(),

Deleted: scummvm/trunk/engines/sci/sfx/sfx.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/sfx.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -1,40 +0,0 @@
-/* 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_CORE_H
-#define SCI_SFX_SFX_CORE_H
-
-#include "common/scummsys.h"
-
-namespace Sci {
-
-#define SFX_OK 0
-#define SFX_ERROR -1
-
-#define MIDI_CHANNELS 16
-
-} // End of namespace Sci
-
-#endif // SCI_SFX_SFX_CORE_H

Modified: scummvm/trunk/engines/sci/sfx/sfx_pcm.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -26,7 +26,7 @@
 #ifndef SCI_SFX_SFX_PCM_H
 #define SCI_SFX_SFX_PCM_H
 
-#include "sci/sfx/sfx.h"
+#include "common/error.h"
 #include "sound/timestamp.h"
 
 namespace Sci {

Modified: scummvm/trunk/engines/sci/sfx/softseq/SN76496.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/SN76496.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq/SN76496.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -46,13 +46,13 @@
 /* Forward-declare the sequencer we are defining here */
 
 
-static int SN76496_set_option(sfx_softseq_t *self, const char *name, const char *value) {
-	return SFX_ERROR;
+static Common::Error SN76496_set_option(sfx_softseq_t *self, const char *name, const char *value) {
+	return Common::kUnknownError;
 }
 
-static int SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
+static Common::Error SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
 	int patch2_len) {
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void SN76496_exit(sfx_softseq_t *self) {

Modified: scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -446,23 +446,23 @@
 	return instrument;
 }
 
-static int ami_set_option(sfx_softseq_t *self, const char *name, const char *value) {
-	return SFX_ERROR;
+static Common::Error ami_set_option(sfx_softseq_t *self, const char *name, const char *value) {
+	return Common::kUnknownError;
 }
 
-static int ami_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) {
+static Common::Error ami_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) {
 	Common::File file;
 	byte header[40];
 	int i;
 
 	if (!file.open("bank.001")) {
 		sciprintf("[sfx:seq:amiga] Error: file bank.001 not found\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	if (file.read(header, 40) < 40) {
 		sciprintf("[sfx:seq:amiga] Error: failed to read header of file bank.001\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	for (i = 0; i < 256; i++)
@@ -491,18 +491,18 @@
 
 		if (!instrument) {
 			sciprintf("[sfx:seq:amiga] Error: failed to read bank.001\n");
-			return SFX_ERROR;
+			return Common::kUnknownError;
 		}
 
 		if (id < 0 || id > 255) {
 			sciprintf("[sfx:seq:amiga] Error: instrument ID out of bounds\n");
-			return SFX_ERROR;
+			return Common::kUnknownError;
 		}
 
 		bank.instruments[id] = instrument;
 	}
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void ami_exit(sfx_softseq_t *self) {

Modified: scummvm/trunk/engines/sci/sfx/softseq/fluidsynth.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/fluidsynth.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq/fluidsynth.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -51,11 +51,11 @@
 /* MIDI writer */
 
 static int fluidsynth_midi_init(struct _midi_writer *self) {
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static int fluidsynth_midi_set_option(struct _midi_writer *self, char *name, char *value) {
-	return SFX_ERROR;
+	return Common::kUnknownError;
 }
 
 static int fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) {
@@ -118,7 +118,7 @@
 	} else
 		sciprintf("FluidSynth: Skipping invalid message of %i bytes.\n", len);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void fluidsynth_midi_delay(struct _midi_writer *self, int ticks) {
@@ -154,13 +154,13 @@
 
 	if (0) {
 		sciprintf("FluidSynth ERROR: Mono sound output not supported.\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	gmseq = sfx_find_sequencer("General MIDI");
 	if (!gmseq) {
 		sciprintf("FluidSynth ERROR: Unable to find General MIDI sequencer.\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	settings = new_fluid_settings();
@@ -170,7 +170,7 @@
 		sciprintf("FluidSynth ERROR: Sample rate '%i' not supported. Valid "
 		          "range is (%i-%i).\n", SAMPLE_RATE, (int) min, (int) max);
 		delete_fluid_settings(settings);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	fluid_settings_setnum(settings, "synth.sample-rate", SAMPLE_RATE);
@@ -181,13 +181,13 @@
 	if ((sfont_id = fluid_synth_sfload(synth, soundfont, 1)) < 0) {
 		delete_fluid_synth(synth);
 		delete_fluid_settings(settings);
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	gmseq->open(data_length, data_ptr, data2_length, data2_ptr,
 	            &midi_writer_fluidsynth);
 
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void fluidsynth_exit(sfx_softseq_t *self) {
@@ -206,7 +206,7 @@
 }
 
 static int fluidsynth_set_option(sfx_softseq_t *self, const char *name, const char *value) {
-	return SFX_ERROR;
+	return Common::kUnknownError;
 }
 
 static void fluidsynth_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) {

Modified: scummvm/trunk/engines/sci/sfx/softseq/opl2.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/opl2.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq/opl2.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -46,8 +46,9 @@
 
 #include "sci/tools.h"
 #include "sci/sfx/iterator.h"
-#include "../softseq.h"
-#include "../adlib_sbi.h"
+#include "sci/sfx/softseq.h"
+#include "sci/sfx/adlib_sbi.h"
+#include "sci/sfx/sci_midi.h"
 
 #include "sound/fmopl.h"
 
@@ -404,14 +405,14 @@
 	YM3812UpdateOne(ym3812, ptr, count);
 }
 
-static int opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr,
+static Common::Error opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr,
 	int data2_length) {
 	int i;
 
 	/* load up the patch.003 file, parse out the instruments */
 	if (data_length < 1344) {
 		sciprintf("[sfx:seq:opl2] Invalid patch.003: Expected %d, got %d\n", 1344, data_length);
-		return -1;
+		return Common::kUnknownError;
 	}
 
 	for (i = 0; i < 48; i++)
@@ -423,13 +424,13 @@
 
 	if (!(ym3812 = makeAdlibOPL(SAMPLE_RATE))) {
 		sciprintf("[sfx:seq:opl2] Failure: Emulator init failed!\n");
-		return SFX_ERROR;
+		return Common::kUnknownError;
 	}
 
 	ready = 1;
 
 	opl2_allstop(self);
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 
@@ -543,8 +544,8 @@
 #endif
 }
 
-int opl2_set_option(sfx_softseq_t *self, const char *name, const char *value) {
-	return SFX_ERROR;
+static Common::Error opl2_set_option(sfx_softseq_t *self, const char *name, const char *value) {
+	return Common::kUnknownError;
 }
 
 void opl2_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) {

Modified: scummvm/trunk/engines/sci/sfx/softseq/pcspeaker.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/pcspeaker.cpp	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq/pcspeaker.cpp	2009-05-12 23:31:55 UTC (rev 40517)
@@ -40,13 +40,13 @@
 /* Forward-declare the sequencer we are defining here */
 
 
-static int sps_set_option(sfx_softseq_t *self, const char *name, const char *value) {
-	return SFX_ERROR;
+static Common::Error sps_set_option(sfx_softseq_t *self, const char *name, const char *value) {
+	return Common::kUnknownError;
 }
 
-static int sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
+static Common::Error sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
 	int patch2_len) {
-	return SFX_OK;
+	return Common::kNoError;
 }
 
 static void sps_exit(sfx_softseq_t *self) {
@@ -89,7 +89,7 @@
 #define BASE_NOTE 129	/* A10 */
 #define BASE_OCTAVE 10	/* A10, as I said */
 
-static int freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */
+static const int freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */
 	28160, /* A10 */
 	29834,
 	31608,

Modified: scummvm/trunk/engines/sci/sfx/softseq.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq.h	2009-05-12 23:31:02 UTC (rev 40516)
+++ scummvm/trunk/engines/sci/sfx/softseq.h	2009-05-12 23:31:55 UTC (rev 40517)
@@ -26,7 +26,7 @@
 #ifndef SCI_SFX_SOFTSEQ_H
 #define SCI_SFX_SOFTSEQ_H
 
-#include "sci/sfx/sfx.h"
+#include "common/error.h"
 #include "sci/sfx/sfx_pcm.h"
 #include "sci/sfx/sequencer.h"
 #include "sci/tools.h"
@@ -38,7 +38,7 @@
 	const char *name;
 	const char *version;
 
-	int (*set_option)(sfx_softseq_t *self, const char *name, const char *value);
+	Common::Error (*set_option)(sfx_softseq_t *self, const char *name, const char *value);
 	/* Sets an option for the sequencer
 	** Parameters: (sfx_softseq_t *) self: Self reference
 	**             (const char *) name: Name of the option to set
@@ -46,7 +46,7 @@
 	** Returns   : (int) GFX_OK on success, or GFX_ERROR if not supported
 	*/
 
-	int (*init)(sfx_softseq_t *self, byte *res_data, int res_size,
+	Common::Error (*init)(sfx_softseq_t *self, byte *res_data, int res_size,
 	        byte *res2_data, int res2_size);
 	/* Initialises the sequencer
 	** Parameters: (sfx_softseq_t *) self: Self reference
@@ -54,7 +54,7 @@
 	**             (int) res_size: Number of bytes in 'res_data'
 	**             (byte *) res2_data: Resource data for 'patch2_nr' (see below)
 	**             (int) res2_size: Number of bytes in 'res2_data'
-	** Returns   : (int) SFX_OK on success, SFX_ERROR otherwise
+	** Returns   : (int) Common::kNoError on success, Common::kUnknownError otherwise
 	** Note that 'res_data' is only a valid pointer for this call. If the
 	** data is needed later during execution, it should be backed up internally.
 	** If the requested resource is not available, res_data will be NULL


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list