[Scummvm-cvs-logs] CVS: scummvm/sword2/driver d_sound.cpp,1.117,1.118 d_sound.h,1.49,1.50

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Fri Aug 27 01:34:34 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12617/driver

Modified Files:
	d_sound.cpp d_sound.h 
Log Message:
Use the same code for opening the music clusters as for opening the speech
clusters. (No, that doesn't mean compressed music is support yet. This is
just a tiny little step closer.)


Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- d_sound.cpp	26 Aug 2004 06:59:15 -0000	1.117
+++ d_sound.cpp	27 Aug 2004 08:31:33 -0000	1.118
@@ -86,9 +86,8 @@
 	// Determine the end position.
 	_end_pos = file->pos() + size;
 
-	_prev = _file->readUint16LE();
-
 	// Read in initial data
+	_prev = _file->readUint16LE();
 	refill();
 }
 
@@ -359,16 +358,7 @@
 	}
 }
 
-int32 MusicHandle::play(const char *filename, uint32 musicId, bool looping) {
-	// The assumption here is that we are never playing music from two
-	// different files at the same time.
-
-	if (!fpMus.isOpen())
-		fpMus.open(filename);
-
-	if (!fpMus.isOpen())
-		return RDERR_INVALIDFILENAME;
-
+int32 MusicHandle::play(uint32 musicId, bool looping) {
 	fpMus.seek((musicId + 1) * 8, SEEK_SET);
 	_fileStart = fpMus.readUint32LE();
 
@@ -669,7 +659,7 @@
  * @return RD_OK or an error code
  */
 
-int32 Sound::streamCompMusic(const char *filename, uint32 musicId, bool looping) {
+int32 Sound::streamCompMusic(uint32 musicId, bool looping) {
 	Common::StackLock lock(_mutex);
 
 	int32 primaryStream = -1;
@@ -722,7 +712,19 @@
 	if (secondaryStream != -1)
 		_music[secondaryStream].fadeDown();
 
-	return _music[primaryStream].play(filename, musicId, looping);
+	// The assumption here is that we are never playing music from two
+	// different files at the same time.
+
+	if (!fpMus.isOpen()) {
+		// TODO: We don't support compressed music yet. Patience.
+		if (openSoundFile(&fpMus, "music") != kCLUMode)
+			return RD_OK;
+	}
+
+	if (!fpMus.isOpen())
+		return RDERR_INVALIDFILENAME;
+
+	return _music[primaryStream].play(musicId, looping);
 }
 
 int32 Sound::dipMusic(void) {
@@ -938,7 +940,6 @@
  * This function loads and decompresses a list of speech from a cluster, but
  * does not play it. This is used for cutscene voice-overs, presumably to
  * avoid having to read from more than one file on the CD during playback.
- * @param filename the file name of the speech cluster file
  * @param speechid the text line id used to reference the speech
  * @param buf a pointer to the buffer that will be allocated for the sound
  */
@@ -973,7 +974,6 @@
 /**
  * This function loads, decompresses and plays a line of speech. An error
  * occurs if speech is already playing.
- * @param filename the name of the speech cluster file
  * @param speechid the text line id used to reference the speech
  * @param vol volume, 0 (minimum) to 16 (maximum)
  * @param pan panning, -16 (full left) to 16 (full right)

Index: d_sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- d_sound.h	25 Aug 2004 06:55:15 -0000	1.49
+++ d_sound.h	27 Aug 2004 08:31:33 -0000	1.50
@@ -73,7 +73,7 @@
 
 	void fadeDown(void);
 	void fadeUp(void);
-	int32 play(const char *filename, uint32 musicId, bool looping);
+	int32 play(uint32 musicId, bool looping);
 	void stop(void);
 	int readBuffer(int16 *buffer, const int numSamples);
 	bool endOfData(void) const;
@@ -138,7 +138,7 @@
 	void saveMusicState(void);
 	void restoreMusicState(void);
 	void waitForLeadOut(void);
-	int32 streamCompMusic(const char *filename, uint32 musicId, bool looping);
+	int32 streamCompMusic(uint32 musicId, bool looping);
 	int32 musicTimeRemaining(void);
 
 	void muteSpeech(bool mute);





More information about the Scummvm-git-logs mailing list