hedgewars/uSound.pas
changeset 7896 67217e6108fd
parent 7848 775a72905708
child 7977 4987f6f83cdf
child 7980 7f8df51553a7
equal deleted inserted replaced
7894:1e8e9400e9de 7896:67217e6108fd
    33  *                   The channel id can be used to stop a specific sound loop.
    33  *                   The channel id can be used to stop a specific sound loop.
    34  *)
    34  *)
    35 interface
    35 interface
    36 uses SDLh, uConsts, uTypes, SysUtils;
    36 uses SDLh, uConsts, uTypes, SysUtils;
    37 
    37 
       
    38 procedure preInitModule;
    38 procedure initModule;
    39 procedure initModule;
    39 procedure freeModule;
    40 procedure freeModule;
    40 
    41 
    41 procedure InitSound;                            // Initiates sound-system if isSoundEnabled.
    42 procedure InitSound;                            // Initiates sound-system if isSoundEnabled.
    42 procedure ReleaseSound(complete: boolean);      // Releases sound-system and used resources.
    43 procedure ReleaseSound(complete: boolean);      // Releases sound-system and used resources.
   575 begin
   576 begin
   576     s:= s; // avoid compiler hint
   577     s:= s; // avoid compiler hint
   577     MuteAudio;
   578     MuteAudio;
   578 end;
   579 end;
   579 
   580 
       
   581 procedure preInitModule;
       
   582 begin
       
   583     isMusicEnabled:= true;
       
   584     isSoundEnabled:= true;
       
   585     cInitVolume:= 100;
       
   586 end;
       
   587 
   580 procedure initModule;
   588 procedure initModule;
   581 var t: LongInt;
   589 var t: LongInt;
   582     i: TSound;
   590     i: TSound;
   583 begin
   591 begin
   584     RegisterVariable('voicepack', @chVoicepack, false);
   592     RegisterVariable('voicepack', @chVoicepack, false);
   585     RegisterVariable('mute'     , @chMute     , true );
   593     RegisterVariable('mute'     , @chMute     , true );
   586 
   594 
   587     MusicFN:='';
   595     MusicFN:='';
   588     Mus:= nil;
   596     Mus:= nil;
   589     isMusicEnabled:= true;
       
   590     isSoundEnabled:= true;
       
   591     isAudioMuted:= false;
   597     isAudioMuted:= false;
   592     isSEBackup:= isSoundEnabled;
   598     isSEBackup:= isSoundEnabled;
   593     Volume:= 0;
   599     Volume:= 0;
   594     cInitVolume:= 100;
       
   595     defVoicepack:= AskForVoicepack('Default');
   600     defVoicepack:= AskForVoicepack('Default');
   596 
   601 
   597     for i:= Low(TSound) to High(TSound) do
   602     for i:= Low(TSound) to High(TSound) do
   598         lastChan[i]:= -1;
   603         lastChan[i]:= -1;
   599 
   604