hedgewars/uSound.pas
changeset 4748 ce9b48de1f52
parent 4461 2f4f5d649bcd
child 4948 c3dc41ae68fa
--- a/hedgewars/uSound.pas	Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uSound.pas	Tue Dec 28 23:53:37 2010 +0100
@@ -39,6 +39,7 @@
 procedure PlayMusic;
 procedure PauseMusic;
 procedure ResumeMusic;
+procedure ChangeMusic;
 procedure StopSound(snd: TSound);
 procedure StopSound(chn: LongInt);
 function  ChangeVolume(voldelta: LongInt): LongInt;
@@ -318,6 +319,17 @@
     Mix_ResumeMusic(Mus);
 end;
 
+procedure ChangeMusic;
+begin
+    if (MusicFN = '') or (not isMusicEnabled) then
+        exit;
+
+    if Mus <> nil then
+        Mix_FreeMusic(Mus);
+
+    PlayMusic;
+end;
+
 procedure chVoicepack(var s: shortstring);
 begin
     if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/voicepack"', true);