hedgewars/uSound.pas
changeset 4436 94c948a92759
parent 4404 6bae4e9461aa
child 4461 2f4f5d649bcd
equal deleted inserted replaced
4366:d19adc635c99 4436:94c948a92759
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uSound;
    21 unit uSound;
    22 interface
    22 interface
    23 uses SDLh, uConsts;
    23 uses SDLh, uConsts, uTypes;
    24 
       
    25 type PVoicepack = ^TVoicepack;
       
    26     TVoicepack = record
       
    27         name: shortstring;
       
    28         chunks: array [TSound] of PMixChunk;
       
    29         end;
       
    30 
    24 
    31 var MusicFN: shortstring;
    25 var MusicFN: shortstring;
    32 
    26 
    33 procedure initModule;
    27 procedure initModule;
    34 procedure freeModule;
    28 procedure freeModule;
    50 function  ChangeVolume(voldelta: LongInt): LongInt;
    44 function  ChangeVolume(voldelta: LongInt): LongInt;
    51 function  AskForVoicepack(name: shortstring): Pointer;
    45 function  AskForVoicepack(name: shortstring): Pointer;
    52 
    46 
    53 
    47 
    54 implementation
    48 implementation
    55 uses uMisc, uConsole;
    49 uses uVariables, uConsole, uUtils, uCommands, uDebug;
    56 
    50 
    57 const chanTPU = 32;
    51 const chanTPU = 32;
    58 var Volume: LongInt;
    52 var Volume: LongInt;
    59     lastChan: array [TSound] of LongInt;
    53     lastChan: array [TSound] of LongInt;
    60     voicepacks: array[0..cMaxTeams] of TVoicepack;
    54     voicepacks: array[0..cMaxTeams] of TVoicepack;
   321         exit;
   315         exit;
   322 
   316 
   323     Mix_ResumeMusic(Mus);
   317     Mix_ResumeMusic(Mus);
   324 end;
   318 end;
   325 
   319 
       
   320 procedure chVoicepack(var s: shortstring);
       
   321 begin
       
   322     if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/voicepack"', true);
       
   323     if s[1]='"' then Delete(s, 1, 1);
       
   324     if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
       
   325     CurrentTeam^.voicepack:= AskForVoicepack(s)
       
   326 end;
       
   327 
   326 procedure initModule;
   328 procedure initModule;
   327 begin
   329 begin
       
   330     RegisterVariable('voicepack', vtCommand, @chVoicepack, false);
   328     MusicFN:='';
   331     MusicFN:='';
   329 end;
   332 end;
   330 
   333 
   331 procedure freeModule;
   334 procedure freeModule;
   332 begin
   335 begin