changeset 1545:1047d8a70a6c

Correct title generation, use that tuple builder.
author Tony Vroon <chainsaw@gentoo.org>
date Sat, 01 Sep 2007 01:00:13 +0100
parents 0cfbecddb647
children a8436c6e3753
files src/modplug/modplugbmp.cxx
diffstat 1 files changed, 9 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/modplug/modplugbmp.cxx	Fri Aug 31 23:48:45 2007 +0100
+++ b/src/modplug/modplugbmp.cxx	Sat Sep 01 01:00:13 2007 +0100
@@ -327,6 +327,8 @@
 
 void ModplugXMMS::PlayFile(const string& aFilename, InputPlayback *ipb)
 {
+	int32 aLength;
+	char *aModName;
 	mStopped = true;
 	mPaused = false;
 	
@@ -411,34 +413,15 @@
 		mArchive->Size()
 	);
 	mPlayed = 0;
-	
-	bool useFilename = mModProps.mUseFilename;
-	
-	if(!useFilename)
-	{
-		strncpy(mModName, mSoundFile->GetTitle(), 100);
-		
-		for(int i = 0; mModName[i] == ' ' || mModName[i] == 0; i++)
-		{
-			if(mModName[i] == 0)
-			{
-				useFilename = true;  //mod name is blank -- use filename
-				break;
-			}
-		}
-	}
-	
-	if(useFilename)
-	{
-		strncpy(mModName, strrchr(aFilename.c_str(), '/') + 1, 100);
-		char* ext = strrchr(mModName, '.');
-		if(ext) *ext = '\0';
-	}
-	
+
+        Tuple* ti = GetSongTuple( aFilename );
+        if ( ti )
+                aModName = format_and_free_ti( ti, &aLength );
+
 	mInPlug->set_info
 	(
-		mModName,
-		mSoundFile->GetSongTime() * 1000,
+		aModName,
+		aLength,
 		mSoundFile->GetNumChannels() * 1000,
 		mModProps.mFrequency,
 		mModProps.mChannels