From 4294b94728bee8e70d0b493fe1e15f7e27fc56ae Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@zdoom.fake>
Date: Sun, 26 Apr 2015 22:09:19 +0200
Subject: [PATCH] - since Wads.ReopenLumpNum already performs caching on the
 lump data it is not really necessary anymore to maintain a separate
 musiccache, so this code can be removed.

---
 src/s_sound.cpp | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/src/s_sound.cpp b/src/s_sound.cpp
index 070ba56584..e34edf1177 100644
--- a/src/s_sound.cpp
+++ b/src/s_sound.cpp
@@ -2331,8 +2331,6 @@ bool S_StartMusic (const char *m_id)
 // specified, it will only be played if the specified CD is in a drive.
 //==========================================================================
 
-TArray<BYTE> musiccache;
-
 bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
 {
 	if (!force && PlayList)
@@ -2456,31 +2454,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
 			}
 			if (handle == NULL)
 			{
-				if (!Wads.IsUncompressedFile(lumpnum))
+				if (Wads.LumpLength (lumpnum) == 0)
 				{
-					// We must cache the music data and use it from memory.
-
-					// shut down old music before reallocating and overwriting the cache!
-					S_StopMusic (true);
-
-					length = Wads.LumpLength (lumpnum);
-					if (length == 0)
-					{
-						return false;
-					}
-					musiccache.Resize(length);
-					Wads.ReadLump(lumpnum, &musiccache[0]);
-
-                    reader = new MemoryReader((const char*)&musiccache[0], musiccache.Size());
-				}
-				else
-				{
-					if (Wads.LumpLength (lumpnum) == 0)
-					{
-						return false;
-					}
-					reader = Wads.ReopenLumpNum(lumpnum);
+					return false;
 				}
+				reader = Wads.ReopenLumpNum(lumpnum);
 			}
 		}
 		else