hedgewars/uSound.pas
changeset 2603 abed6070a669
parent 2602 3deb9ff104da
child 2630 079ef82eac75
--- a/hedgewars/uSound.pas	Thu Nov 05 20:47:42 2009 +0000
+++ b/hedgewars/uSound.pas	Thu Nov 05 20:48:13 2009 +0000
@@ -31,7 +31,6 @@
 procedure ReleaseSound;
 procedure SoundLoad;
 procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack);
-procedure LoopSound(snd: TSound; voicepack: PVoicepack);
 procedure PlayMusic;
 procedure PauseMusic;
 procedure ResumeMusic;
@@ -67,7 +66,6 @@
 end;
 
 procedure InitSound;
-var i: TSound;
 begin
 if not isSoundEnabled then exit;
 WriteToConsole('Init sound...');
@@ -79,9 +77,6 @@
 Mix_AllocateChannels(Succ(chanTPU));
 if isMusicEnabled then Mix_VolumeMusic(50);
 
-for i:= Low(TSound) to High(TSound) do
-	lastChan[i]:= -1;
-
 Volume:= 0;
 ChangeVolume(cInitVolume)
 end;
@@ -110,7 +105,7 @@
 defVoicepack:= AskForVoicepack('Default');
 
 for i:= Low(TSound) to High(TSound) do
-	if (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then
+	if Soundz[i].Path <> ptVoices then
 		begin
 		s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName;
 		WriteToConsole(msgLoading + s + ' ');
@@ -122,7 +117,7 @@
 for t:= 0 to cMaxTeams do
 	if voicepacks[t].name <> '' then
 		for i:= Low(TSound) to High(TSound) do
-			if (Soundz[i].Path = ptVoices) and (Soundz[i].FileName <> '') then
+			if Soundz[i].Path = ptVoices then
 				begin
 				s:= Pathz[Soundz[i].Path] + '/' + voicepacks[t].name + '/' + Soundz[i].FileName;
 				WriteToConsole(msgLoading + s + ' ');
@@ -149,25 +144,11 @@
 	lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], loops, -1)
 end;
 
-procedure LoopSound(snd: TSound; voicepack: PVoicepack);
-begin
-if (not isSoundEnabled) or fastUntilLag then exit;
-if lastChan[snd] <> -1 then exit;
-
-if (voicepack <> nil) and (voicepack^.chunks[snd] <> nil) then
-	lastChan[snd]:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], -1, -1)
-else
-	lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1)
-end;
-
 procedure StopSound(snd: TSound);
 begin
 if not isSoundEnabled then exit;
-if (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then
-	begin
-	Mix_HaltChannel(lastChan[snd]);
-	lastChan[snd]:= -1;
-	end;
+if Mix_Playing(lastChan[snd]) <> 0 then
+	Mix_HaltChannel(lastChan[snd])
 end;
 
 procedure PlayMusic;