- Move openStreamFile from AudioStream to SeekableAudioStream.

- Fix documentation of openStreamFile.

svn-id: r47080
This commit is contained in:
Johannes Schickel 2010-01-06 15:23:33 +00:00
parent 027fe079c9
commit 84f3034406
7 changed files with 16 additions and 21 deletions

View File

@ -308,7 +308,7 @@ void MoviePlayerDXA::startSound() {
_bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), true);
}
} else {
_bgSoundStream = Audio::AudioStream::openStreamFile(baseName);
_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName);
}
if (_bgSoundStream != NULL) {

View File

@ -277,7 +277,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
sprintf(trackName[1], "track%02d", realTrackNumber);
Audio::SeekableAudioStream *stream = 0;
for (int i = 0; i < 2; ++i) {
stream = Audio::AudioStream::openStreamFile(trackName[i]);
stream = Audio::SeekableAudioStream::openStreamFile(trackName[i]);
if (stream) {
_mixer->playInputStreamLooping(Audio::Mixer::kMusicSoundType, &_musicHandle, stream, (flags == MUSIC_LOOP) ? 0 : 1);
_digitalMusic = true;

View File

@ -87,7 +87,7 @@ bool MoviePlayer::load(uint32 id) {
char filename[20];
if (_decoderType == kVideoDecoderDXA) {
_bgSoundStream = Audio::AudioStream::openStreamFile(sequenceList[id]);
_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(sequenceList[id]);
} else {
_bgSoundStream = NULL;
}

View File

@ -63,7 +63,7 @@ MoviePlayer:: ~MoviePlayer() {
*/
bool MoviePlayer::load(const char *name) {
if (_decoderType == kVideoDecoderDXA) {
_bgSoundStream = Audio::AudioStream::openStreamFile(name);
_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(name);
} else {
_bgSoundStream = NULL;
}

View File

@ -69,7 +69,7 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration,
repetitions. Finally, -1 means infinitely many
*/
// We multiply by 40 / 3 = 1000 / 75 to convert frames to milliseconds
stream = AudioStream::openStreamFile(trackName[i]);
stream = SeekableAudioStream::openStreamFile(trackName[i]);
}
// Stop any currently playing emulated track

View File

@ -74,7 +74,7 @@ static const StreamFileFormat STREAM_FILEFORMATS[] = {
{ NULL, NULL, NULL } // Terminator
};
SeekableAudioStream *AudioStream::openStreamFile(const Common::String &basename) {
SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &basename) {
SeekableAudioStream *stream = NULL;
Common::File *fileHandle = new Common::File();

View File

@ -84,21 +84,6 @@ public:
*/
virtual bool endOfStream() const { return endOfData(); }
/**
* Tries to load a file by trying all available formats.
* In case of an error, the file handle will be closed, but deleting
* it is still the responsibilty of the caller.
* @param basename a filename without an extension
* @param startTime the (optional) time offset in milliseconds from which
* to start playback
* @param duration the (optional) time in milliseconds specifying how long
to play
* @param numLoops how often the data shall be looped (0 = infinite)
* @return an Audiostream ready to use in case of success;
* NULL in case of an error (e.g. invalid/nonexisting file)
*/
static SeekableAudioStream *openStreamFile(const Common::String &basename);
/**
* Sets number of times the stream is supposed to get looped
* This also resets the number of loops played counter, which
@ -123,6 +108,16 @@ public:
*/
class SeekableAudioStream : public AudioStream {
public:
/**
* Tries to load a file by trying all available formats.
* In case of an error, the file handle will be closed, but deleting
* it is still the responsibilty of the caller.
* @param basename a filename without an extension
* @return an SeekableAudioStream ready to use in case of success;
* NULL in case of an error (e.g. invalid/nonexisting file)
*/
static SeekableAudioStream *openStreamFile(const Common::String &basename);
/**
* Seeks to a given offset in the stream.
*