[Scummvm-cvs-logs] SF.net SVN: scummvm:[48903] scummvm/trunk/engines/sci/sound/audio.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Mon May 3 13:58:45 CEST 2010
Revision: 48903
http://scummvm.svn.sourceforge.net/scummvm/?rev=48903&view=rev
Author: m_kiewitz
Date: 2010-05-03 11:58:45 +0000 (Mon, 03 May 2010)
Log Message:
-----------
SCI: calculate sampleLen for compressed audio (mp3/ogg/flac) as well
Modified Paths:
--------------
scummvm/trunk/engines/sci/sound/audio.cpp
Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp 2010-05-03 11:14:39 UTC (rev 48902)
+++ scummvm/trunk/engines/sci/sound/audio.cpp 2010-05-03 11:58:45 UTC (rev 48903)
@@ -205,6 +205,7 @@
}
Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 volume, int *sampleLen) {
+ Audio::SeekableAudioStream *audioSeekStream = 0;
Audio::RewindableAudioStream *audioStream = 0;
uint32 size = 0;
byte *data = 0;
@@ -236,17 +237,17 @@
switch (audioCompressionType) {
case MKID_BE('MP3 '):
#ifdef USE_MAD
- audioStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::NO);
+ audioSeekStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::NO);
#endif
break;
case MKID_BE('OGG '):
#ifdef USE_VORBIS
- audioStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::NO);
+ audioSeekStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::NO);
#endif
break;
case MKID_BE('FLAC'):
#ifdef USE_FLAC
- audioStream = Audio::makeFLACStream(compressedStream, DisposeAfterUse::NO);
+ audioSeekStream = Audio::makeFLACStream(compressedStream, DisposeAfterUse::NO);
#endif
break;
}
@@ -284,13 +285,20 @@
}
if (data)
- audioStream = Audio::makeRawStream(data, size, _audioRate, flags);
+ audioSeekStream = Audio::makeRawStream(data, size, _audioRate, flags);
}
- if (audioStream) {
- *sampleLen = (flags & Audio::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
+ if (audioSeekStream) {
+ *sampleLen = (audioSeekStream->getLength().msecs() * 10000) / 166666; // we translate msecs to ticks
+ // Original code
+ //*sampleLen = (flags & Audio::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
+ audioStream = audioSeekStream;
+ } else {
+ // TODO: if possible make makeWAVStream() return seekableAudioStream as well, so we will be able to calculate sampleLen
+ *sampleLen = 0;
+ }
+ if (audioStream)
return audioStream;
- }
return NULL;
}
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