[Scummvm-cvs-logs] scummvm master -> 8ee1a85f3589bc5da2ad6d0b75a550f8df5d62dd

dreammaster dreammaster at scummvm.org
Thu Oct 16 03:19:34 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8ee1a85f35 MADS: Save redundant reloads of digital audio when switching animations


Commit: 8ee1a85f3589bc5da2ad6d0b75a550f8df5d62dd
    https://github.com/scummvm/scummvm/commit/8ee1a85f3589bc5da2ad6d0b75a550f8df5d62dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-10-15T21:18:17-04:00

Commit Message:
MADS: Save redundant reloads of digital audio when switching animations

Changed paths:
    engines/mads/audio.cpp



diff --git a/engines/mads/audio.cpp b/engines/mads/audio.cpp
index 1c61e13..9d62c3f 100644
--- a/engines/mads/audio.cpp
+++ b/engines/mads/audio.cpp
@@ -37,6 +37,7 @@ AudioPlayer::AudioPlayer(Audio::Mixer *mixer, uint32 gameID) : _mixer(mixer), _g
 
 AudioPlayer::~AudioPlayer() {
 	_dsrEntries.clear();
+	_filename = "";
 }
 
 bool AudioPlayer::isPlaying() const {
@@ -65,25 +66,27 @@ void AudioPlayer::setDefaultSoundGroup() {
 }
 
 void AudioPlayer::setSoundGroup(const Common::String &filename) {
-	_dsrEntries.clear();
-
-	_filename = filename;
-	_dsrFile.open(filename);
-
-	// Read header
-	uint16 entryCount = _dsrFile.readUint16LE();
-
-	for (uint16 i = 0; i < entryCount; i++) {
-		DSREntry newEntry;
-		newEntry.frequency = _dsrFile.readUint16LE();
-		newEntry.channels = _dsrFile.readUint32LE();
-		newEntry.compSize = _dsrFile.readUint32LE();
-		newEntry.uncompSize = _dsrFile.readUint32LE();
-		newEntry.offset = _dsrFile.readUint32LE();
-		_dsrEntries.push_back(newEntry);
+	if (_filename != filename) {
+		_dsrEntries.clear();
+
+		_filename = filename;
+		_dsrFile.open(filename);
+
+		// Read header
+		uint16 entryCount = _dsrFile.readUint16LE();
+
+		for (uint16 i = 0; i < entryCount; i++) {
+			DSREntry newEntry;
+			newEntry.frequency = _dsrFile.readUint16LE();
+			newEntry.channels = _dsrFile.readUint32LE();
+			newEntry.compSize = _dsrFile.readUint32LE();
+			newEntry.uncompSize = _dsrFile.readUint32LE();
+			newEntry.offset = _dsrFile.readUint32LE();
+			_dsrEntries.push_back(newEntry);
+		}
+
+		_dsrFile.close();
 	}
-
-	_dsrFile.close();
 }
 
 void AudioPlayer::playSound(int soundIndex, bool loop) {






More information about the Scummvm-git-logs mailing list