diff options
author | Max Horn | 2009-03-04 06:23:14 +0000 |
---|---|---|
committer | Max Horn | 2009-03-04 06:23:14 +0000 |
commit | 92eceb741ae713c5b2341543e249799e08c89b0d (patch) | |
tree | a204eabaa17ae8a920dfbd0bc2c0df0ce4b8ed6f /engines | |
parent | 59b374505f3a8fc4017352ff29266046a116884b (diff) | |
download | scummvm-rg350-92eceb741ae713c5b2341543e249799e08c89b0d.tar.gz scummvm-rg350-92eceb741ae713c5b2341543e249799e08c89b0d.tar.bz2 scummvm-rg350-92eceb741ae713c5b2341543e249799e08c89b0d.zip |
SCI: mixer cleanup
svn-id: r39111
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/core.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/mixer.cpp | 41 | ||||
-rw-r--r-- | engines/sci/sfx/mixer.h | 10 | ||||
-rw-r--r-- | engines/sci/sfx/sfx_pcm.h | 4 |
4 files changed, 9 insertions, 48 deletions
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 47a097f75f..617c5b49bf 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -361,8 +361,6 @@ static void _sfx_timer_callback(void *data) { if (player) player->maintenance(); - - mixer_process(); } void sfx_init(sfx_state_t *self, ResourceManager *resmgr, int flags) { diff --git a/engines/sci/sfx/mixer.cpp b/engines/sci/sfx/mixer.cpp index 0293be4ad3..fd295b39bd 100644 --- a/engines/sci/sfx/mixer.cpp +++ b/engines/sci/sfx/mixer.cpp @@ -56,7 +56,7 @@ protected: public: PCMFeedAudioStream(sfx_pcm_feed_t *feed) : _feed(feed) { - _feed->frame_size = SFX_PCM_FRAME_SIZE(_feed->conf); + _feed->frame_size = (_feed->conf.stereo ? 2 : 1) * ((_feed->conf.format & SFX_PCM_FORMAT_16) ? 2 : 1); _mode = FEED_MODE_ALIVE; _gap = 0; _time = sfx_new_timestamp(g_system->getMillis(), _feed->conf.rate); @@ -92,6 +92,14 @@ void PCMFeedAudioStream::queryTimestamp() { // FIXME: I don't quite understand what FEED_MODE_RESTART is for. // The original DC mixer seemed to just stop and restart the stream. // But why? To catch up with lagging sound? + // + // Walter says the following: + // "The FEED_MODE_RESTART might be there to re-sync after a debugger + // session where time passes for the mixer but not for the engine. + // I may have added this as a workaround for not being able to come + // up with a convenient way to implement mixer->pause() and mixer->resume() + // on DC." + // That makes some sense. _mode = FEED_MODE_RESTART; _time = sfx_new_timestamp(g_system->getMillis(), _feed->conf.rate); _gap = sfx_timestamp_frame_diff(stamp, _time); @@ -191,35 +199,4 @@ void mixer_subscribe(sfx_pcm_feed_t *feed) { feed->debug_name, feed->debug_nr, feed->conf.rate, feed->conf.stereo, feed->conf.format); } - -int mixer_process() { - // TODO -/* - feed_state_t *state, *state_next; - - TAILQ_FOREACH(state, &feeds, entry) { - snd_stream_poll(handle); - } - - state = TAILQ_FIRST(&feeds); - while (state) { - state_next = TAILQ_NEXT(state, entry); - if (_mode == FEED_MODE_DEAD) { - snd_stream_stop(handle); - snd_stream_destroy(handle); - feed->destroy(feed); - TAILQ_REMOVE(&feeds, state, entry); - } - else if (_mode == FEED_MODE_RESTART) { - snd_stream_stop(handle); - snd_stream_start(handle, feed->conf.rate, - feed->conf.stereo != SFX_PCM_MONO); - _mode = FEED_MODE_ALIVE; - } - state = state_next; - } -*/ - return SFX_OK; -} - } // End of namespace Sci diff --git a/engines/sci/sfx/mixer.h b/engines/sci/sfx/mixer.h index 8fab69bded..955a29289f 100644 --- a/engines/sci/sfx/mixer.h +++ b/engines/sci/sfx/mixer.h @@ -36,16 +36,6 @@ namespace Sci { */ void mixer_subscribe(sfx_pcm_feed_t *feed); -/** - * Processes all feeds, mixes their results, and passes everything to the output device. - * Returns : (int) SFX_OK on success, SFX_ERROR otherwise (output device error or - * internal assertion failure) - * Effects : All feeds are poll()ed, and the device is asked to output(). Buffer size - * depends on the time that has passed since the last call to process(), if - * any. - */ -int mixer_process(); - } // End of namespace Sci #endif // SCI_SFX_MIXER_H diff --git a/engines/sci/sfx/sfx_pcm.h b/engines/sci/sfx/sfx_pcm.h index 2f87b063e2..5dbe969e78 100644 --- a/engines/sci/sfx/sfx_pcm.h +++ b/engines/sci/sfx/sfx_pcm.h @@ -33,10 +33,8 @@ namespace Sci { #define SFX_PCM_MONO 0 #define SFX_PCM_STEREO_LR 1 /* left sample, then right sample */ -#define SFX_PCM_STEREO_RL 2 /* right sample, then left sample */ /* The following are used internally by the mixer */ -#define SFX_PCM_FORMAT_LMASK 0x7 #define SFX_PCM_FORMAT_8 0 #define SFX_PCM_FORMAT_16 2 @@ -45,8 +43,6 @@ namespace Sci { #define SFX_PCM_FORMAT_U8 (0x0080 | SFX_PCM_FORMAT_8) /* Unsigned (bias 128) 8 bit format */ #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) - struct sfx_pcm_config_t { int rate; /* Sampling rate */ |