[Scummvm-cvs-logs] SF.net SVN: scummvm: [31547] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 17 19:49:21 CEST 2008


Revision: 31547
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31547&view=rev
Author:   lordhoto
Date:     2008-04-17 10:49:18 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_digital.cpp

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-04-17 17:46:39 UTC (rev 31546)
+++ scummvm/trunk/engines/kyra/sound.h	2008-04-17 17:49:18 UTC (rev 31547)
@@ -490,9 +490,6 @@
 };
 
 // Digital Audio
-
-#define SOUND_STREAMS 4
-
 class AUDStream;
 
 /**
@@ -563,7 +560,7 @@
 	struct Sound {
 		Audio::SoundHandle handle;
 		AUDStream *stream;
-	} _sounds[SOUND_STREAMS];
+	} _sounds[4];
 };
 
 } // end of namespace Kyra

Modified: scummvm/trunk/engines/kyra/sound_digital.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_digital.cpp	2008-04-17 17:46:39 UTC (rev 31546)
+++ scummvm/trunk/engines/kyra/sound_digital.cpp	2008-04-17 17:49:18 UTC (rev 31547)
@@ -319,21 +319,22 @@
 #pragma mark -
 
 SoundDigital::SoundDigital(KyraEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _sounds() {
-	memset(_sounds, 0, sizeof(_sounds));
+	for (uint i = 0; i < ARRAYSIZE(_sounds); ++i)
+		_sounds[i].stream = 0;
 }
 
 SoundDigital::~SoundDigital() {
-	for (int i = 0; i < SOUND_STREAMS; ++i)
+	for (int i = 0; i < ARRAYSIZE(_sounds); ++i)
 		stopSound(i);
 }
 
 int SoundDigital::playSound(Common::SeekableReadStream *stream, kSoundTypes type, bool loop, bool fadeIn, int channel) {
 	Sound *use = 0;
-	if (channel != -1 && channel < SOUND_STREAMS) {
+	if (channel != -1 && channel < ARRAYSIZE(_sounds)) {
 		stopSound(channel);
 		use = &_sounds[channel];
 	} else {
-		for (channel = 0; channel < SOUND_STREAMS; ++channel) {
+		for (channel = 0; channel < ARRAYSIZE(_sounds); ++channel) {
 			if (!isPlaying(channel)) {
 				stopSound(channel);
 				use = &_sounds[channel];
@@ -374,7 +375,7 @@
 	if (channel == -1)
 		return false;
 
-	assert(channel >= 0 && channel < SOUND_STREAMS);
+	assert(channel >= 0 && channel < ARRAYSIZE(_sounds));
 
 	if (!_sounds[channel].stream)
 		return false;
@@ -383,13 +384,13 @@
 }
 
 void SoundDigital::stopSound(int channel) {
-	assert(channel >= 0 && channel < SOUND_STREAMS);
+	assert(channel >= 0 && channel < ARRAYSIZE(_sounds));
 	_mixer->stopHandle(_sounds[channel].handle);
 	_sounds[channel].stream = 0;
 }
 
 void SoundDigital::stopAllSounds() {
-	for (int i = 0; i < SOUND_STREAMS; ++i) {
+	for (int i = 0; i < ARRAYSIZE(_sounds); ++i) {
 		if (isPlaying(i))
 			stopSound(i);
 	}


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