hedgewars/uSound.pas
changeset 8015 e7869e70db35
parent 7984 619a399bece8
child 8018 091293bc974f
child 8025 07862ab415c8
equal deleted inserted replaced
8014:851f65004c33 8015:e7869e70db35
   268         if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then
   268         if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then
   269             begin
   269             begin
   270             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   270             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   271             if not FileExists(s) then
   271             if not FileExists(s) then
   272                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   272                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   273             if not FileExists(s) and (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
   273             if (not FileExists(s)) and (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
   274                 s:= Pathz[Soundz[sndFirePunch1].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   274                 s:= Pathz[Soundz[sndFirePunch1].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   275             WriteToConsole(msgLoading + s + ' ');
   275             WriteToConsole(msgLoading + s + ' ');
   276             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   276             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   277             if voicepack^.chunks[snd] = nil then
   277             if voicepack^.chunks[snd] = nil then
   278                 WriteLnToConsole(msgFailed)
   278                 WriteLnToConsole(msgFailed)
   454 end;
   454 end;
   455 
   455 
   456 function ChangeVolume(voldelta: LongInt): LongInt;
   456 function ChangeVolume(voldelta: LongInt): LongInt;
   457 begin
   457 begin
   458     ChangeVolume:= 0;
   458     ChangeVolume:= 0;
   459     if (not isSoundEnabled) or ((voldelta = 0) and not (cInitVolume = 0)) then
   459     if (not isSoundEnabled) or ((voldelta = 0) and (not (cInitVolume = 0))) then
   460         exit;
   460         exit;
   461 
   461 
   462     inc(Volume, voldelta);
   462     inc(Volume, voldelta);
   463     if Volume < 0 then
   463     if Volume < 0 then
   464         Volume:= 0;
   464         Volume:= 0;
   494     ChangeVolume(previousVolume - Volume);
   494     ChangeVolume(previousVolume - Volume);
   495 end;
   495 end;
   496 
   496 
   497 procedure MuteAudio;
   497 procedure MuteAudio;
   498 begin
   498 begin
   499     if (not isSoundEnabled) then
   499     if not isSoundEnabled then
   500         exit;
   500         exit;
   501 
   501 
   502     if (isAudioMuted) then
   502     if (isAudioMuted) then
   503     begin
   503     begin
   504         ResumeMusic;
   504         ResumeMusic;