[Scummvm-cvs-logs] SF.net SVN: scummvm: [25728] scummvm/trunk/sound

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 19 19:17:39 CET 2007


Revision: 25728
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25728&view=rev
Author:   fingolfin
Date:     2007-02-19 10:17:38 -0800 (Mon, 19 Feb 2007)

Log Message:
-----------
So far we only accepted track1.* as name for audio tracks -- now we also accept track01.* (we still only document the former naming scheme, intentionally)

Modified Paths:
--------------
    scummvm/trunk/sound/audiocd.cpp
    scummvm/trunk/sound/flac.cpp
    scummvm/trunk/sound/mp3.cpp
    scummvm/trunk/sound/vorbis.cpp

Modified: scummvm/trunk/sound/audiocd.cpp
===================================================================
--- scummvm/trunk/sound/audiocd.cpp	2007-02-19 17:48:19 UTC (rev 25727)
+++ scummvm/trunk/sound/audiocd.cpp	2007-02-19 18:17:38 UTC (rev 25728)
@@ -41,7 +41,7 @@
 	/**
 	 * Pointer to a function which tries to open the specified track - the only argument
 	 * is the number of the track to be played.
-	 * Returns either the DigitalTrackInfo object representing the requested track or null
+	 * Returns either a DigitalTrackInfo object representing the requested track or null
 	 * in case of an error
 	 */
 	DigitalTrackInfo* (*openTrackFunction)(int);
@@ -49,15 +49,15 @@
 
 static const TrackFormat TRACK_FORMATS[] = {
 	/* decoderName,		openTrackFunction */
-#ifdef USE_FLAC
-	{ "Flac",			getFlacTrack },
-#endif
 #ifdef USE_VORBIS
 	{ "Ogg Vorbis",		getVorbisTrack },
 #endif
 #ifdef USE_MAD
 	{ "MPEG Layer 3",	getMP3Track },
 #endif
+#ifdef USE_FLAC
+	{ "Flac",			getFlacTrack },
+#endif
 
 	{ NULL, NULL } // Terminator
 };

Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp	2007-02-19 17:48:19 UTC (rev 25727)
+++ scummvm/trunk/sound/flac.cpp	2007-02-19 18:17:38 UTC (rev 25728)
@@ -933,31 +933,25 @@
 }
 
 DigitalTrackInfo* getFlacTrack(int track) {
-	assert(track >=1);
-	char track_name[32];
+	assert(track >= 1);
+	char trackName[4][32];
 	File *file = new File();
 
-	sprintf(track_name, "track%d.flac", track);
-	file->open(track_name);
+	sprintf(trackName[0], "track%d.flac", track);
+	sprintf(trackName[1], "track%02d.flac", track);
+	sprintf(trackName[2], "track%d.fla", track);
+	sprintf(trackName[3], "track%02d.fla", track);
 
-	if (file->isOpen()) {
-		FlacTrackInfo *trackInfo = new FlacTrackInfo(file);
-		if (!trackInfo->error())
-			return trackInfo;
-		delete trackInfo;
-	}
 
-	sprintf(track_name, "track%d.fla", track);
-	file->open(track_name);
-
-	if (file->isOpen()) {
-		FlacTrackInfo *trackInfo = new FlacTrackInfo(file);
-		if (!trackInfo->error())
-			return trackInfo;
-		delete trackInfo;
+	for (int i = 0; i < 4; ++i) {
+		if (file->open(trackName[i])) {
+			FlacTrackInfo *trackInfo = new FlacTrackInfo(file);
+			if (!trackInfo->error())
+				return trackInfo;
+			delete trackInfo;
+		}
 	}
 
-
 	delete file;
 	return NULL;
 }

Modified: scummvm/trunk/sound/mp3.cpp
===================================================================
--- scummvm/trunk/sound/mp3.cpp	2007-02-19 17:48:19 UTC (rev 25727)
+++ scummvm/trunk/sound/mp3.cpp	2007-02-19 18:17:38 UTC (rev 25728)
@@ -472,17 +472,19 @@
 }
 
 DigitalTrackInfo *getMP3Track(int track) {
-	char track_name[32];
+	char trackName[2][32];
 	File *file = new File();
 
-	sprintf(track_name, "track%d.mp3", track);
-	file->open(track_name);
+	sprintf(trackName[0], "track%d.mp3", track);
+	sprintf(trackName[1], "track%02d.mp3", track);
 
-	if (file->isOpen()) {
-		MP3TrackInfo *trackInfo = new MP3TrackInfo(file);
-		if (!trackInfo->error())
-			return trackInfo;
-		delete trackInfo;
+	for (int i = 0; i < 2; ++i) {
+		if (file->open(trackName[i])) {
+			MP3TrackInfo *trackInfo = new MP3TrackInfo(file);
+			if (!trackInfo->error())
+				return trackInfo;
+			delete trackInfo;
+		}
 	}
 	delete file;
 	return NULL;

Modified: scummvm/trunk/sound/vorbis.cpp
===================================================================
--- scummvm/trunk/sound/vorbis.cpp	2007-02-19 17:48:19 UTC (rev 25727)
+++ scummvm/trunk/sound/vorbis.cpp	2007-02-19 18:17:38 UTC (rev 25728)
@@ -243,19 +243,20 @@
 }
 
 DigitalTrackInfo *getVorbisTrack(int track) {
-//debug(5, "" __FILE__ ":%i", __LINE__);
-	char track_name[32];
+	char trackName[2][32];
 	File *file = new File();
 
-	sprintf(track_name, "track%d.ogg", track);
-	file->open(track_name);
+	sprintf(trackName[0], "track%d.ogg", track);
+	sprintf(trackName[1], "track%02d.ogg", track);
 
-	if (file->isOpen()) {
-		VorbisTrackInfo *trackInfo = new VorbisTrackInfo(file);
-		file->decRef();
-		if (!trackInfo->error())
-			return trackInfo;
-		delete trackInfo;
+	for (int i = 0; i < 2; ++i) {
+		if (file->open(trackName[i])) {
+			VorbisTrackInfo *trackInfo = new VorbisTrackInfo(file);
+			file->decRef();
+			if (!trackInfo->error())
+				return trackInfo;
+			delete trackInfo;
+		}
 	}
 	delete file;
 	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