aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-03-01 06:02:26 +0000
committerMax Horn2009-03-01 06:02:26 +0000
commit6f290b7cd67c31a22b9cc4d7fafee53c6b06a720 (patch)
treed7bb0b11005f5676070618ba483892909301c1b6 /engines
parent25e7d3a08d68b4e3f0c8df203c6f9f77ac8ebf2b (diff)
downloadscummvm-rg350-6f290b7cd67c31a22b9cc4d7fafee53c6b06a720.tar.gz
scummvm-rg350-6f290b7cd67c31a22b9cc4d7fafee53c6b06a720.tar.bz2
scummvm-rg350-6f290b7cd67c31a22b9cc4d7fafee53c6b06a720.zip
SCI: Removed some unused code from the SCI mixer
svn-id: r39007
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/mixer.cpp70
-rw-r--r--engines/sci/sfx/sfx_pcm.h17
2 files changed, 14 insertions, 73 deletions
diff --git a/engines/sci/sfx/mixer.cpp b/engines/sci/sfx/mixer.cpp
index a4390cf844..e6785331ea 100644
--- a/engines/sci/sfx/mixer.cpp
+++ b/engines/sci/sfx/mixer.cpp
@@ -318,16 +318,9 @@ static inline void mix_compute_output(sfx_pcm_mixer_t *self, int outplen) {
if (!P->writebuf)
P->writebuf = (byte*)sci_malloc(BUF_SIZE * frame_size + 4);
- if (conf.stereo) {
- if (conf.stereo == SFX_PCM_STEREO_RL) {
- lchan = P->writebuf + ((use_16) ? 2 : 1);
- rchan = P->writebuf;
- } else {
- lchan = P->writebuf;
- rchan = P->writebuf + ((use_16) ? 2 : 1);
- }
- } else
- lchan = P->writebuf;
+ lchan = P->writebuf;
+ if (conf.stereo)
+ rchan = P->writebuf + ((use_16) ? 2 : 1);
for (frame_i = 0; frame_i < outplen; frame_i++) {
@@ -347,17 +340,8 @@ static inline void mix_compute_output(sfx_pcm_mixer_t *self, int outplen) {
right += bias;
if (use_16) {
- if (SFX_PCM_FORMAT_LE == (conf.format & SFX_PCM_FORMAT_ENDIANNESS)) {
- lchan[0] = left & 0xff;
- lchan[1] = (left >> 8) & 0xff;
- rchan[0] = right & 0xff;
- rchan[1] = (right >> 8) & 0xff;
- } else {
- lchan[1] = left & 0xff;
- lchan[0] = (left >> 8) & 0xff;
- rchan[1] = right & 0xff;
- rchan[0] = (right >> 8) & 0xff;
- }
+ *(int16 *)lchan = left;
+ *(int16 *)rchan = right;
lchan += 4;
rchan += 4;
@@ -379,13 +363,7 @@ static inline void mix_compute_output(sfx_pcm_mixer_t *self, int outplen) {
left += bias;
if (use_16) {
- if (SFX_PCM_FORMAT_LE == (conf.format & SFX_PCM_FORMAT_ENDIANNESS)) {
- lchan[0] = left & 0xff;
- lchan[1] = (left >> 8) & 0xff;
- } else {
- lchan[1] = left & 0xff;
- lchan[0] = (left >> 8) & 0xff;
- }
+ *(int16 *)lchan = left;
lchan += 2;
} else {
@@ -510,33 +488,13 @@ static inline int mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames) {
#define READ_NEW_VALUES() \
if (frames_left > 0) { \
- if (bias) { /* unsigned data */ \
- if (!use_16) { \
- c_new.left = (*lsrc) << 8; \
- c_new.right = (*rsrc) << 8; \
- } else { \
- if (conf.format & SFX_PCM_FORMAT_LE) { \
- c_new.left = lsrc[0] | lsrc[1] << 8; \
- c_new.right = rsrc[0] | rsrc[1] << 8; \
- } else { \
- c_new.left = lsrc[1] | lsrc[0] << 8; \
- c_new.right = rsrc[1] | rsrc[0] << 8; \
- } \
- } \
- } else { /* signed data */ \
- if (!use_16) { \
- c_new.left = (*((signed char *)lsrc)) << 8; \
- c_new.right = (*((signed char *)rsrc)) << 8; \
- } else { \
- if (conf.format & SFX_PCM_FORMAT_LE) { \
- c_new.left = lsrc[0] | ((signed char *)lsrc)[1] << 8; \
- c_new.right = rsrc[0] | ((signed char *)rsrc)[1] << 8; \
- } else { \
- c_new.left = lsrc[1] | ((signed char *)lsrc)[0] << 8; \
- c_new.right = rsrc[1] | ((signed char *)rsrc)[0] << 8; \
- } \
- } \
- } \
+ if (!use_16) { \
+ c_new.left = (*lsrc) << 8; \
+ c_new.right = (*rsrc) << 8; \
+ } else { \
+ c_new.left = *((int16 *)lsrc); \
+ c_new.right = *((int16 *)rsrc); \
+ } \
\
c_new.left -= bias; \
c_new.right -= bias; \
@@ -688,8 +646,6 @@ static void mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result,
if (conf.stereo == SFX_PCM_STEREO_LR)
rsrc += (use_16) ? 2 : 1;
- else if (conf.stereo == SFX_PCM_STEREO_RL)
- lsrc += (use_16) ? 2 : 1;
/* Otherwise, we let both point to the same place */
#if (DEBUG >= 2)
diff --git a/engines/sci/sfx/sfx_pcm.h b/engines/sci/sfx/sfx_pcm.h
index b834704a62..2f87b063e2 100644
--- a/engines/sci/sfx/sfx_pcm.h
+++ b/engines/sci/sfx/sfx_pcm.h
@@ -37,28 +37,13 @@ namespace Sci {
/* The following are used internally by the mixer */
#define SFX_PCM_FORMAT_LMASK 0x7
-#define SFX_PCM_FORMAT_BE 0
-#define SFX_PCM_FORMAT_LE 1
-#define SFX_PCM_FORMAT_ENDIANNESS 1
#define SFX_PCM_FORMAT_8 0
#define SFX_PCM_FORMAT_16 2
/* Pick one of these formats (including the _NATIVE) ones for your PCM feed */
#define SFX_PCM_FORMAT_U8 (0x0080 | SFX_PCM_FORMAT_8) /* Unsigned (bias 128) 8 bit format */
-#define SFX_PCM_FORMAT_S8 (0x0000 | SFX_PCM_FORMAT_8) /* Signed 8 bit format */
-#define SFX_PCM_FORMAT_U16_LE (0x8000 | SFX_PCM_FORMAT_16 | SFX_PCM_FORMAT_LE) /* Unsigned (bias 32768) 16 bit LE format */
-#define SFX_PCM_FORMAT_S16_LE (0x0000 | SFX_PCM_FORMAT_16 | SFX_PCM_FORMAT_LE) /* Signed 16 bit format, little endian */
-#define SFX_PCM_FORMAT_U16_BE (0x8000 | SFX_PCM_FORMAT_16 | SFX_PCM_FORMAT_BE) /* Unsigned (bias 32768) 16 bit BE format */
-#define SFX_PCM_FORMAT_S16_BE (0x0000 | SFX_PCM_FORMAT_16 | SFX_PCM_FORMAT_BE) /* Signed 16 bit format, big endian */
-
-#ifdef SCUMM_BIG_ENDIAN
-# define SFX_PCM_FORMAT_U16_NATIVE SFX_PCM_FORMAT_U16_BE
-# define SFX_PCM_FORMAT_S16_NATIVE SFX_PCM_FORMAT_S16_BE
-#else
-# define SFX_PCM_FORMAT_U16_NATIVE SFX_PCM_FORMAT_U16_LE
-# define SFX_PCM_FORMAT_S16_NATIVE SFX_PCM_FORMAT_S16_LE
-#endif
+#define SFX_PCM_FORMAT_S16_NATIVE (0x0000 | SFX_PCM_FORMAT_16)
#define SFX_PCM_FRAME_SIZE(conf) ((conf).stereo? 2 : 1) * (((conf).format & SFX_PCM_FORMAT_16)? 2 : 1)