aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-11-14 02:59:21 +0000
committerFilippos Karapetis2009-11-14 02:59:21 +0000
commit75c696fdc67624ed0083b8cc41c039c7c828c97e (patch)
treefca72d54e10b936ebf85c949f1e679d837da7e24 /engines/sci/sfx
parentf031cb2415494b5e8c2a4ad15bc4ef019af25fb9 (diff)
downloadscummvm-rg350-75c696fdc67624ed0083b8cc41c039c7c828c97e.tar.gz
scummvm-rg350-75c696fdc67624ed0083b8cc41c039c7c828c97e.tar.bz2
scummvm-rg350-75c696fdc67624ed0083b8cc41c039c7c828c97e.zip
Removed some unused parts of the PCM sound playing code
svn-id: r45884
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/iterator.cpp49
-rw-r--r--engines/sci/sfx/iterator.h1
-rw-r--r--engines/sci/sfx/iterator_internal.h2
-rw-r--r--engines/sci/sfx/sfx_pcm.h61
-rw-r--r--engines/sci/sfx/softseq.h4
5 files changed, 18 insertions, 99 deletions
diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp
index 53d4de23c5..db43b86a9a 100644
--- a/engines/sci/sfx/iterator.cpp
+++ b/engines/sci/sfx/iterator.cpp
@@ -116,7 +116,7 @@ static int _parse_ticks(byte *data, int *offset_p, int size) {
}
-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 @@ int BaseSongIterator::processMidi(byte *buf, int *result,
}
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_header_magic_p(byte *data, int offset, int size) {
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 @@ static int _sci0_get_pcm_data(Sci0SongIterator *self,
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 @@ static int _sci0_get_pcm_data(Sci0SongIterator *self,
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 @@ int Sci1SongIterator::initSample(const int offset) {
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 @@ int Sci1SongIterator::getCommandIndex() const {
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 @@ SongIterator *Sci1SongIterator::handleMessage(Message msg) {
_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;
diff --git a/engines/sci/sfx/iterator.h b/engines/sci/sfx/iterator.h
index d66faa1b2d..b3fb115370 100644
--- a/engines/sci/sfx/iterator.h
+++ b/engines/sci/sfx/iterator.h
@@ -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 {
diff --git a/engines/sci/sfx/iterator_internal.h b/engines/sci/sfx/iterator_internal.h
index 15b15ed308..d465fb90f7 100644
--- a/engines/sci/sfx/iterator_internal.h
+++ b/engines/sci/sfx/iterator_internal.h
@@ -134,7 +134,7 @@ struct Sci1Sample {
int delta;
int size;
bool announced; /* Announced for download (SI_PCM) */
- sfx_pcm_config_t format;
+ int rate;
byte *_data;
};
diff --git a/engines/sci/sfx/sfx_pcm.h b/engines/sci/sfx/sfx_pcm.h
deleted file mode 100644
index aa3a3e8ea0..0000000000
--- a/engines/sci/sfx/sfx_pcm.h
+++ /dev/null
@@ -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
diff --git a/engines/sci/sfx/softseq.h b/engines/sci/sfx/softseq.h
index d3f4168ea7..bf667d9806 100644
--- a/engines/sci/sfx/softseq.h
+++ b/engines/sci/sfx/softseq.h
@@ -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 @@ struct sfx_softseq_t {
*/
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 */
-
};