aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/sound.cpp4
-rw-r--r--engines/kyra/sound.h7
-rw-r--r--engines/touche/resource.cpp11
-rw-r--r--sound/flac.cpp22
-rw-r--r--sound/flac.h9
-rw-r--r--sound/mp3.cpp17
-rw-r--r--sound/mp3.h9
-rw-r--r--sound/vorbis.cpp17
-rw-r--r--sound/vorbis.h9
9 files changed, 18 insertions, 87 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 8deed22091..1d2ff2e512 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -61,7 +61,9 @@ void Sound::voicePlay(const char *file) {
if (!_compressHandle.isOpen())
continue;
- _currentVocFile = _supportedCodes[i].streamFunc(&_compressHandle, fileSize);
+ Common::MemoryReadStream *tmp = _compressHandle.readStream(fileSize);
+ assert(tmp);
+ _currentVocFile = _supportedCodes[i].streamFunc(tmp, true, 0, 0, 1);
found = true;
break;
}
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 28a9521112..b6c06b493b 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -109,7 +109,12 @@ private:
struct SpeechCodecs {
const char *fileext;
- Audio::AudioStream *(*streamFunc)(Common::File*, uint32);
+ Audio::AudioStream *(*streamFunc)(
+ Common::SeekableReadStream *stream,
+ bool disposeAfterUse,
+ uint32 startTime,
+ uint32 duration,
+ uint numLoops);
};
static const SpeechCodecs _supportedCodes[];
diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp
index 585e70c534..f9f2938502 100644
--- a/engines/touche/resource.cpp
+++ b/engines/touche/resource.cpp
@@ -44,7 +44,12 @@ enum {
struct CompressedSpeechFile {
const char *filename;
- Audio::AudioStream *(*makeStream)(Common::File *file, uint32 size);
+ Audio::AudioStream *(*makeStream)(
+ Common::SeekableReadStream *stream,
+ bool disposeAfterUse,
+ uint32 startTime,
+ uint32 duration,
+ uint numLoops);
};
static const CompressedSpeechFile compressedSpeechFilesTable[] = {
@@ -656,7 +661,9 @@ void ToucheEngine::res_loadSpeechSegment(int num) {
return;
}
_fSpeech[0].seek(offs);
- stream = (compressedSpeechFilesTable[_compressedSpeechData].makeStream)(&_fSpeech[0], size);
+ Common::MemoryReadStream *tmp = _fSpeech[0].readStream(size);
+ assert(tmp);
+ stream = (compressedSpeechFilesTable[_compressedSpeechData].makeStream)(tmp, true, 0, 0, 1);
}
if (stream) {
_speechPlaying = true;
diff --git a/sound/flac.cpp b/sound/flac.cpp
index 2093108fb8..6080509a0f 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -734,28 +734,6 @@ void FlacInputStream::callWrapError(const ::FLAC__SeekableStreamDecoder *decoder
#pragma mark -
-AudioStream *makeFlacStream(File *file, uint32 size) {
- assert(file);
-
- // FIXME: For now, just read the whole data into memory, and be done
- // with it. Of course this is in general *not* a nice thing to do...
-
- // If no size was specified, read the whole remainder of the file
- if (!size)
- size = file->size() - file->pos();
-
- // Read 'size' bytes of data into a MemoryReadStream
- Common::MemoryReadStream *stream = file->readStream(size);
-
- // .. and create an MP3InputStream from all this
- FlacInputStream *input = new FlacInputStream(stream, true);
- if (!input->isStreamDecoderReady()) {
- delete input;
- return 0;
- }
- return input;
-}
-
AudioStream *makeFlacStream(
Common::SeekableReadStream *stream,
bool disposeAfterUse,
diff --git a/sound/flac.h b/sound/flac.h
index a949ffdf6a..b95f41d007 100644
--- a/sound/flac.h
+++ b/sound/flac.h
@@ -41,15 +41,6 @@ namespace Audio {
class AudioStream;
/**
- * Create a new AudioStream from the FLAC data in the given
- * file. If you only want to play part of that file, then seek
- * to the start position in file before passing it to this
- * factory function, and specify the appropriate size.
- */
-AudioStream *makeFlacStream(Common::File *file, uint32 size);
-
-
-/**
* Create a new AudioStream from the FLAC data in the given stream.
* Allows for looping (which is why we require a SeekableReadStream),
* and specifying only a portion of the data to be played, based
diff --git a/sound/mp3.cpp b/sound/mp3.cpp
index 642c2ba90a..16ea2d2834 100644
--- a/sound/mp3.cpp
+++ b/sound/mp3.cpp
@@ -302,23 +302,6 @@ int MP3InputStream::readBuffer(int16 *buffer, const int numSamples) {
#pragma mark -
-AudioStream *makeMP3Stream(Common::File *file, uint32 size) {
- assert(file);
-
- // FIXME: For now, just read the whole data into memory, and be done
- // with it. Of course this is in general *not* a nice thing to do...
-
- // If no size was specified, read the whole remainder of the file
- if (!size)
- size = file->size() - file->pos();
-
- // Read 'size' bytes of data into a MemoryReadStream
- Common::MemoryReadStream *stream = file->readStream(size);
-
- // .. and create an MP3InputStream from all this
- return new MP3InputStream(stream, true);
-}
-
AudioStream *makeMP3Stream(
Common::SeekableReadStream *stream,
bool disposeAfterUse,
diff --git a/sound/mp3.h b/sound/mp3.h
index 17c521ef37..ad66666b00 100644
--- a/sound/mp3.h
+++ b/sound/mp3.h
@@ -41,15 +41,6 @@ namespace Audio {
class AudioStream;
/**
- * Create a new AudioStream from the MP3 data in the given
- * file. If you only want to play part of that file, then seek
- * to the start position in file before passing it to this
- * factory function, and specify the appropriate size.
- */
-AudioStream *makeMP3Stream(Common::File *file, uint32 size);
-
-
-/**
* Create a new AudioStream from the MP3 data in the given stream.
* Allows for looping (which is why we require a SeekableReadStream),
* and specifying only a portion of the data to be played, based
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp
index be15039aca..668cdf4fc7 100644
--- a/sound/vorbis.cpp
+++ b/sound/vorbis.cpp
@@ -266,23 +266,6 @@ void VorbisInputStream::refill() {
#pragma mark -
-AudioStream *makeVorbisStream(Common::File *file, uint32 size) {
- assert(file);
-
- // FIXME: For now, just read the whole data into memory, and be done
- // with it. Of course this is in general *not* a nice thing to do...
-
- // If no size was specified, read the whole remainder of the file
- if (!size)
- size = file->size() - file->pos();
-
- // Read 'size' bytes of data into a MemoryReadStream
- Common::MemoryReadStream *stream = file->readStream(size);
-
- // .. and create a VorbisInputStream from all this
- return new VorbisInputStream(stream, true);
-}
-
AudioStream *makeVorbisStream(
Common::SeekableReadStream *stream,
bool disposeAfterUse,
diff --git a/sound/vorbis.h b/sound/vorbis.h
index 03d2496fe8..98430e6aaa 100644
--- a/sound/vorbis.h
+++ b/sound/vorbis.h
@@ -41,15 +41,6 @@ namespace Audio {
class AudioStream;
/**
- * Create a new AudioStream from the Ogg Vorbis data in the given
- * file. If you only want to play part of that file, then seek
- * to the start position in file before passing it to this
- * factory function, and specify the appropriate size.
- */
-AudioStream *makeVorbisStream(Common::File *file, uint32 size);
-
-
-/**
* Create a new AudioStream from the Ogg Vorbis data in the given stream.
* Allows for looping (which is why we require a SeekableReadStream),
* and specifying only a portion of the data to be played, based