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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Mar 4 07:23:14 CET 2009


Revision: 39111
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39111&view=rev
Author:   fingolfin
Date:     2009-03-04 06:23:14 +0000 (Wed, 04 Mar 2009)

Log Message:
-----------
SCI: mixer cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/mixer.cpp
    scummvm/trunk/engines/sci/sfx/mixer.h
    scummvm/trunk/engines/sci/sfx/sfx_pcm.h

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-03-04 06:08:50 UTC (rev 39110)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-03-04 06:23:14 UTC (rev 39111)
@@ -361,8 +361,6 @@
 
 	if (player)
 		player->maintenance();
-
-	mixer_process();
 }
 
 void sfx_init(sfx_state_t *self, ResourceManager *resmgr, int flags) {

Modified: scummvm/trunk/engines/sci/sfx/mixer.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/mixer.cpp	2009-03-04 06:08:50 UTC (rev 39110)
+++ scummvm/trunk/engines/sci/sfx/mixer.cpp	2009-03-04 06:23:14 UTC (rev 39111)
@@ -56,7 +56,7 @@
 
 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 @@
 				// 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 @@
 	          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

Modified: scummvm/trunk/engines/sci/sfx/mixer.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/mixer.h	2009-03-04 06:08:50 UTC (rev 39110)
+++ scummvm/trunk/engines/sci/sfx/mixer.h	2009-03-04 06:23:14 UTC (rev 39111)
@@ -36,16 +36,6 @@
  */
 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

Modified: scummvm/trunk/engines/sci/sfx/sfx_pcm.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-03-04 06:08:50 UTC (rev 39110)
+++ scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-03-04 06:23:14 UTC (rev 39111)
@@ -33,10 +33,8 @@
 
 #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,9 +43,7 @@
 #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 */
 	int stereo; /* The stereo mode used (SFX_PCM_MONO or SFX_PCM_STEREO_*) */


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