equal
deleted
inserted
replaced
41 |
41 |
42 procedure InitSound; // Initiates sound-system if isSoundEnabled. |
42 procedure InitSound; // Initiates sound-system if isSoundEnabled. |
43 procedure ReleaseSound(complete: boolean); // Releases sound-system and used resources. |
43 procedure ReleaseSound(complete: boolean); // Releases sound-system and used resources. |
44 procedure ResetSound; // Reset sound state to the previous state. |
44 procedure ResetSound; // Reset sound state to the previous state. |
45 procedure SetSound(enabled: boolean); // Enable/disable sound-system and backup status. |
45 procedure SetSound(enabled: boolean); // Enable/disable sound-system and backup status. |
|
46 procedure SetAudioDampen(enabled: boolean); // Enable/disable automatic dampening if losing window focus. |
46 |
47 |
47 // MUSIC |
48 // MUSIC |
48 |
49 |
49 // Obvious music commands for music track |
50 // Obvious music commands for music track |
50 procedure SetMusic(enabled: boolean); // Enable/disable music. |
51 procedure SetMusic(enabled: boolean); // Enable/disable music. |
127 voicepacks: array[0..cMaxTeams] of TVoicepack; |
128 voicepacks: array[0..cMaxTeams] of TVoicepack; |
128 defVoicepack: PVoicepack; |
129 defVoicepack: PVoicepack; |
129 Mus: PMixMusic; // music pointer |
130 Mus: PMixMusic; // music pointer |
130 isMusicEnabled: boolean; |
131 isMusicEnabled: boolean; |
131 isSoundEnabled: boolean; |
132 isSoundEnabled: boolean; |
|
133 isAutoDampening: boolean; |
132 isSEBackup: boolean; |
134 isSEBackup: boolean; |
133 VoiceList : array[0..7] of TVoice = ( |
135 VoiceList : array[0..7] of TVoice = ( |
134 ( snd: sndNone; voicepack: nil), |
136 ( snd: sndNone; voicepack: nil), |
135 ( snd: sndNone; voicepack: nil), |
137 ( snd: sndNone; voicepack: nil), |
136 ( snd: sndNone; voicepack: nil), |
138 ( snd: sndNone; voicepack: nil), |
386 begin |
388 begin |
387 isSEBackup:= isSoundEnabled; |
389 isSEBackup:= isSoundEnabled; |
388 isSoundEnabled:= enabled; |
390 isSoundEnabled:= enabled; |
389 end; |
391 end; |
390 |
392 |
|
393 procedure SetAudioDampen(enabled: boolean); |
|
394 begin |
|
395 isAutoDampening:= enabled; |
|
396 end; |
|
397 |
391 // when complete is false, this procedure just releases some of the chucks on inactive channels |
398 // when complete is false, this procedure just releases some of the chucks on inactive channels |
392 // in this way music is not stopped, nor are chucks currently being played |
399 // in this way music is not stopped, nor are chucks currently being played |
393 procedure ReleaseSound(complete: boolean); |
400 procedure ReleaseSound(complete: boolean); |
394 var i: TSound; |
401 var i: TSound; |
395 t: Longword; |
402 t: Longword; |
750 isAudioMuted:= (Volume = 0); |
757 isAudioMuted:= (Volume = 0); |
751 end; |
758 end; |
752 |
759 |
753 procedure DampenAudio; |
760 procedure DampenAudio; |
754 begin |
761 begin |
755 if (isAudioMuted) then |
762 if (isAudioMuted or (not isAutoDampening)) then |
756 exit; |
763 exit; |
757 previousVolume:= Volume; |
764 previousVolume:= Volume; |
758 ChangeVolume(-Volume * 7 div 9); |
765 ChangeVolume(-Volume * 7 div 9); |
759 end; |
766 end; |
760 |
767 |
761 procedure UndampenAudio; |
768 procedure UndampenAudio; |
762 begin |
769 begin |
763 if (isAudioMuted) then |
770 if (isAudioMuted or (not isAutoDampening)) then |
764 exit; |
771 exit; |
765 ChangeVolume(previousVolume - Volume); |
772 ChangeVolume(previousVolume - Volume); |
766 end; |
773 end; |
767 |
774 |
768 procedure MuteAudio; |
775 procedure MuteAudio; |
847 |
854 |
848 procedure preInitModule; |
855 procedure preInitModule; |
849 begin |
856 begin |
850 isMusicEnabled:= true; |
857 isMusicEnabled:= true; |
851 isSoundEnabled:= true; |
858 isSoundEnabled:= true; |
|
859 isAutoDampening:= true; |
852 cInitVolume:= 100; |
860 cInitVolume:= 100; |
853 end; |
861 end; |
854 |
862 |
855 procedure initModule; |
863 procedure initModule; |
856 var t: LongInt; |
864 var t: LongInt; |