hedgewars/uSound.pas
branchqmlfrontend
changeset 11828 a69124eb7ce7
parent 11823 0fba6cb098a1
child 11835 8f7e28428f3e
equal deleted inserted replaced
11827:8c71c5a1172f 11828:a69124eb7ce7
    31  *    Looped Sound - Subtype of sound: plays in a loop using a
    31  *    Looped Sound - Subtype of sound: plays in a loop using a
    32  *                   "channel", of which the id is returned on start.
    32  *                   "channel", of which the id is returned on start.
    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;
    37 
    37 
    38 procedure preInitModule;
    38 procedure preInitModule;
    39 procedure initModule;
    39 procedure initModule;
    40 procedure freeModule;
    40 procedure freeModule;
    41 
    41 
   108     SDMusicFN: shortstring; // SD music file name
   108     SDMusicFN: shortstring; // SD music file name
   109 
   109 
   110 var Volume: LongInt;
   110 var Volume: LongInt;
   111     SoundTimerTicks: Longword;
   111     SoundTimerTicks: Longword;
   112 implementation
   112 implementation
   113 uses uVariables, uConsole, uCommands, uDebug, uPhysFSLayer;
   113 uses uVariables, uConsole, uCommands, uChat, uUtils, uDebug, uPhysFSLayer;
   114 
   114 
   115 const chanTPU = 32;
   115 const chanTPU = 32;
   116 var cInitVolume: LongInt;
   116 var cInitVolume: LongInt;
   117     previousVolume: LongInt; // cached volume value
   117     previousVolume: LongInt; // cached volume value
   118     lastChan: array [TSound] of LongInt;
   118     lastChan: array [TSound] of LongInt;
   250             (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
   250             (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
   251             (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
   251             (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
   252             (FileName:               'TARDIS.ogg'; Path: ptSounds),// sndTardis
   252             (FileName:               'TARDIS.ogg'; Path: ptSounds),// sndTardis
   253             (FileName:    'frozen_hog_impact.ogg'; Path: ptSounds),// sndFrozenHogImpact
   253             (FileName:    'frozen_hog_impact.ogg'; Path: ptSounds),// sndFrozenHogImpact
   254             (FileName:             'ice_beam.ogg'; Path: ptSounds),// sndIceBeam
   254             (FileName:             'ice_beam.ogg'; Path: ptSounds),// sndIceBeam
   255             (FileName:           'hog_freeze.ogg'; Path: ptSounds) // sndHogFreeze
   255             (FileName:           'hog_freeze.ogg'; Path: ptSounds),// sndHogFreeze
       
   256             (FileName:       'airmine_impact.ogg'; Path: ptSounds),// sndAirMineImpact
       
   257             (FileName:         'knife_impact.ogg'; Path: ptSounds),// sndKnifeImpact
       
   258             (FileName:            'extratime.ogg'; Path: ptSounds) // sndExtraTime
   256             );
   259             );
   257 
   260 
   258 
   261 
   259 
   262 
   260 function  AskForVoicepack(name: shortstring): Pointer;
   263 function  AskForVoicepack(name: shortstring): Pointer;
   576 
   579 
   577     Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));
   580     Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));
   578     SDLCheck(Mus <> nil, 'Mix_LoadMUS_RW', false);
   581     SDLCheck(Mus <> nil, 'Mix_LoadMUS_RW', false);
   579     WriteLnToConsole(msgOK);
   582     WriteLnToConsole(msgOK);
   580 
   583 
       
   584     // display music credits
       
   585     s:= s + '_credits.txt';
       
   586 
       
   587     // if per-file credits not found check general music credits file
       
   588     if pfsExists(s) then
       
   589         s:= read1stLn(s)
       
   590     else if SuddenDeath and (SDMusicFN <> '') then
       
   591         s:= readValueFromINI(SDMusicFN, '/Music/credits.txt')
       
   592     else
       
   593         s:= readValueFromINI(MusicFN, '/Music/credits.txt');
       
   594 
       
   595     if Length(s) > 0 then
       
   596         AddChatString(char(#10) + '© Music: ' + s);
       
   597 
   581     SDLCheck(Mix_FadeInMusic(Mus, -1, 3000) <> -1, 'Mix_FadeInMusic', false)
   598     SDLCheck(Mix_FadeInMusic(Mus, -1, 3000) <> -1, 'Mix_FadeInMusic', false)
   582 end;
   599 end;
   583 
   600 
   584 procedure SetVolume(vol: LongInt);
   601 procedure SetVolume(vol: LongInt);
   585 begin
   602 begin