hedgewars/uSound.pas
changeset 2832 8cb73c0e77a1
parent 2745 11fce231f24a
child 2905 f3c79f7193a9
equal deleted inserted replaced
2831:797207d0c500 2832:8cb73c0e77a1
   175 	LoopSound:= LoopSound(snd, nil)
   175 	LoopSound:= LoopSound(snd, nil)
   176 end;
   176 end;
   177 
   177 
   178 function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
   178 function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
   179 begin
   179 begin
   180 if (not isSoundEnabled) or fastUntilLag then exit;
   180 if (not isSoundEnabled) or fastUntilLag then
       
   181 	begin
       
   182 	LoopSound:= -1;
       
   183 	exit
       
   184 	end;
   181 
   185 
   182 if (voicepack <> nil) and (voicepack^.chunks[snd] <> nil) then
   186 if (voicepack <> nil) and (voicepack^.chunks[snd] <> nil) then
   183 	LoopSound:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], -1, -1)
   187 	LoopSound:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], -1, -1)
   184 else
   188 else
   185 	LoopSound:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1)
   189 	LoopSound:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1)
   195 	end;
   199 	end;
   196 end;
   200 end;
   197 
   201 
   198 procedure StopSound(chn: LongInt);
   202 procedure StopSound(chn: LongInt);
   199 begin
   203 begin
   200 	if (chn <> -1) and (Mix_Playing(chn) <> 0) then Mix_HaltChannel(chn);
   204 if not isSoundEnabled then exit;
       
   205 if (chn <> -1) and (Mix_Playing(chn) <> 0) then Mix_HaltChannel(chn);
   201 end;
   206 end;
   202 
   207 
   203 procedure PlayMusic;
   208 procedure PlayMusic;
   204 var s: string;
   209 var s: string;
   205 begin
   210 begin