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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Nov 14 03:59:22 CET 2009


Revision: 45884
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45884&view=rev
Author:   thebluegr
Date:     2009-11-14 02:59:21 +0000 (Sat, 14 Nov 2009)

Log Message:
-----------
Removed some unused parts of the PCM sound playing code

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/iterator.cpp
    scummvm/trunk/engines/sci/sfx/iterator.h
    scummvm/trunk/engines/sci/sfx/iterator_internal.h
    scummvm/trunk/engines/sci/sfx/softseq.h

Removed Paths:
-------------
    scummvm/trunk/engines/sci/sfx/sfx_pcm.h

Modified: scummvm/trunk/engines/sci/sfx/iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-11-13 21:08:14 UTC (rev 45883)
+++ scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-11-14 02:59:21 UTC (rev 45884)
@@ -116,7 +116,7 @@
 }
 
 
-static int _sci0_get_pcm_data(Sci0SongIterator *self, sfx_pcm_config_t *format, int *xoffset, uint *xsize);
+static int _sci0_get_pcm_data(Sci0SongIterator *self, int *rate, int *xoffset, uint *xsize);
 
 
 #define PARSE_FLAG_LOOPS_UNLIMITED (1 << 0) /* Unlimited # of loops? */
@@ -410,14 +410,14 @@
 	}
 
 	case SI_STATE_PCM_MAGIC_DELTA: {
-		sfx_pcm_config_t format;
+		int rate;
 		int offset;
 		uint size;
 		int delay;
-		if (_sci0_get_pcm_data((Sci0SongIterator *)this, &format, &offset, &size))
+		if (_sci0_get_pcm_data((Sci0SongIterator *)this, &rate, &offset, &size))
 			return SI_FINISHED; /* 'tis broken */
 		channel->state = SI_STATE_FINISHED;
-		delay = (size * 50 + format.rate - 1) / format.rate; /* number of ticks to completion*/
+		delay = (size * 50 + rate - 1) / rate; /* number of ticks to completion*/
 
 		debugC(2, kDebugLevelSound, "delaying %d ticks\n", delay);
 		return delay;
@@ -499,7 +499,7 @@
 
 
 static int _sci0_get_pcm_data(Sci0SongIterator *self,
-	sfx_pcm_config_t *format, int *xoffset, uint *xsize) {
+	int *rate, int *xoffset, uint *xsize) {
 	int tries = 2;
 	bool found_it = false;
 	byte *pcm_data;
@@ -541,9 +541,7 @@
 	size = READ_LE_UINT16(pcm_data + SCI0_PCM_SIZE_OFFSET);
 
 	/* Two of the format parameters are fixed by design: */
-	format->format = SFX_PCM_FORMAT_U8;
-	format->stereo = SFX_PCM_MONO;
-	format->rate = READ_LE_UINT16(pcm_data + SCI0_PCM_SAMPLE_RATE_OFFSET);
+	*rate = READ_LE_UINT16(pcm_data + SCI0_PCM_SAMPLE_RATE_OFFSET);
 
 	if (offset + SCI0_PCM_DATA_OFFSET + size != self->_data.size()) {
 		int d = offset + SCI0_PCM_DATA_OFFSET + size - self->_data.size();
@@ -562,39 +560,28 @@
 	return 0;
 }
 
-static Audio::AudioStream *makeStream(byte *data, int size, sfx_pcm_config_t conf) {
-	debugC(2, kDebugLevelSound, "Playing PCM data of size %d, rate %d\n", size, conf.rate);
+static Audio::AudioStream *makeStream(byte *data, int size, int rate) {
+	debugC(2, kDebugLevelSound, "Playing PCM data of size %d, rate %d\n", size, rate);
 
 	// Duplicate the data
 	byte *sound = (byte *)malloc(size);
 	memcpy(sound, data, size);
 
 	// Convert stream format flags
-	int flags = Audio::Mixer::FLAG_AUTOFREE;
-	if (conf.format == SFX_PCM_FORMAT_U8)
-		flags |= Audio::Mixer::FLAG_UNSIGNED;
-	else if (conf.format == SFX_PCM_FORMAT_S16_NATIVE) {
-		flags |= Audio::Mixer::FLAG_16BITS;
-#ifndef SCUMM_BIG_ENDIAN
-		flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
-#endif
-	}
-	if (conf.stereo)
-		flags |= Audio::Mixer::FLAG_STEREO;
-
-	return Audio::makeLinearInputStream(sound, size, conf.rate, flags, 0, 0);
+	int flags = Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED;
+	return Audio::makeLinearInputStream(sound, size, rate, flags, 0, 0);
 }
 
 Audio::AudioStream *Sci0SongIterator::getAudioStream() {
-	sfx_pcm_config_t conf;
+	int rate;
 	int offset;
 	uint size;
-	if (_sci0_get_pcm_data(this, &conf, &offset, &size))
+	if (_sci0_get_pcm_data(this, &rate, &offset, &size))
 		return NULL;
 
 	_channel.state = SI_STATE_FINISHED; /* Don't play both PCM and music */
 
-	return makeStream(_data.begin() + offset + SCI0_PCM_DATA_OFFSET, size, conf);
+	return makeStream(_data.begin() + offset + SCI0_PCM_DATA_OFFSET, size, rate);
 }
 
 SongIterator *Sci0SongIterator::handleMessage(Message msg) {
@@ -739,9 +726,7 @@
 	        offset + 10, begin, end, _data.size(), length);
 #endif
 
-	sample.format.format = SFX_PCM_FORMAT_U8;
-	sample.format.stereo = SFX_PCM_MONO;
-	sample.format.rate = rate;
+	sample.rate = rate;
 
 	sample.announced = false;
 
@@ -913,7 +898,7 @@
 Audio::AudioStream *Sci1SongIterator::getAudioStream() {
 	Common::List<Sci1Sample>::iterator sample = _samples.begin();
 	if (sample != _samples.end() && sample->delta <= 0) {
-		Audio::AudioStream *feed = makeStream(sample->_data, sample->size, sample->format);
+		Audio::AudioStream *feed = makeStream(sample->_data, sample->size, sample->rate);
 		_samples.erase(sample);
 
 		return feed;
@@ -1045,12 +1030,12 @@
 				_deviceId
 				= sci0_to_sci1_device_map
 				  [sci_ffs(msg._arg.i & 0xff) - 1]
-				  [sfx_pcm_available()]
+				  [g_system->getMixer()->isReady()]
 				  ;
 
 				if (_deviceId == 0xff) {
 					warning("[iterator] Device %d(%d) not supported",
-					          msg._arg.i & 0xff, sfx_pcm_available());
+					          msg._arg.i & 0xff, g_system->getMixer()->isReady());
 				}
 				if (_initialised) {
 					int i;

Modified: scummvm/trunk/engines/sci/sfx/iterator.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.h	2009-11-13 21:08:14 UTC (rev 45883)
+++ scummvm/trunk/engines/sci/sfx/iterator.h	2009-11-14 02:59:21 UTC (rev 45884)
@@ -28,7 +28,6 @@
 #ifndef SCI_SFX_SFX_ITERATOR_H
 #define SCI_SFX_SFX_ITERATOR_H
 
-#include "sci/sfx/sfx_pcm.h"
 #include "sci/sfx/sci_midi.h"
 
 namespace Audio {

Modified: scummvm/trunk/engines/sci/sfx/iterator_internal.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator_internal.h	2009-11-13 21:08:14 UTC (rev 45883)
+++ scummvm/trunk/engines/sci/sfx/iterator_internal.h	2009-11-14 02:59:21 UTC (rev 45884)
@@ -134,7 +134,7 @@
 	int delta;
 	int size;
 	bool announced; /* Announced for download (SI_PCM) */
-	sfx_pcm_config_t format;
+	int rate;
 	byte *_data;
 };
 

Deleted: scummvm/trunk/engines/sci/sfx/sfx_pcm.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-11-13 21:08:14 UTC (rev 45883)
+++ scummvm/trunk/engines/sci/sfx/sfx_pcm.h	2009-11-14 02:59:21 UTC (rev 45884)
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SCI_SFX_SFX_PCM_H
-#define SCI_SFX_SFX_PCM_H
-
-#include "common/error.h"
-#include "sound/timestamp.h"
-
-namespace Sci {
-
-#define SFX_PCM_MONO 0
-#define SFX_PCM_STEREO_LR 1 /* left sample, then right sample */
-
-/* The following are used internally by the mixer */
-#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_S16_NATIVE (0x0000 | SFX_PCM_FORMAT_16)
-
-
-struct sfx_pcm_config_t {
-	int rate;   /* Sampling rate */
-	int stereo; /* The stereo mode used (SFX_PCM_MONO or SFX_PCM_STEREO_*) */
-	unsigned int format; /* Sample format (SFX_PCM_FORMAT_*) */
-};
-
-
-int sfx_pcm_available();
-/* Determines whether a PCM device is available and has been initialised
-** Returns   : (int) zero iff no PCM device is available
-*/
-
-} // End of namespace Sci
-
-#endif // SCI_SFX_SFX_PCM_H

Modified: scummvm/trunk/engines/sci/sfx/softseq.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq.h	2009-11-13 21:08:14 UTC (rev 45883)
+++ scummvm/trunk/engines/sci/sfx/softseq.h	2009-11-14 02:59:21 UTC (rev 45884)
@@ -27,7 +27,6 @@
 #define SCI_SFX_SOFTSEQ_H
 
 #include "common/error.h"
-#include "sci/sfx/sfx_pcm.h"
 #include "sci/sfx/sequencer.h"
 
 namespace Sci {
@@ -107,9 +106,6 @@
 	*/
 	int play_rhythm; /* Whether the rhythm channel (9) should be played */
 	int polyphony; /* Number of voices played */
-
-	sfx_pcm_config_t pcm_conf; /* Setup of the channel the sequencer writes to */
-
 };
 
 


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