hedgewars/uSound.pas
changeset 4948 c3dc41ae68fa
parent 4748 ce9b48de1f52
child 4956 48e1f9a04c28
equal deleted inserted replaced
4947:cfac6aab84a0 4948:c3dc41ae68fa
    45 function  ChangeVolume(voldelta: LongInt): LongInt;
    45 function  ChangeVolume(voldelta: LongInt): LongInt;
    46 function  AskForVoicepack(name: shortstring): Pointer;
    46 function  AskForVoicepack(name: shortstring): Pointer;
    47 
    47 
    48 
    48 
    49 implementation
    49 implementation
    50 uses uVariables, uConsole, uUtils, uCommands, uDebug, uMobile;
    50 uses uVariables, uConsole, uUtils, uCommands, uDebug;
    51 
    51 
    52 const chanTPU = 32;
    52 const chanTPU = 32;
    53 var Volume: LongInt;
    53 var Volume: LongInt;
    54     lastChan: array [TSound] of LongInt;
    54     lastChan: array [TSound] of LongInt;
    55     voicepacks: array[0..cMaxTeams] of TVoicepack;
    55     voicepacks: array[0..cMaxTeams] of TVoicepack;
   178 end;
   178 end;
   179 
   179 
   180 procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean);
   180 procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean);
   181 var s:shortstring;
   181 var s:shortstring;
   182 begin
   182 begin
   183     if (not isSoundEnabled) or fastUntilLag or isDeviceMute() then
   183     if (not isSoundEnabled) or fastUntilLag then
   184         exit;
   184         exit;
   185 
   185 
   186     if keepPlaying and (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then
   186     if keepPlaying and (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then
   187         exit;
   187         exit;
   188 
   188 
   220 end;
   220 end;
   221 
   221 
   222 function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
   222 function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
   223 var s: shortstring;
   223 var s: shortstring;
   224 begin
   224 begin
   225     if (not isSoundEnabled) or fastUntilLag or isDeviceMute() then
   225     if (not isSoundEnabled) or fastUntilLag then
   226     begin
   226     begin
   227         LoopSound:= -1;
   227         LoopSound:= -1;
   228         exit
   228         exit
   229     end;
   229     end;
   230 
   230