aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/core.cpp63
-rw-r--r--engines/sci/sfx/device/devices.cpp4
-rw-r--r--engines/sci/sfx/iterator.cpp95
-rw-r--r--engines/sci/sfx/mixer/soft.cpp29
-rw-r--r--engines/sci/sfx/player/polled.cpp3
-rw-r--r--engines/sci/sfx/player/realtime.cpp11
-rw-r--r--engines/sci/sfx/softseq/SN76496.cpp6
-rw-r--r--engines/sci/sfx/softseq/opl2.cpp6
-rw-r--r--engines/sci/sfx/softseq/pcspeaker.cpp4
-rw-r--r--engines/sci/sfx/time.cpp3
10 files changed, 110 insertions, 114 deletions
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp
index 7418c3be17..f8d3e81c8e 100644
--- a/engines/sci/sfx/core.cpp
+++ b/engines/sci/sfx/core.cpp
@@ -130,22 +130,22 @@ static void
_dump_playing_list(sfx_state_t *self, char *msg) {
song_t *song = self->song;
- sciprintf("[] Song list : [ ");
+ fprintf(stderr, "[] Song list : [ ");
song = *(self->songlib.lib);
while (song) {
- sciprintf("%08lx:%d ", song->handle, song->status);
+ fprintf(stderr, "%08lx:%d ", song->handle, song->status);
song = song->next_playing;
}
- sciprintf("]\n");
+ fprintf(stderr, "]\n");
- sciprintf("[] Play list (%s) : [ " , msg);
+ fprintf(stderr, "[] Play list (%s) : [ " , msg);
while (song) {
- sciprintf("%08lx ", song->handle);
+ fprintf(stderr, "%08lx ", song->handle);
song = song->next_playing;
}
- sciprintf("]\n");
+ fprintf(stderr, "]\n");
}
#endif
@@ -154,17 +154,17 @@ _dump_songs(sfx_state_t *self) {
#if 0
song_t *song = self->song;
- sciprintf("Cue iterators:\n");
+ fprintf(stderr, "Cue iterators:\n");
song = *(self->songlib.lib);
while (song) {
- sciprintf(" **\tHandle %08x (p%d): status %d\n",
+ fprintf(stderr, " **\tHandle %08x (p%d): status %d\n",
song->handle, song->priority, song->status);
SIMSG_SEND(song->it, SIMSG_PRINT(1));
song = song->next;
}
if (player) {
- sciprintf("Audio iterator:\n");
+ fprintf(stderr, "Audio iterator:\n");
player->iterator_message(songit_make_message(0, SIMSG_PRINT(1)));
}
#endif
@@ -239,8 +239,8 @@ _sfx_set_song_status(sfx_state_t *self, song_t *song, int status) {
break;
default:
- warning("%s L%d: Attempt to set invalid song"
- " state %d", __FILE__, __LINE__, status);
+ fprintf(stderr, "%s L%d: Attempt to set invalid song"
+ " state %d!\n", __FILE__, __LINE__, status);
return;
}
@@ -400,7 +400,7 @@ static int _sfx_timer_active = 0; /* Timer toggle */
int
sfx_play_iterator_pcm(song_iterator_t *it, song_handle_t handle) {
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Playing PCM: %08lx", handle);
+ fprintf(stderr, "[sfx-core] Playing PCM: %08lx\n", handle);
#endif
if (mixer) {
sfx_pcm_feed_t *newfeed = it->get_pcm_feed(it);
@@ -452,7 +452,7 @@ sfx_init(sfx_state_t *self, ResourceManager *resmgr, int flags) {
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Initialising: flags=%x", flags);
+ fprintf(stderr, "[sfx-core] Initialising: flags=%x\n", flags);
#endif
/*------------------*/
@@ -463,8 +463,8 @@ sfx_init(sfx_state_t *self, ResourceManager *resmgr, int flags) {
timer = &sfx_timer_scummvm;
if (!timer) {
- warning("[SFX] " __FILE__": Could not find timing mechanism");
- warning("[SFX] Disabled sound support");
+ fprintf(stderr, "[SFX] " __FILE__": Could not find timing mechanism\n");
+ fprintf(stderr, "[SFX] Disabled sound support\n");
pcm_device = NULL;
player = NULL;
mixer = NULL;
@@ -528,7 +528,7 @@ sfx_exit(sfx_state_t *self) {
callbackMutex->lock();
_sfx_timer_active = 0;
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Uninitialising");
+ fprintf(stderr, "[sfx-core] Uninitialising\n");
#endif
song_lib_free(self->songlib);
@@ -563,7 +563,7 @@ time_le(GTimeVal a, GTimeVal b) {
void
sfx_suspend(sfx_state_t *self, int suspend) {
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Suspending? = %d", suspend);
+ fprintf(stderr, "[sfx-core] Suspending? = %d\n", suspend);
#endif
if (suspend && (!self->suspended)) {
/* suspend */
@@ -600,7 +600,7 @@ sfx_poll(sfx_state_t *self, song_handle_t *handle, int *cue)
*handle = self->song->handle;
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Polling any (%08lx)", *handle);
+ fprintf(stderr, "[sfx-core] Polling any (%08lx)\n", *handle);
#endif
return sfx_poll_specific(self, *handle, cue);
}
@@ -619,7 +619,7 @@ sfx_poll_specific(sfx_state_t *self, song_handle_t handle, int *cue) {
return 0; /* Song not playing */
if (self->debug & SFX_DEBUG_CUES) {
- warning("[SFX:CUE] Polled song %08lx ", handle);
+ fprintf(stderr, "[SFX:CUE] Polled song %08lx ", handle);
}
while (1) {
@@ -666,6 +666,9 @@ sfx_poll_specific(sfx_state_t *self, song_handle_t handle, int *cue) {
break;
}
}
+ if (self->debug & SFX_DEBUG_CUES) {
+ fprintf(stderr, "\n");
+ }
}
@@ -678,10 +681,10 @@ sfx_add_song(sfx_state_t *self, song_iterator_t *it, int priority, song_handle_t
song_t *song = song_lib_find(self->songlib, handle);
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Adding song: %08lx at %d, it=%p", handle, priority, it);
+ fprintf(stderr, "[sfx-core] Adding song: %08lx at %d, it=%p\n", handle, priority, it);
#endif
if (!it) {
- warning("[SFX] Attempt to add empty song with handle %08lx", handle);
+ fprintf(stderr, "[SFX] Attempt to add empty song with handle %08lx\n", handle);
return -1;
}
@@ -697,7 +700,7 @@ sfx_add_song(sfx_state_t *self, song_iterator_t *it, int priority, song_handle_t
if (song) {
_sfx_set_song_status(self, song, SOUND_STATUS_STOPPED);
- warning("Overwriting old song (%08lx) ...", handle);
+ fprintf(stderr, "Overwriting old song (%08lx) ...\n", handle);
if (song->status == SOUND_STATUS_PLAYING
|| song->status == SOUND_STATUS_SUSPENDED) {
warning("Unexpected (error): Song %ld still playing/suspended (%d)",
@@ -725,7 +728,7 @@ sfx_add_song(sfx_state_t *self, song_iterator_t *it, int priority, song_handle_t
void
sfx_remove_song(sfx_state_t *self, song_handle_t handle) {
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Removing song: %08lx", handle);
+ fprintf(stderr, "[sfx-core] Removing song: %08lx\n", handle);
#endif
if (self->song && self->song->handle == handle)
self->song = NULL;
@@ -747,7 +750,7 @@ sfx_song_set_status(sfx_state_t *self, song_handle_t handle, int status) {
song_t *song = song_lib_find(self->songlib, handle);
ASSERT_SONG(song);
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Setting song status to %d"
+ fprintf(stderr, "[sfx-core] Setting song status to %d"
" (0:stop, 1:play, 2:susp, 3:wait): %08lx\n", status, handle);
#endif
@@ -767,7 +770,7 @@ sfx_song_set_fade(sfx_state_t *self, song_handle_t handle,
ASSERT_SONG(song);
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Setting fade params of %08lx to "
+ fprintf(stderr, "[sfx-core] Setting fade params of %08lx to "
"final volume %d in steps of %d per %d ticks. %s.",
handle, fade->final_volume, fade->step_size, fade->ticks_per_step,
stopmsg[fade->action]);
@@ -783,7 +786,7 @@ sfx_song_renice(sfx_state_t *self, song_handle_t handle, int priority) {
song_t *song = song_lib_find(self->songlib, handle);
ASSERT_SONG(song);
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Renicing song %08lx to %d",
+ fprintf(stderr, "[sfx-core] Renicing song %08lx to %d\n",
handle, priority);
#endif
@@ -800,7 +803,7 @@ sfx_song_set_loops(sfx_state_t *self, song_handle_t handle, int loops) {
ASSERT_SONG(song);
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Setting loops on %08lx to %d",
+ fprintf(stderr, "[sfx-core] Setting loops on %08lx to %d\n",
handle, loops);
#endif
songit_handle_message(&(song->it), msg);
@@ -820,7 +823,7 @@ sfx_song_set_hold(sfx_state_t *self, song_handle_t handle, int hold) {
song->hold = hold;
#ifdef DEBUG_SONG_API
- warning("[sfx-core] Setting hold on %08lx to %d",
+ fprintf(stderr, "[sfx-core] Setting hold on %08lx to %d\n",
handle, loops);
#endif
songit_handle_message(&(song->it), msg);
@@ -850,7 +853,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
if (command == 0xb0 &&
arg1 == SCI_MIDI_CHANNEL_MUTE) {
- sciprintf("TODO: channel mute (channel %d %s)", channel,
+ sciprintf("TODO: channel mute (channel %d %s)!\n", channel,
channel_state[arg2]);
/* We need to have a GET_PLAYMASK interface to use
here. SET_PLAYMASK we've got.
@@ -898,7 +901,7 @@ sfx_set_volume(sfx_state_t *self, int volume) {
void
sfx_all_stop(sfx_state_t *self) {
#ifdef DEBUG_SONG_API
- warning("[sfx-core] All stop");
+ fprintf(stderr, "[sfx-core] All stop\n");
#endif
song_lib_free(self->songlib);
diff --git a/engines/sci/sfx/device/devices.cpp b/engines/sci/sfx/device/devices.cpp
index 6c4da7e50a..eb2923a1e0 100644
--- a/engines/sci/sfx/device/devices.cpp
+++ b/engines/sci/sfx/device/devices.cpp
@@ -23,8 +23,6 @@
*
*/
-#include "common/util.h"
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -76,7 +74,7 @@ sfx_find_device(int type, char *name) {
if (dev) {
if (dev->init(dev)) {
- error("[SFX] Opening device '%s' failed\n",
+ fprintf(stderr, "[SFX] Opening device '%s' failed\n",
dev->name);
return NULL;
}
diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp
index bc2d2f5a8c..3111cf5e40 100644
--- a/engines/sci/sfx/iterator.cpp
+++ b/engines/sci/sfx/iterator.cpp
@@ -25,9 +25,8 @@
/* Song iterators */
-#include "common/util.h"
-
#include <stdio.h>
+#include "common/util.h"
#include "sci/include/sfx_iterator_internal.h"
#include "sci/include/sfx_player.h"
#include "sci/include/resource.h"
@@ -45,9 +44,9 @@ static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0,
void
print_tabs_id(int nr, songit_id_t id) {
while (nr-- > 0)
- error("\t");
+ fprintf(stderr, "\t");
- error("[%08lx] ", id);
+ fprintf(stderr, "[%08lx] ", id);
}
#ifndef HAVE_MEMCHR
@@ -89,14 +88,14 @@ _common_init(base_song_iterator_t *self) {
#define CHECK_FOR_END_ABSOLUTE(offset) \
if (offset > self->size) { \
- error(SIPFX "Reached end of song without terminator (%x/%x) at %d", offset, self->size, __LINE__); \
+ fprintf(stderr, SIPFX "Reached end of song without terminator (%x/%x) at %d!\n", offset, self->size, __LINE__); \
return SI_FINISHED; \
}
#define CHECK_FOR_END(offset_augment) \
if ((channel->offset + (offset_augment)) > channel->end) { \
channel->state = SI_STATE_FINISHED; \
- error(SIPFX "Reached end of track %d without terminator (%x+%x/%x) at %d", channel->id, channel->offset, offset_augment, channel->end, __LINE__); \
+ fprintf(stderr, SIPFX "Reached end of track %d without terminator (%x+%x/%x) at %d!\n", channel->id, channel->offset, offset_augment, channel->end, __LINE__); \
return SI_FINISHED; \
}
@@ -174,7 +173,7 @@ _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf, int *res
}
if (cmd == 0xfe) {
- error("song iterator subsystem: Corrupted sound resource detected.\n");
+ fprintf(stderr, "song iterator subsystem: Corrupted sound resource detected.\n");
return SI_FINISHED;
}
@@ -185,9 +184,9 @@ _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf, int *res
#if 0
if (1) {
- error("[IT]: off=%x, cmd=%02x, takes %d args ",
+ fprintf(stderr, "[IT]: off=%x, cmd=%02x, takes %d args ",
channel->offset - 1, cmd, paramsleft);
- error("[%02x %02x <%02x> %02x %02x %02x]\n",
+ fprintf(stderr, "[%02x %02x <%02x> %02x %02x %02x]\n",
self->data[channel->offset-3],
self->data[channel->offset-2],
self->data[channel->offset-1],
@@ -225,19 +224,19 @@ _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf, int *res
if (cmd == SCI_MIDI_EOT) {
/* End of track? */
_reset_synth_channels(self, channel);
- /* error("eot; loops = %d, notesplayed=%d\n", self->loops, channel->notes_played);*/
+ /* fprintf(stderr, "eot; loops = %d, notesplayed=%d\n", self->loops, channel->notes_played);*/
if (self->loops > 1 /* && channel->notes_played*/) {
/* If allowed, decrement the number of loops */
if (!(flags & PARSE_FLAG_LOOPS_UNLIMITED))
*result = --self->loops;
#ifdef DEBUG_DECODING
- error("%s L%d: (%p):%d Looping ", __FILE__, __LINE__, self, channel->id);
+ fprintf(stderr, "%s L%d: (%p):%d Looping ", __FILE__, __LINE__, self, channel->id);
if (flags & PARSE_FLAG_LOOPS_UNLIMITED)
- error("(indef.)");
+ fprintf(stderr, "(indef.)");
else
- error("(%d)", self->loops);
- error(" %x -> %x\n",
+ fprintf(stderr, "(%d)", self->loops);
+ fprintf(stderr, " %x -> %x\n",
channel->offset, channel->loop_offset);
#endif
channel->offset = channel->loop_offset;
@@ -245,12 +244,12 @@ _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf, int *res
channel->state = SI_STATE_DELTA_TIME;
channel->total_timepos = channel->loop_timepos;
channel->last_cmd = 0xfe;
- warning("Looping song iterator %08lx.", self->ID);
+ fprintf(stderr, "Looping song iterator %08lx.\n", self->ID);
return SI_LOOP;
} else {
channel->state = SI_STATE_FINISHED;
#ifdef DEBUG_DECODING
- error("%s L%d: (%p):%d EOT because"
+ fprintf(stderr, "%s L%d: (%p):%d EOT because"
" %d notes, %d loops\n",
__FILE__, __LINE__, self, channel->id,
channel->notes_played, self->loops);
@@ -393,12 +392,12 @@ _sci_midi_process_state(base_song_iterator_t *self, unsigned char *buf, int *res
channel->state = SI_STATE_FINISHED;
delay = (size * 50 + format.rate - 1) / format.rate; /* number of ticks to completion*/
- error("delaying %d ticks\n", delay);
+ fprintf(stderr, "delaying %d ticks\n", delay);
return delay;
}
case SI_STATE_UNINITIALISED:
- error(SIPFX "Attempt to read command from uninitialized iterator");
+ fprintf(stderr, SIPFX "Attempt to read command from uninitialized iterator!\n");
self->init((song_iterator_t *) self);
return self->next((song_iterator_t *) self, buf, result);
@@ -437,7 +436,7 @@ _sci_midi_process_state(base_song_iterator_t *self, unsigned char *buf, int *res
if (self->active_channels)
--(self->active_channels);
#ifdef DEBUG_DECODING
- error("%s L%d: (%p):%d Finished channel, %d channels left\n",
+ fprintf(stderr, "%s L%d: (%p):%d Finished channel, %d channels left\n",
__FILE__, __LINE__, self, channel->id,
self->active_channels);
#endif
@@ -454,7 +453,7 @@ _sci_midi_process_state(base_song_iterator_t *self, unsigned char *buf, int *res
}
default:
- error(SIPFX "Invalid iterator state %d",
+ fprintf(stderr, SIPFX "Invalid iterator state %d!\n",
channel->state);
BREAKPOINT();
return SI_FINISHED;
@@ -513,8 +512,8 @@ _sci0_get_pcm_data(sci0_song_iterator_t *self,
self->size - offset);
if (!fc) {
- error(SIPFX "Warning: Playing unterminated"
- " song");
+ fprintf(stderr, SIPFX "Warning: Playing unterminated"
+ " song!\n");
return 1;
}
@@ -527,7 +526,7 @@ _sci0_get_pcm_data(sci0_song_iterator_t *self,
}
if (!found_it) {
- error(SIPFX
+ fprintf(stderr, SIPFX
"Warning: Song indicates presence of PCM, but"
" none found (finally at offset %04x)\n", offset);
@@ -546,9 +545,9 @@ _sci0_get_pcm_data(sci0_song_iterator_t *self,
if (offset + SCI0_PCM_DATA_OFFSET + size != self->size) {
int d = offset + SCI0_PCM_DATA_OFFSET + size - self->size;
- error(SIPFX
+ fprintf(stderr, SIPFX
"Warning: PCM advertizes %d bytes of data, but %d"
- " bytes are trailing in the resource",
+ " bytes are trailing in the resource!\n",
size, self->size - (offset + SCI0_PCM_DATA_OFFSET));
if (d > 0)
@@ -585,7 +584,7 @@ _sci0_handle_message(sci0_song_iterator_t *self, song_iterator_message_t msg) {
case _SIMSG_BASEMSG_PRINT:
print_tabs_id(msg.args[0].i, self->ID);
- error("SCI0: dev=%d, active-chan=%d, size=%d, loops=%d\n",
+ fprintf(stderr, "SCI0: dev=%d, active-chan=%d, size=%d, loops=%d\n",
self->device_id, self->active_channels, self->size,
self->loops);
break;
@@ -600,7 +599,7 @@ _sci0_handle_message(sci0_song_iterator_t *self, song_iterator_message_t msg) {
memcpy(mem, self, tsize);
sci_refcount_incref(mem->data);
#ifdef DEBUG_VERBOSE
- error("** CLONE INCREF for new %p from %p at %p\n", mem, self, mem->data);
+ fprintf(stderr, "** CLONE INCREF for new %p from %p at %p\n", mem, self, mem->data);
#endif
return (struct _song_iterator *) mem; /* Assume caller has another copy of this */
}
@@ -696,7 +695,7 @@ _sci0_init(sci0_song_iterator_t *self) {
static void
_sci0_cleanup(sci0_song_iterator_t *self) {
#ifdef DEBUG_VERBOSE
- error("** FREEING it %p: data at %p\n", self, self->data);
+ fprintf(stderr, "** FREEING it %p: data at %p\n", self, self->data);
#endif
if (self->data)
sci_refcount_decref(self->data);
@@ -750,7 +749,7 @@ _sci1_sample_init(sci1_song_iterator_t *self, int offset) {
sample->data = self->data + offset + 10;
#ifdef DEBUG_VERBOSE
- error("[SAMPLE] %x/%x/%x/%x l=%x\n",
+ fprintf(stderr, "[SAMPLE] %x/%x/%x/%x l=%x\n",
offset + 10, begin, end, self->size, length);
#endif
@@ -1083,7 +1082,7 @@ _sci1_process_next_command(sci1_song_iterator_t *self,
}
} else if (retval == SI_FINISHED) {
#ifdef DEBUG
- error("FINISHED some channel\n");
+ fprintf(stderr, "FINISHED some channel\n");
#endif
} else if (retval > 0) {
int sd ;
@@ -1119,7 +1118,7 @@ static struct _song_iterator *
playmask |= self->channels[i].playmask;
print_tabs_id(msg.args[0].i, self->ID);
- error("SCI1: chan-nr=%d, playmask=%04x\n",
+ fprintf(stderr, "SCI1: chan-nr=%d, playmask=%04x\n",
self->channels_nr, playmask);
}
break;
@@ -1233,7 +1232,7 @@ static struct _song_iterator *
}
default:
- error(SIPFX "Unsupported command %d to"
+ fprintf(stderr, SIPFX "Unsupported command %d to"
" SCI1 iterator", msg.type);
}
return (song_iterator_t *) self;
@@ -1303,7 +1302,7 @@ _cleanup_iterator_handle_message(song_iterator_t *i, song_iterator_message_t msg
if (msg.recipient == _SIMSG_BASEMSG_PRINT
&& msg.type == _SIMSG_BASEMSG_PRINT) {
print_tabs_id(msg.args[0].i, i->ID);
- error("CLEANUP\n");
+ fprintf(stderr, "CLEANUP\n");
}
return NULL;
@@ -1406,7 +1405,7 @@ _ff_handle_message(fast_forward_song_iterator_t *self,
case _SIMSG_BASEMSG_PRINT:
print_tabs_id(msg.args[0].i, self->ID);
- error("PLASTICWRAP:\n");
+ fprintf(stderr, "PLASTICWRAP:\n");
msg.args[0].i++;
songit_handle_message(&(self->delegate), msg);
break;
@@ -1479,7 +1478,7 @@ _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
int retid;
#ifdef DEBUG_TEE_ITERATOR
- error("[Tee] %02x\n", it->status);
+ fprintf(stderr, "[Tee] %02x\n", it->status);
#endif
if (!(it->status & (TEE_LEFT_ACTIVE | TEE_RIGHT_ACTIVE)))
@@ -1494,7 +1493,7 @@ _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
/* Not all are is active? */
int which = 0;
#ifdef DEBUG_TEE_ITERATOR
- error("\tRequesting transformation...\n");
+ fprintf(stderr, "\tRequesting transformation...\n");
#endif
if (it->status & TEE_LEFT_ACTIVE)
which = TEE_LEFT;
@@ -1528,7 +1527,7 @@ _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
it->status |= ready_masks[i];
#ifdef DEBUG_TEE_ITERATOR
- error("\t Must check %d: %d\n", i,
+ fprintf(stderr, "\t Must check %d: %d\n", i,
it->children[i].retval);
#endif
@@ -1539,7 +1538,7 @@ _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
it->status &= ~active_masks[i];
/* Recurse to complete */
#ifdef DEBUG_TEE_ITERATOR
- error("\t Child %d signalled completion, recursing w/ status %02x\n", i, it->status);
+ fprintf(stderr, "\t Child %d signalled completion, recursing w/ status %02x\n", i, it->status);
#endif
return _tee_read_next_command(it, buf, result);
} else if (it->children[i].retval == SI_PCM) {
@@ -1560,7 +1559,7 @@ _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
retid = TEE_RIGHT;
#ifdef DEBUG_TEE_ITERATOR
- error("\tl:%d / r:%d / chose %d\n",
+ fprintf(stderr, "\tl:%d / r:%d / chose %d\n",
it->children[TEE_LEFT].retval, it->children[TEE_RIGHT].retval, retid);
#endif
#if 0
@@ -1624,7 +1623,7 @@ _tee_handle_message(tee_song_iterator_t *self, song_iterator_message_t msg) {
case _SIMSG_BASEMSG_PRINT:
print_tabs_id(msg.args[0].i, self->ID);
- error("TEE:\n");
+ fprintf(stderr, "TEE:\n");
msg.args[0].i++;
break; /* And continue with our children */
@@ -1755,7 +1754,7 @@ songit_new_tee(song_iterator_t *left, song_iterator_t *right, int may_destroy) {
if (firstfree == MIDI_CHANNELS) {
incomplete_map = 1;
- error("[songit-tee <%08lx,%08lx>] "
+ fprintf(stderr, "[songit-tee <%08lx,%08lx>] "
"Could not remap right channel #%d:"
" Out of channels\n",
left->ID, right->ID, i);
@@ -1769,14 +1768,14 @@ songit_new_tee(song_iterator_t *left, song_iterator_t *right, int may_destroy) {
#ifdef DEBUG_TEE_ITERATOR
if (incomplete_map) {
int c;
- error("[songit-tee <%08lx,%08lx>] Channels:"
+ fprintf(stderr, "[songit-tee <%08lx,%08lx>] Channels:"
" %04x <- %04x | %04x\n",
left->ID, right->ID,
it->channel_mask,
left->channel_mask, right->channel_mask);
for (c = 0 ; c < 2; c++)
for (i = 0 ; i < 16; i++)
- error(" map [%d][%d] -> %d\n",
+ fprintf(stderr, " map [%d][%d] -> %d\n",
c, i, it->children[c].channel_remap[i]);
}
#endif
@@ -1824,14 +1823,14 @@ songit_next(song_iterator_t **it, unsigned char *buf, int *result, int mask) {
do {
retval = (*it)->next(*it, buf, result);
if (retval == SI_MORPH) {
- printf(" Morphing %p (stored at %p)\n", (void *)*it, (void *)it);
+ fprintf(stderr, " Morphing %p (stored at %p)\n", (void *)*it, (void *)it);
if (!SIMSG_SEND((*it), SIMSG_ACK_MORPH)) {
BREAKPOINT();
- } else printf("SI_MORPH successful\n");
+ } else fprintf(stderr, "SI_MORPH successful\n");
}
if (retval == SI_FINISHED)
- printf("[song-iterator] Song finished. mask = %04x, cm=%04x\n",
+ fprintf(stderr, "[song-iterator] Song finished. mask = %04x, cm=%04x\n",
mask, (*it)->channel_mask);
if (retval == SI_FINISHED
&& (mask & IT_READER_MAY_CLEAN)
@@ -2007,7 +2006,7 @@ song_iterator_add_death_listener(song_iterator_t *it,
void *client,
void (*notify)(void *self, void *notifier)) {
if (it->death_listeners_nr >= SONGIT_MAX_LISTENERS) {
- error("FATAL: Too many death listeners for song"
+ fprintf(stderr, "FATAL: Too many death listeners for song"
" iterator\n");
BREAKPOINT();
exit(1);
@@ -2036,7 +2035,7 @@ song_iterator_remove_death_listener(song_iterator_t *it,
}
}
- error("FATAL: Could not remove death listener from "
+ fprintf(stderr, "FATAL: Could not remove death listener from "
"song iterator\n");
BREAKPOINT();
exit(1);
diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp
index 4f28275bec..00468798c8 100644
--- a/engines/sci/sfx/mixer/soft.cpp
+++ b/engines/sci/sfx/mixer/soft.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "common/util.h"
#include "../mixer.h"
#include "sci/include/sci_memory.h"
@@ -51,9 +50,9 @@ static volatile int mixer_lock = 0;
/*#define DEBUG_LOCKS*/
#ifdef DEBUG_LOCKS
-# define DEBUG_ACQUIRE warning("[ -LOCK -] ACKQ %d: %d", __LINE__, mixer_lock)
-# define DEBUG_WAIT warning("[ -LOCK -] WAIT %d: %d", __LINE__, mixer_lock);
-# define DEBUG_RELEASE ; warning("[ -LOCK -] REL %d: %d", __LINE__, mixer_lock);
+# define DEBUG_ACQUIRE fprintf(stderr, "[ -LOCK -] ACKQ %d: %d\n", __LINE__, mixer_lock)
+# define DEBUG_WAIT fprintf(stderr, "[ -LOCK -] WAIT %d: %d\n", __LINE__, mixer_lock);
+# define DEBUG_RELEASE ; fprintf(stderr, "[ -LOCK -] REL %d: %d\n", __LINE__, mixer_lock);
#else
# define DEBUG_ACQUIRE
# define DEBUG_WAIT
@@ -167,7 +166,7 @@ mix_subscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
fs->buf_size = 2 + /* Additional safety */
(self->dev->buf_size *
(1 + (feed->conf.rate / self->dev->conf.rate)));
- warning(" ---> %d/%d/%d/%d = %d",
+ fprintf(stderr, " ---> %d/%d/%d/%d = %d\n",
self->dev->buf_size,
feed->conf.rate,
self->dev->conf.rate,
@@ -175,7 +174,7 @@ mix_subscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
fs->buf_size);
fs->buf = (byte*)sci_malloc(fs->buf_size * feed->frame_size);
- warning(" ---> --> %d for %p at %p", fs->buf_size * feed->frame_size, (void *)fs, (void *)fs->buf);
+ fprintf(stderr, " ---> --> %d for %p at %p\n", fs->buf_size * feed->frame_size, (void *)fs, (void *)fs->buf);
{
int i;
for (i = 0; i < fs->buf_size * feed->frame_size; i++)
@@ -235,7 +234,7 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
}
for (i = 0; i < self->feeds_nr; i++)
- warning(" Feed #%d: %s-%x",
+ fprintf(stderr, " Feed #%d: %s-%x\n",
i, self->feeds[i].feed->debug_name,
self->feeds[i].feed->debug_nr);
@@ -243,7 +242,7 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
}
}
- error("[sfx-mixer] Assertion failed: Deleting invalid feed %p out of %d",
+ fprintf(stderr, "[sfx-mixer] Assertion failed: Deleting invalid feed %p out of %d\n",
(void *)feed, self->feeds_nr);
BREAKPOINT();
@@ -415,7 +414,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
return self->dev->buf_size;
}
- /* error("[%d:%d]S%d ", secs, usecs, P->skew);*/
+ /* fprintf(stderr, "[%d:%d]S%d ", secs, usecs, P->skew);*/
if (P->skew > usecs) {
secs--;
@@ -428,7 +427,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
played_frames = frame_pos - P->played_this_second
+ ((secs - P->lsec) * self->dev->conf.rate);
/*
- error("%d:%d - %d:%d => %d", secs, frame_pos,
+ fprintf(stderr, "%d:%d - %d:%d => %d\n", secs, frame_pos,
P->lsec, P->played_this_second, played_frames);
*/
@@ -436,7 +435,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
played_frames = self->dev->buf_size;
/*
- error("Between %d:? offset=%d and %d:%d offset=%d: Played %d at %d", P->lsec, P->played_this_second,
+ fprintf(stderr, "Between %d:? offset=%d and %d:%d offset=%d: Played %d at %d\n", P->lsec, P->played_this_second,
secs, usecs, frame_pos, played_frames, self->dev->conf.rate);
*/
@@ -492,7 +491,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
}
if (result_frames > self->dev->buf_size) {
- error("[soft-mixer] Internal assertion failed: frames-to-write %d > %d",
+ fprintf(stderr, "[soft-mixer] Internal assertion failed: frames-to-write %d > %d\n",
result_frames, self->dev->buf_size);
}
return result_frames;
@@ -587,7 +586,7 @@ mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
ts->secs = -1;
if (frames_nr > fs->buf_size) {
- error("%d (%d*%d + somethign) bytes, but only %d allowed!!!!",
+ fprintf(stderr, "%d (%d*%d + somethign) bytes, but only %d allowed!!!!!\n",
frames_nr * f->frame_size,
fs->spd.val, len,
fs->buf_size);
@@ -638,7 +637,7 @@ mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
return;
default:
- error("[soft-mixer] Fatal: Invalid mode returned by PCM feed %s-%d's get_timestamp(): %d",
+ fprintf(stderr, "[soft-mixer] Fatal: Invalid mode returned by PCM feed %s-%d's get_timestamp(): %d\n",
f->debug_name, f->debug_nr, newmode);
exit(1);
}
@@ -791,7 +790,7 @@ mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
xx_size = frames_left * f->frame_size;
if (xx_offset + xx_size
>= fs->buf_size * f->frame_size) {
- error("offset %d >= max %d",
+ fprintf(stderr, "offset %d >= max %d!\n",
(xx_offset + xx_size), fs->buf_size * f->frame_size);
BREAKPOINT();
}
diff --git a/engines/sci/sfx/player/polled.cpp b/engines/sci/sfx/player/polled.cpp
index c514fa1caf..5856351bc8 100644
--- a/engines/sci/sfx/player/polled.cpp
+++ b/engines/sci/sfx/player/polled.cpp
@@ -25,9 +25,8 @@
/* Polled player, mostly for PCM-based thingies (which _can_ poll, after all) */
-#include "common/file.h"
#include "common/util.h"
-
+#include "common/file.h"
#include "sci/include/sfx_player.h"
#include "sci/sfx/softseq.h"
#include "sci/sfx/mixer.h"
diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp
index 6aa53d60d3..e749f49220 100644
--- a/engines/sci/sfx/player/realtime.cpp
+++ b/engines/sci/sfx/player/realtime.cpp
@@ -27,7 +27,6 @@
** prays for some reasonable amount of soft real-time, but it's close
** enough, I guess. */
-#include "common/util.h"
#include "sci/include/sfx_player.h"
#include "sci/sfx/sequencer.h"
@@ -161,7 +160,7 @@ find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) {
if (patchfile != SFX_SEQ_PATCHFILE_NONE) {
res = scir_find_resource(resmgr, sci_patch, patchfile, 0);
if (!res) {
- error("[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found\n",
+ fprintf(stderr, "[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found\n",
patchfile, seq_name);
}
}
@@ -185,7 +184,7 @@ rt_init(ResourceManager *resmgr, int expected_latency) {
seq = sfx_find_sequencer(NULL);
if (!seq) {
- error("[SFX] " __FILE__": Could not find sequencer\n");
+ fprintf(stderr, "[SFX] " __FILE__": Could not find sequencer\n");
return SFX_ERROR;
}
@@ -202,7 +201,7 @@ rt_init(ResourceManager *resmgr, int expected_latency) {
res2 ? res2->size : 0,
res2 ? res2->data : NULL,
seq_dev)) {
- error("[SFX] " __FILE__": Sequencer failed to initialize\n");
+ fprintf(stderr, "[SFX] " __FILE__": Sequencer failed to initialize\n");
return SFX_ERROR;
}
@@ -236,7 +235,7 @@ rt_add_iterator(song_iterator_t *it, GTimeVal start_time) {
static int
rt_fade_out(void) {
- error(__FILE__": Attempt to fade out- not implemented yet\n");
+ fprintf(stderr, __FILE__": Attempt to fade out- not implemented yet\n");
return SFX_ERROR;
}
@@ -289,7 +288,7 @@ rt_exit(void) {
int retval = SFX_OK;
if (seq->close()) {
- error("[SFX] Sequencer reported error on close\n");
+ fprintf(stderr, "[SFX] Sequencer reported error on close\n");
retval = SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/SN76496.cpp b/engines/sci/sfx/softseq/SN76496.cpp
index b341fcaa64..f128be2d00 100644
--- a/engines/sci/sfx/softseq/SN76496.cpp
+++ b/engines/sci/sfx/softseq/SN76496.cpp
@@ -66,7 +66,7 @@ SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) {
int i;
int chan = -1;
#if 0
- error("Note [%02x : %02x %02x]\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
+ fprintf(stderr, "Note [%02x : %02x %02x]\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
#endif
if ((command & 0xe0) == 0x80) {
int chan_nr = command & 0xf;
@@ -98,7 +98,7 @@ SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) {
}
}
#if 0
- error(" --> %d [%04x], {%d,%d,%d}@%d\n", chan,
+ fprintf(stderr, " --> %d [%04x], {%d,%d,%d}@%d\n", chan,
channels_assigned, chan_nrs[0], chan_nrs[1], chan_nrs[2], channel_assigner);
#endif
@@ -127,7 +127,7 @@ SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) {
default:
#if DEBUG
- error("[SFX:PCM-PC] Unused MIDI command %02x %02x %02x\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
+ fprintf(stderr, "[SFX:PCM-PC] Unused MIDI command %02x %02x %02x\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
#endif
break; /* ignore */
}
diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp
index 29f600a634..4ca05412d7 100644
--- a/engines/sci/sfx/softseq/opl2.cpp
+++ b/engines/sci/sfx/softseq/opl2.cpp
@@ -475,12 +475,12 @@ opl2_poll(sfx_softseq_t *self, byte *dest, int count) {
gint16 *ptr = buffer;
if (!ready) {
- error("synth_mixer(): !ready \n");
+ fprintf(stderr, "synth_mixer(): !ready \n");
exit(1);
}
if (!buffer) {
- error("synth_mixer(): !buffer \n");
+ fprintf(stderr, "synth_mixer(): !buffer \n");
exit(1);
}
@@ -539,7 +539,7 @@ opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr,
if (!(ym3812_L = OPLCreate(OPL_TYPE_YM3812, OPL_INTERNAL_FREQ, SAMPLE_RATE)) ||
!(ym3812_R = OPLCreate(OPL_TYPE_YM3812, OPL_INTERNAL_FREQ, SAMPLE_RATE))) {
- sciprintf("[sfx:seq:opl2] Failure: Emulator init failed");
+ sciprintf("[sfx:seq:opl2] Failure: Emulator init failed!\n");
return SFX_ERROR;
}
diff --git a/engines/sci/sfx/softseq/pcspeaker.cpp b/engines/sci/sfx/softseq/pcspeaker.cpp
index c03724524d..3f4bb0f332 100644
--- a/engines/sci/sfx/softseq/pcspeaker.cpp
+++ b/engines/sci/sfx/softseq/pcspeaker.cpp
@@ -58,7 +58,7 @@ sps_exit(sfx_softseq_t *self) {
static void
sps_event(sfx_softseq_t *self, byte command, int argc, byte *argv) {
#if 0
- error("Note [%02x : %02x %02x]\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
+ fprintf(stderr, "Note [%02x : %02x %02x]\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
#endif
switch (command & 0xf0) {
@@ -84,7 +84,7 @@ sps_event(sfx_softseq_t *self, byte command, int argc, byte *argv) {
default:
#if DEBUG
- error("[SFX:PCM-PC] Unused MIDI command %02x %02x %02x\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
+ fprintf(stderr, "[SFX:PCM-PC] Unused MIDI command %02x %02x %02x\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0);
#endif
break; /* ignore */
}
diff --git a/engines/sci/sfx/time.cpp b/engines/sci/sfx/time.cpp
index 15d7ea5dd5..a57f8488ab 100644
--- a/engines/sci/sfx/time.cpp
+++ b/engines/sci/sfx/time.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "common/util.h"
#include "sci/include/sfx_time.h"
#include "sci/include/resource.h"
@@ -63,7 +62,7 @@ sfx_timestamp_frame_diff(sfx_timestamp_t a, sfx_timestamp_t b) {
long usecdelta = 0;
if (a.frame_rate != b.frame_rate) {
- error("Fatal: The semantics of subtracting two timestamps with a different base from each other is not defined");
+ fprintf(stderr, "Fatal: The semantics of subtracting two timestamps with a different base from each other is not defined!\n");
BREAKPOINT();
}