equal
deleted
inserted
replaced
30 procedure InitSound; |
30 procedure InitSound; |
31 procedure ReleaseSound; |
31 procedure ReleaseSound; |
32 procedure SoundLoad; |
32 procedure SoundLoad; |
33 procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack); |
33 procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack); |
34 procedure PlayMusic; |
34 procedure PlayMusic; |
|
35 procedure PauseMusic; |
|
36 procedure ResumeMusic; |
35 procedure StopSound(snd: TSound); |
37 procedure StopSound(snd: TSound); |
36 function ChangeVolume(voldelta: LongInt): LongInt; |
38 function ChangeVolume(voldelta: LongInt): LongInt; |
37 |
39 |
38 function AskForVoicepack(name: shortstring): Pointer; |
40 function AskForVoicepack(name: shortstring): Pointer; |
39 |
41 |
41 |
43 |
42 implementation |
44 implementation |
43 uses uMisc, uConsole; |
45 uses uMisc, uConsole; |
44 |
46 |
45 const chanTPU = 12; |
47 const chanTPU = 12; |
46 var Mus: PMixMusic = nil; |
48 var Volume: LongInt; |
47 Volume: LongInt; |
|
48 lastChan: array [TSound] of LongInt; |
49 lastChan: array [TSound] of LongInt; |
49 voicepacks: array[0..cMaxTeams] of TVoicepack; |
50 voicepacks: array[0..cMaxTeams] of TVoicepack; |
50 defVoicepack: PVoicepack; |
51 defVoicepack: PVoicepack; |
|
52 Mus: PMixMusic = nil; |
51 |
53 |
52 function AskForVoicepack(name: shortstring): Pointer; |
54 function AskForVoicepack(name: shortstring): Pointer; |
53 var i: Longword; |
55 var i: Longword; |
54 begin |
56 begin |
55 i:= 0; |
57 i:= 0; |
150 procedure PlayMusic; |
152 procedure PlayMusic; |
151 var s: string; |
153 var s: string; |
152 begin |
154 begin |
153 if (not isSoundEnabled) |
155 if (not isSoundEnabled) |
154 or (MusicFN = '') |
156 or (MusicFN = '') |
155 or (not isMusicEnabled)then exit; |
157 or (not isMusicEnabled) then exit; |
156 |
158 |
157 s:= PathPrefix + '/Music/' + MusicFN; |
159 s:= PathPrefix + '/Music/' + MusicFN; |
158 WriteToConsole(msgLoading + s + ' '); |
160 WriteToConsole(msgLoading + s + ' '); |
159 |
161 |
160 Mus:= Mix_LoadMUS(Str2PChar(s)); |
162 Mus:= Mix_LoadMUS(Str2PChar(s)); |
175 Volume:= Mix_Volume(-1, -1); |
177 Volume:= Mix_Volume(-1, -1); |
176 if isMusicEnabled then Mix_VolumeMusic(Volume * 4 div 8); |
178 if isMusicEnabled then Mix_VolumeMusic(Volume * 4 div 8); |
177 ChangeVolume:= Volume * 100 div MIX_MAX_VOLUME |
179 ChangeVolume:= Volume * 100 div MIX_MAX_VOLUME |
178 end; |
180 end; |
179 |
181 |
|
182 procedure PauseMusic; |
|
183 begin |
|
184 if (MusicFN = '') or (not isMusicEnabled) then exit; |
|
185 |
|
186 Mix_PauseMusic(Mus); |
|
187 end; |
|
188 |
|
189 procedure ResumeMusic; |
|
190 begin |
|
191 if (MusicFN = '') or (not isMusicEnabled) then exit; |
|
192 |
|
193 Mix_ResumeMusic(Mus); |
|
194 end; |
|
195 |
180 end. |
196 end. |