equal
deleted
inserted
replaced
102 if not isSoundEnabled then exit; |
102 if not isSoundEnabled then exit; |
103 WriteToConsole('Init OpenAL sound...'); |
103 WriteToConsole('Init OpenAL sound...'); |
104 isSoundEnabled:= openal_init(numSounds); |
104 isSoundEnabled:= openal_init(numSounds); |
105 if isSoundEnabled then WriteLnToConsole(msgOK) |
105 if isSoundEnabled then WriteLnToConsole(msgOK) |
106 else WriteLnToConsole(msgFailed); |
106 else WriteLnToConsole(msgFailed); |
107 ChangeVolume(cInitVolume) |
|
108 end; |
107 end; |
109 |
108 |
110 procedure ReleaseSound; |
109 procedure ReleaseSound; |
111 begin |
110 begin |
|
111 if isMusicEnabled then openal_fadeout(Mus, 30); |
112 openal_close(); |
112 openal_close(); |
113 end; |
113 end; |
114 |
114 |
115 procedure SoundLoad; |
115 procedure SoundLoad; |
|
116 const volume = 60; |
116 var i: TSound; |
117 var i: TSound; |
117 s: shortstring; |
118 s: shortstring; |
118 t: Longword; |
119 t: Longword; |
119 begin |
120 begin |
120 if not isSoundEnabled then exit; |
121 if not isSoundEnabled then exit; |
125 if Soundz[i].Path <> ptVoices then |
126 if Soundz[i].Path <> ptVoices then |
126 begin |
127 begin |
127 s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
128 s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
128 WriteToConsole(msgLoading + s + ' '); |
129 WriteToConsole(msgLoading + s + ' '); |
129 defVoicepack^.chunks[i]:= openal_loadfile (Str2PChar(s)); |
130 defVoicepack^.chunks[i]:= openal_loadfile (Str2PChar(s)); |
|
131 openal_setvolume(defVoicepack^.chunks[i],volume); |
130 TryDo(defVoicepack^.chunks[i] >= 0, msgFailed, true); |
132 TryDo(defVoicepack^.chunks[i] >= 0, msgFailed, true); |
131 WriteLnToConsole(msgOK); |
133 WriteLnToConsole(msgOK); |
132 end; |
134 end; |
133 |
135 |
134 for t:= 0 to cMaxTeams do |
136 for t:= 0 to cMaxTeams do |
137 if Soundz[i].Path = ptVoices then |
139 if Soundz[i].Path = ptVoices then |
138 begin |
140 begin |
139 s:= Pathz[Soundz[i].Path] + '/' + voicepacks[t].name + '/' + Soundz[i].FileName; |
141 s:= Pathz[Soundz[i].Path] + '/' + voicepacks[t].name + '/' + Soundz[i].FileName; |
140 WriteToConsole(msgLoading + s + ' '); |
142 WriteToConsole(msgLoading + s + ' '); |
141 voicepacks[t].chunks[i]:= openal_loadfile (Str2PChar(s)); |
143 voicepacks[t].chunks[i]:= openal_loadfile (Str2PChar(s)); |
|
144 openal_setvolume(voicepacks[t].chunks[i],volume); |
142 if voicepacks[t].chunks[i] < 0 then |
145 if voicepacks[t].chunks[i] < 0 then |
143 WriteLnToConsole(msgFailed) |
146 WriteLnToConsole(msgFailed) |
144 else |
147 else |
145 WriteLnToConsole(msgOK) |
148 WriteLnToConsole(msgOK) |
146 end; |
149 end; |
182 |
185 |
183 Mus:= openal_loadfile(Str2PChar(s)); |
186 Mus:= openal_loadfile(Str2PChar(s)); |
184 TryDo(Mus >= 0, msgFailed, false); |
187 TryDo(Mus >= 0, msgFailed, false); |
185 WriteLnToConsole(msgOK); |
188 WriteLnToConsole(msgOK); |
186 |
189 |
187 openal_fadein(Mus, 50); |
190 openal_setvolume(Mus, 60); |
|
191 openal_fadein(Mus, 70); |
188 openal_toggleloop(Mus); |
192 openal_toggleloop(Mus); |
189 end; |
193 end; |
190 |
194 |
191 function ChangeVolume(voldelta: LongInt): LongInt; |
195 function ChangeVolume(voldelta: LongInt): LongInt; |
192 begin |
196 begin |