aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/resource_audio.cpp
diff options
context:
space:
mode:
authorMax Horn2010-06-15 12:16:42 +0000
committerMax Horn2010-06-15 12:16:42 +0000
commit88663c9186e5a4282f5553ad401b340db51164c2 (patch)
treed84b3a945a73067f068562a4194053b371b8cea5 /engines/sci/resource_audio.cpp
parent348953c067bc9e70702b64f130cbbe4cbc742223 (diff)
downloadscummvm-rg350-88663c9186e5a4282f5553ad401b340db51164c2.tar.gz
scummvm-rg350-88663c9186e5a4282f5553ad401b340db51164c2.tar.bz2
scummvm-rg350-88663c9186e5a4282f5553ad401b340db51164c2.zip
SCI: Merge ResourceManager::checkIfAudioVolumeIsCompressed into AudioVolumeResourceSource constructor
svn-id: r49827
Diffstat (limited to 'engines/sci/resource_audio.cpp')
-rw-r--r--engines/sci/resource_audio.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 25e73242ef..4f38fe15d1 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -35,13 +35,19 @@ namespace Sci {
AudioVolumeResourceSource::AudioVolumeResourceSource(const Common::String &name, ResourceSource *map, int volNum)
: VolumeResourceSource(name, map, volNum, kSourceAudioVolume) {
-}
-void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
- Common::SeekableReadStream *fileStream = getVolumeFile(source);
+ ResourceManager *resMan = g_sci->getResMan();
+
+ /*
+ * Check if this audio volume got compressed by our tool. If that is the
+ * case, set _audioCompressionType and read in the offset translation
+ * table for later usage.
+ */
+
+ Common::SeekableReadStream *fileStream = resMan->getVolumeFile(this);
if (!fileStream) {
- warning("Failed to open %s", source->getLocationName().c_str());
+ warning("Failed to open %s", getLocationName().c_str());
return;
}
@@ -52,13 +58,13 @@ void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
case MKID_BE('OGG '):
case MKID_BE('FLAC'):
// Detected a compressed audio volume
- source->_audioCompressionType = compressionType;
+ _audioCompressionType = compressionType;
// Now read the whole offset mapping table for later usage
int32 recordCount = fileStream->readUint32LE();
if (!recordCount)
error("compressed audio volume doesn't contain any entries!");
int32 *offsetMapping = new int32[(recordCount + 1) * 2];
- source->_audioCompressionOffsetMapping = offsetMapping;
+ _audioCompressionOffsetMapping = offsetMapping;
for (int recordNo = 0; recordNo < recordCount; recordNo++) {
*offsetMapping++ = fileStream->readUint32LE();
*offsetMapping++ = fileStream->readUint32LE();
@@ -68,7 +74,7 @@ void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
*offsetMapping++ = fileStream->size();
}
- if (source->_resourceFile)
+ if (_resourceFile)
delete fileStream;
}