aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx/mixer/soft.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/sfx/mixer/soft.cpp')
-rw-r--r--engines/sci/sfx/mixer/soft.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp
index 093a57e3e9..5aa80c11ae 100644
--- a/engines/sci/sfx/mixer/soft.cpp
+++ b/engines/sci/sfx/mixer/soft.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/util.h"
#include "../mixer.h"
#include "sci/include/sci_memory.h"
@@ -48,9 +49,9 @@ static volatile int mixer_lock = 0;
/*#define DEBUG_LOCKS*/
#ifdef DEBUG_LOCKS
-# 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);
+# define DEBUG_ACQUIRE error("[ -LOCK -] ACKQ %d: %d\n", __LINE__, mixer_lock)
+# define DEBUG_WAIT error("[ -LOCK -] WAIT %d: %d\n", __LINE__, mixer_lock);
+# define DEBUG_RELEASE ; error("[ -LOCK -] REL %d: %d\n", __LINE__, mixer_lock);
#else
# define DEBUG_ACQUIRE
# define DEBUG_WAIT
@@ -164,7 +165,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)));
- fprintf(stderr, " ---> %d/%d/%d/%d = %d\n",
+ warning(" ---> %d/%d/%d/%d = %d\n",
self->dev->buf_size,
feed->conf.rate,
self->dev->conf.rate,
@@ -172,7 +173,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);
- fprintf(stderr, " ---> --> %d for %p at %p\n", fs->buf_size * feed->frame_size, (void *)fs, (void *)fs->buf);
+ warning(" ---> --> %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++)
@@ -232,7 +233,7 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
}
for (i = 0; i < self->feeds_nr; i++)
- fprintf(stderr, " Feed #%d: %s-%x\n",
+ warning(" Feed #%d: %s-%x\n",
i, self->feeds[i].feed->debug_name,
self->feeds[i].feed->debug_nr);
@@ -240,7 +241,7 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
}
}
- fprintf(stderr, "[sfx-mixer] Assertion failed: Deleting invalid feed %p out of %d\n",
+ error("[sfx-mixer] Assertion failed: Deleting invalid feed %p out of %d\n",
(void *)feed, self->feeds_nr);
BREAKPOINT();
@@ -412,7 +413,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
return self->dev->buf_size;
}
- /* fprintf(stderr, "[%d:%d]S%d ", secs, usecs, P->skew);*/
+ /* error("[%d:%d]S%d ", secs, usecs, P->skew);*/
if (P->skew > usecs) {
secs--;
@@ -425,7 +426,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);
/*
- fprintf(stderr, "%d:%d - %d:%d => %d\n", secs, frame_pos,
+ error("%d:%d - %d:%d => %d\n", secs, frame_pos,
P->lsec, P->played_this_second, played_frames);
*/
@@ -433,7 +434,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
played_frames = self->dev->buf_size;
/*
- fprintf(stderr, "Between %d:? offset=%d and %d:%d offset=%d: Played %d at %d\n", P->lsec, P->played_this_second,
+ error("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);
*/
@@ -489,7 +490,7 @@ mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
}
if (result_frames > self->dev->buf_size) {
- fprintf(stderr, "[soft-mixer] Internal assertion failed: frames-to-write %d > %d\n",
+ error("[soft-mixer] Internal assertion failed: frames-to-write %d > %d\n",
result_frames, self->dev->buf_size);
}
return result_frames;
@@ -584,7 +585,7 @@ mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
ts->secs = -1;
if (frames_nr > fs->buf_size) {
- fprintf(stderr, "%d (%d*%d + somethign) bytes, but only %d allowed!!!!!\n",
+ error("%d (%d*%d + somethign) bytes, but only %d allowed!!!!",
frames_nr * f->frame_size,
fs->spd.val, len,
fs->buf_size);
@@ -635,7 +636,7 @@ mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
return;
default:
- fprintf(stderr, "[soft-mixer] Fatal: Invalid mode returned by PCM feed %s-%d's get_timestamp(): %d\n",
+ error("[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);
}
@@ -788,7 +789,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) {
- fprintf(stderr, "offset %d >= max %d!\n",
+ error("offset %d >= max %d",
(xx_offset + xx_size), fs->buf_size * f->frame_size);
BREAKPOINT();
}