Debian Codegraph @

Descent3/audiotaunts.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <string.h>
20 #include <stdlib.h>
21
22 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
23 #include "debug.h"cxx . . $ `<file>/ddebug/debug.h`/
24 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
25 #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/
26 #include "audiotaunts.h"cxx . . $ `<file>/Descent3/audiotaunts.h`/
27 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
28 #include "audio_encode.h"cxx . . $ `<file>/AudioEncode/audio_encode.h`/
29 #include "byteswap.h"cxx . . $ `<file>/lib/byteswap.h`/
30 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
31 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
32 #include "manage.h"cxx . . $ `<file>/lib/manage.h`/
33 #include "streamaudio.h"cxx . . $ `<file>/stream_audio/streamaudio.h`/
34 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
35 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
36 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
37 #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/
38 #include "player.h"cxx . . $ `<file>/Descent3/player.h`/
39
40 struct tWaveFilecxx . . $ tWaveFile# {
41 int sample_lengthcxx . . $ tWaveFile#sample_length.;
42 int np_sample_lengthcxx . . $ tWaveFile#np_sample_length.;
43 int samples_per_secondcxx . . $ tWaveFile#samples_per_second.;
44 int16_t bits_per_samplecxx . . $ tWaveFile#bits_per_sample.;
45 int16_t number_channelscxx . . $ tWaveFile#number_channels.;
46 uint8_tcxx . . $ uint8_t# *sample_8bitcxx . . $ tWaveFile#sample_8bit.;
47 int16_t *sample_16bitcxx . . $ tWaveFile#sample_16bit.;
48 };
49
50 // returns:
51 // 0: no error
52 // 1: file not found
53 // 2: not RIFF format
54 // 3: not WAVE file
55 // 4: invalid block length
56 // 5: invalid file/unknown
57 // 6: format not supported
58 // 7: invalid num of channels
59 // 8: invalid samples
60 // 9: invalid bit (8 or 16)
61 // 10: no data
62 static char taunt_LoadWaveFilecxx . . $ taunt_LoadWaveFile(cdd2859084ee1b32).(char *filename, tWaveFilecxx . . $ tWaveFile# *wave);
63
64 static int TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOERRORcxx . . $ `Descent3/audiotaunts.h:51:9`!;
65 bool Audio_taunts_enabledcxx . . $ Audio_taunts_enabled. = true;
66 static float Audio_taunt_delay_timecxx . . $ Audio_taunt_delay_time. = 5.0f;
67
68 // taunt_Enable
69 //
70 // Enables/Disables audio_taunts for the player
71 void taunt_Enablecxx . . $ taunt_Enable(b45ddcbc8423892c).(bool enable) { Audio_taunts_enabledcxx . . $ Audio_taunts_enabled. = enable; }
72
73 // taunt_AreEnabled
74 //
75 // Returns true if taunts are enabled
76 bool taunt_AreEnabledcxx . . $ taunt_AreEnabled(c9857a73d68e59ba).(void) { return Audio_taunts_enabledcxx . . $ Audio_taunts_enabled.; }
77
78 // taunt_DelayTime()
79 //
80 // Returns the delay time between taunts
81 float taunt_DelayTimecxx . . $ taunt_DelayTime(9b8c9e39889c762c).(void) {
82 if (Audio_taunt_delay_timecxx . . $ Audio_taunt_delay_time. < 0)
83 Audio_taunt_delay_timecxx . . $ Audio_taunt_delay_time. = 5.0f;
84
85 return Audio_taunt_delay_timecxx . . $ Audio_taunt_delay_time.;
86 }
87
88 // taunt_SetDelayTime()
89 //
90 // Sets the taunt delay time
91 void taunt_SetDelayTimecxx . . $ taunt_SetDelayTime(9364e6e7bff7660).(float t) { Audio_taunt_delay_timecxx . . $ Audio_taunt_delay_time. = t; }
92
93 // taunt_PlayTauntFile
94 //
95 // Given a path to an .osf file, it will play it
96 bool taunt_PlayTauntFilecxx . . $ taunt_PlayTauntFile(c5f7da30cbc0f4e9).(const char *filename) {
97 if (!Audio_taunts_enabledcxx . . $ Audio_taunts_enabled.)
98 return false;
99
100 int ret = StreamPlaycxx . . $ StreamPlay(d157d8952ffc14b5).(filename, (MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2.0f), 0);
101 return true;
102 }
103
104 // taunt_PlayPlayerTaunt
105 //
106 // Given a playernum, and which taunt (0 or 1) it will play that taunt
107 bool taunt_PlayPlayerTauntcxx . . $ taunt_PlayPlayerTaunt(cf9ef193275fa6d8).(int pnum, int index) {
108 if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!))
109 return false;
110
111 if (index < 0 || index > 3) {
112 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: invalid index %d\n", index);
113 return false;
114 }
115
116 if ((NetPlayerscxx . . $ NetPlayers.[pnum].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) && (NetPlayerscxx . . $ NetPlayers.[pnum].sequencecxx . . $ netplayer#sequence. == NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!)) {
117 char fullpath[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
118 char *file;
119 switch (index) {
120 case 0:
121 file = NetPlayerscxx . . $ NetPlayers.[pnum].voice_taunt1cxx . . $ netplayer#voice_taunt1.;
122 break;
123 case 1:
124 file = NetPlayerscxx . . $ NetPlayers.[pnum].voice_taunt2cxx . . $ netplayer#voice_taunt2.;
125 break;
126 case 2:
127 file = NetPlayerscxx . . $ NetPlayers.[pnum].voice_taunt3cxx . . $ netplayer#voice_taunt3.;
128 break;
129 case 3:
130 file = NetPlayerscxx . . $ NetPlayers.[pnum].voice_taunt4cxx . . $ netplayer#voice_taunt4.;
131 break;
132 }
133
134 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(fullpath, LocalCustomSoundsDircxx . . $ LocalCustomSoundsDir., file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
135
136 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(fullpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
137 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: file %s doesn't exist (pnum=%d)\n", fullpath, pnum);
138 return false;
139 }
140
141 DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[pnum].objnumcxx . . $ player#objnum.].handlecxx . . $ object#handle.;
142 DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
143 CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_CLIENT_PLAYERPLAYSAUDIOTAUNTcxx . . $ `lib/d3events.h:125:9`!, &DLLInfocxx . . $ DLLInfo.);
144
145 return taunt_PlayTauntFilecxx . . $ taunt_PlayTauntFile(c5f7da30cbc0f4e9).(fullpath);
146 }
147
148 return false;
149 }
150
151 // taunt_GetError
152 //
153 // Returns more information about a failed import
154 int taunt_GetErrorcxx . . $ taunt_GetError(b126dc7c1de90089).(void) { return TauntLastErrorcxx . . $ TauntLastError.; }
155
156 // taunt_GetErrorString
157 // Returns a string describing an error code
158 // !!! FIXME: This could just return a string literal and not strcpy it.
159 const char *taunt_GetErrorStringcxx . . $ taunt_GetErrorString(f7ae7e56280f18ae).(int error) {
160 static char str[256];
161
162 switch (error) {
163 case TAUNTIMPERR_NOTFOUNDcxx . . $ `Descent3/audiotaunts.h:52:9`!:
164 strcpy(str, TXT_FILENOTFOUNDcxx . . $ `Descent3/stringtable.h:487:9`!);
165 break;
166 case TAUNTIMPERR_NOTRIFFcxx . . $ `Descent3/audiotaunts.h:53:9`!:
167 strcpy(str, TXT_NOTRIFFcxx . . $ `Descent3/stringtable.h:488:9`!);
168 break;
169 case TAUNTIMPERR_NOTWAVEcxx . . $ `Descent3/audiotaunts.h:54:9`!:
170 strcpy(str, TXT_NOTWAVEcxx . . $ `Descent3/stringtable.h:489:9`!);
171 break;
172 case TAUNTIMPERR_INVALIDFILEcxx . . $ `Descent3/audiotaunts.h:55:9`!:
173 strcpy(str, TXT_INVALIDFILEcxx . . $ `Descent3/stringtable.h:490:9`!);
174 break;
175 case TAUNTIMPERR_NOTSUPPORTEDcxx . . $ `Descent3/audiotaunts.h:56:9`!:
176 strcpy(str, TXT_FORMATNOTSUPPORTEDcxx . . $ `Descent3/stringtable.h:491:9`!);
177 break;
178 case TAUNTIMPERR_INVALIDCHANNELScxx . . $ `Descent3/audiotaunts.h:57:9`!:
179 strcpy(str, TXT_MUSTBEMONOcxx . . $ `Descent3/stringtable.h:492:9`!);
180 break;
181 case TAUNTIMPERR_INVALIDSAMPLEScxx . . $ `Descent3/audiotaunts.h:58:9`!:
182 strcpy(str, TXT_BADSAMPLERATEcxx . . $ `Descent3/stringtable.h:493:9`!);
183 break;
184 case TAUNTIMPERR_INVALIDBITDEPTHcxx . . $ `Descent3/audiotaunts.h:59:9`!:
185 strcpy(str, TXT_BADBITDEPTHcxx . . $ `Descent3/stringtable.h:494:9`!);
186 break;
187 case TAUNTIMPERR_NODATAcxx . . $ `Descent3/audiotaunts.h:60:9`!:
188 strcpy(str, TXT_NODATAINWAVEcxx . . $ `Descent3/stringtable.h:495:9`!);
189 break;
190 case TAUNTIMPERR_OSFEXISTScxx . . $ `Descent3/audiotaunts.h:61:9`!:
191 strcpy(str, TXT_OSFALREADYEXISTScxx . . $ `Descent3/stringtable.h:496:9`!);
192 break;
193 case TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!:
194 strcpy(str, TXT_INTERNALERRORcxx . . $ `Descent3/stringtable.h:497:9`!);
195 break;
196 case TAUNTIMPERR_COMPRESSIONFAILUREcxx . . $ `Descent3/audiotaunts.h:63:9`!:
197 strcpy(str, TXT_COMPRESSFAILcxx . . $ `Descent3/stringtable.h:498:9`!);
198 break;
199 case TAUNTIMPERR_OUTOFMEMcxx . . $ `Descent3/audiotaunts.h:64:9`!:
200 strcpy(str, TXT_OUTOFMEMORYcxx . . $ `Descent3/stringtable.h:499:9`!);
201 break;
202 case TAUNTIMPERR_NOOPENOSFcxx . . $ `Descent3/audiotaunts.h:65:9`!:
203 strcpy(str, TXT_CANTOPENOSFcxx . . $ `Descent3/stringtable.h:500:9`!);
204 break;
205 default:
206 strcpy(str, TXT_NOERRORcxx . . $ `Descent3/stringtable.h:501:9`!);
207 break;
208 }
209 return str;
210 }
211
212 // taunt_ImportWave
213 // Given a fully qualified wave_filename (location of a .wav) and a fully
214 // qualified outputfilename (where the .osf is to go), it will convert and
215 // compress the wav file.
216 #define FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`! (4 * 1024)
217 bool taunt_ImportWavecxx . . $ taunt_ImportWave(14223ed414283e68).(char *wave_filename, char *outputfilename) {
218 ASSERTcxx . . $ `misc/pserror.h:246:9`!(wave_filename);
219 ASSERTcxx . . $ `misc/pserror.h:246:9`!(outputfilename);
220 bool ret = true;
221 CFILEcxx . . $ CFILE# *file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
222 int amount_to_flush;
223 tWaveFilecxx . . $ tWaveFile# wavdata;
224 int samples, rate, chan;
225 char temp_filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
226 char osftemp_filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
227 uint8_tcxx . . $ uint8_t# *StaticFileBuffer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
228 *temp_filename = *osftemp_filename = '\0';
229 OSFArchivecxx . . $ OSFArchive# osfcxx . . $ OSFArchive#OSFArchive(49f6e7a06ebc5aa8).;
230 CFILEcxx . . $ CFILE# *fpin = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
231 bool osfopened;
232 osfopened = false;
233
234 if (!wave_filename || !outputfilename) {
235 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTFOUNDcxx . . $ `Descent3/audiotaunts.h:52:9`!;
236 return false;
237 }
238
239 // first make sure the wave file exists
240 if (!cfexistcxx . . $ cfexist(293b0826c8d9cb54).(wave_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
241 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AudioTaunt: Can't Import wav, missing %s\n", wave_filename);
242 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTFOUNDcxx . . $ `Descent3/audiotaunts.h:52:9`!;
243 return false;
244 }
245
246 // make sure the output file doesn't exist so we don't overwrite
247 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(outputfilenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
248 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AudioTaunt: Can't Import wav, %s already exists\n", outputfilename);
249 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_OSFEXISTScxx . . $ `Descent3/audiotaunts.h:61:9`!;
250 return false;
251 }
252
253 // Open the file and import
254 char wave_ret = taunt_LoadWaveFilecxx . . $ taunt_LoadWaveFile(cdd2859084ee1b32).(wave_filename, &wavdata);
255 if (wave_ret != 0) {
256 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Unable to load wave\n");
257 switch (wave_ret) {
258 case 1:
259 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTFOUNDcxx . . $ `Descent3/audiotaunts.h:52:9`!;
260 break;
261 case 2:
262 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTRIFFcxx . . $ `Descent3/audiotaunts.h:53:9`!;
263 break;
264 case 3:
265 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTWAVEcxx . . $ `Descent3/audiotaunts.h:54:9`!;
266 break;
267 case 4:
268 case 5:
269 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INVALIDFILEcxx . . $ `Descent3/audiotaunts.h:55:9`!;
270 break;
271 case 6:
272 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOTSUPPORTEDcxx . . $ `Descent3/audiotaunts.h:56:9`!;
273 break;
274 case 7:
275 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INVALIDCHANNELScxx . . $ `Descent3/audiotaunts.h:57:9`!;
276 break;
277 case 8:
278 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INVALIDSAMPLEScxx . . $ `Descent3/audiotaunts.h:58:9`!;
279 break;
280 case 9:
281 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INVALIDBITDEPTHcxx . . $ `Descent3/audiotaunts.h:59:9`!;
282 break;
283 case 10:
284 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NODATAcxx . . $ `Descent3/audiotaunts.h:60:9`!;
285 break;
286 }
287 ret = false;
288 goto error;
289 }
290
291 // at this point we have a loaded wave file in memory and information about it
292 // now we need to compress it, first it must be written as raw data to a temp
293 // file.
294
295 if (!ddio_GetTempFileNamecxx . . $ ddio_GetTempFileName(dfb34736e99ce5d).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., "d3o", temp_filename)) {
296 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Unable to create temp filename\n");
297 ret = false;
298 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
299 goto error;
300 }
301
302 file = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(temp_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb");
303 if (!file) {
304 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Unable to open temp filename\n");
305 ret = false;
306 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
307 goto error;
308 }
309
310 /*
311 amount_to_flush = (wavdata.bits_per_sample==8)?wavdata.sample_length:wavdata.sample_length*2;
312
313 if(wavdata.bits_per_sample==8 && wavdata.sample_8bit ){
314 cf_WriteBytes(wavdata.sample_8bit,amount_to_flush,file);
315 }else if(wavdata.bits_per_sample==16 && wavdata.sample_16bit ){
316 //flip bytes(?)..NOTE SPEEDUP WARNING..THIS IS DONE IN WAVE LOAD..REMOVE IT?
317 for(int count = 0; count < (int)wavdata.sample_length; count++)
318 {
319 wavdata.sample_16bit[count] = INTEL_SHORT(wavdata.sample_16bit[count]);
320 }
321
322 cf_WriteBytes((uint8_t *)wavdata.sample_16bit,amount_to_flush,file);
323 }else{
324 mprintf(0,"TAUNT: Confusion to bits per sample (%d)\n",wavdata.bits_per_sample);
325 ret = false;
326 goto error;
327 }
328 mprintf(0,"TAUNT: Wrote to temp file %s\n",temp_filename);
329 cfclose(file); file = NULL;
330 */
331
332 amount_to_flush = (wavdata.sample_8bitcxx . . $ tWaveFile#sample_8bit.) ? wavdata.sample_lengthcxx . . $ tWaveFile#sample_length. : wavdata.sample_lengthcxx . . $ tWaveFile#sample_length. * 2;
333
334 ASSERTcxx . . $ `misc/pserror.h:246:9`!(wavdata.sample_16bit != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // only 16 bit should be coming out
335
336 // flip bytes(?)..NOTE SPEEDUP WARNING..THIS IS DONE IN WAVE LOAD..REMOVE IT?
337 int count;
338 for (count = 0; count < (int)wavdata.sample_lengthcxx . . $ tWaveFile#sample_length.; count++) {
339 wavdata.sample_16bitcxx . . $ tWaveFile#sample_16bit.[count] = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(wavdata.sample_16bit[count]);
340 }
341
342 cf_WriteBytescxx . . $ cf_WriteBytes(b35058f74b39c3a6).((uint8_tcxx . . $ uint8_t# *)wavdata.sample_16bitcxx . . $ tWaveFile#sample_16bit., amount_to_flush, file);
343 cfclosecxx . . $ cfclose(3639e799710acb68).(file);
344 file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
345
346 samples = wavdata.bits_per_samplecxx . . $ tWaveFile#bits_per_sample.;
347 rate = wavdata.samples_per_secondcxx . . $ tWaveFile#samples_per_second.;
348 chan = wavdata.number_channelscxx . . $ tWaveFile#number_channels.;
349
350 if (!ddio_GetTempFileNamecxx . . $ ddio_GetTempFileName(dfb34736e99ce5d).(Descent3_temp_directorycxx . . $ Descent3_temp_directory., "d3o", osftemp_filename)) {
351 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Unable to create osftemp filename\n");
352 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
353 ret = false;
354 goto error;
355 }
356
357 if (!aenc_Compresscxx . . $ aenc_Compress(d2f5298c1aeaacbf).(temp_filename, osftemp_filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &samples, &rate, &chan, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
358 // unable to compress
359 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to compress\n");
360 ret = false;
361 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_COMPRESSIONFAILUREcxx . . $ `Descent3/audiotaunts.h:63:9`!;
362 goto error;
363 }
364
365 // at this point osftemp_filename is a compressed file, now to convert it
366 // to osf format
367 // start writing out data.
368 tOSFDigiHdrcxx . . $ tOSFDigiHdr# digihdr;
369 uint32_tcxx . . $ uint32_t# filelen, nblocks, i;
370 int format;
371
372 StaticFileBuffer = (uint8_tcxx . . $ uint8_t# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!);
373 if (!StaticFileBuffer) {
374 ret = false;
375 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Out of memory\n");
376 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_OUTOFMEMcxx . . $ `Descent3/audiotaunts.h:64:9`!;
377 goto error;
378 }
379
380 fpin = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(osftemp_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb");
381 if (!fpin) {
382 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to open temp file to make osf\n");
383 ret = false;
384 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
385 goto error;
386 }
387
388 filelen = (uint32_tcxx . . $ uint32_t#)cfilelengthcxx . . $ cfilelength(e4541f75b25d0ae5).(fpin);
389 nblocks = filelen / FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!;
390
391 if (!osf.Opencxx . . $ OSFArchive#Open(e96b1cf346ae2c6).(outputfilename, true)) {
392 ret = false;
393 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unable to open osf to write\n");
394 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_NOOPENOSFcxx . . $ `Descent3/audiotaunts.h:65:9`!;
395 goto error;
396 }
397 osfopened = true;
398
399 // write out data.
400 for (i = 0; i < nblocks; i++) {
401 if (!cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).(StaticFileBuffer, FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!, fpin)) {
402 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Error reading from osf temp\n");
403 ret = false;
404 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
405 goto error;
406 }
407 if (!osf.WriteBlockcxx . . $ OSFArchive#WriteBlock(6a46171b248bf29b).(StaticFileBuffer, FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!)) {
408 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Error writing to osf\n");
409 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
410 ret = false;
411 goto error;
412 }
413 }
414
415 if (filelen % FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!) {
416 if (!cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).(StaticFileBuffer, filelen % FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!, fpin)) {
417 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Error reading from osf temp\n");
418 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
419 ret = false;
420 goto error;
421 }
422 if (!osf.WriteBlockcxx . . $ OSFArchive#WriteBlock(6a46171b248bf29b).(StaticFileBuffer, filelen % FILEBUFFER_LENGTHcxx . . $ `Descent3/audiotaunts.cpp:216:9`!)) {
423 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Error writing to osf\n");
424 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
425 ret = false;
426 goto error;
427 }
428 }
429
430 digihdr.measurecxx . . $ tOSFDigiHdr#measure. = 44100;
431
432 format = 0;
433 if (wavdata.number_channelscxx . . $ tWaveFile#number_channels. == 1) {
434 format |= SAF_MONO_MASKcxx . . $ `stream_audio/streamaudio.h:166:9`!;
435 } else {
436 format |= SAF_STEREO_MASKcxx . . $ `stream_audio/streamaudio.h:167:9`!;
437 }
438
439 if (wavdata.sample_16bitcxx . . $ tWaveFile#sample_16bit.) {
440 format |= SAF_16BIT_MASKcxx . . $ `stream_audio/streamaudio.h:165:9`!;
441 } else {
442 format |= SAF_8BIT_MASKcxx . . $ `stream_audio/streamaudio.h:164:9`!;
443 }
444
445 // save header info
446 char osftitle[256];
447 ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(outputfilename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, osftitle, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
448
449 if (!osf.SaveHeadercxx . . $ OSFArchive#SaveHeader(f1c414a58a83a2e8).(OSF_DIGITAL_STRMcxx . . $ `stream_audio/streamaudio.h:159:9`!, OSF_DIGIACM_STRMcxx . . $ `stream_audio/streamaudio.h:162:9`!, format, samples, filelen, &digihdr, osftitle)) {
450 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Failed to write out OSF header info.");
451 TauntLastErrorcxx . . $ TauntLastError. = TAUNTIMPERR_INTERNALERRcxx . . $ `Descent3/audiotaunts.h:62:9`!;
452 ret = false;
453 goto error;
454 }
455
456 osf.Closecxx . . $ OSFArchive#Close(49f6e7a06ebc5aa8).();
457
458 error:
459 if (file) {
460 cfclosecxx . . $ cfclose(3639e799710acb68).(file);
461 }
462
463 if (osfopened)
464 osf.Closecxx . . $ OSFArchive#Close(49f6e7a06ebc5aa8).();
465
466 if (fpin) {
467 cfclosecxx . . $ cfclose(3639e799710acb68).(fpin);
468 }
469
470 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(osftemp_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
471 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(osftemp_filename);
472 }
473
474 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(temp_filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
475 ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(temp_filename);
476 }
477
478 if (StaticFileBuffer) {
479 mem_freecxx . . $ `mem/mem.h:80:9`!(StaticFileBuffer);
480 }
481
482 // free memory for wave file
483 if (wavdata.sample_16bitcxx . . $ tWaveFile#sample_16bit.)
484 mem_freecxx . . $ `mem/mem.h:80:9`!(wavdata.sample_16bit);
485 if (wavdata.sample_8bitcxx . . $ tWaveFile#sample_8bit.)
486 mem_freecxx . . $ `mem/mem.h:80:9`!(wavdata.sample_8bit);
487
488 return ret;
489 }
490
491 #define SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`! 4
492 char taunt_LoadWaveFilecxx . . $ taunt_LoadWaveFile(cdd2859084ee1b32).(char *filename, tWaveFilecxx . . $ tWaveFile# *wave) {
493 // File pointer to sound file
494 CFILEcxx . . $ CFILE# *cfptr;
495
496 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
497 wave->sample_8bitcxx . . $ tWaveFile#sample_8bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
498 wave->np_sample_lengthcxx . . $ tWaveFile#np_sample_length. = 0;
499 wave->sample_lengthcxx . . $ tWaveFile#sample_length. = 0;
500
501 cfptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
502 char format_type[80]; // ASCII name of format type
503 uint16_tcxx . . $ uint16_t# fmttag = 0; // Numerical format type
504 uint32_tcxx . . $ uint32_t# ckid; // Current chunk's ID
505 uint32_tcxx . . $ uint32_t# cksize; // Current chunk's size in bytes
506 uint32_tcxx . . $ uint32_t# filesize; // Size of the sound file
507 uint32_tcxx . . $ uint32_t# nextseek = 0; // Location of the next seek
508 uint32_tcxx . . $ uint32_t# aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples
509
510 // Sound format information
511 int samples_per_second;
512 int16_t bits_per_sample;
513 int16_t number_channels;
514 char error_code = 0;
515
516 // Used to read temporary long values
517 uint32_tcxx . . $ uint32_t# temp_long;
518
519 // Flags for if we previously read data or a format
520 char f_data, f_fmt = 0;
521
522 // Loop counter
523 int count;
524
525 // Open the wave file
526 if ((cfptr = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb")) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
527 error_code = 1;
528 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Wav %s not found\n", filename);
529 goto error_state;
530 }
531
532 // Make sure that it is a RIFF format
533 temp_long = (uint32_tcxx . . $ uint32_t#)cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
534 if (temp_long != 0x46464952) {
535 error_code = 2;
536 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Wav Load: %s is not a RIFF format file\n", filename);
537 goto error_state;
538 }
539
540 // The first item is the filesize minus the RIFF type specifier and filesize (add current location for total filesize)
541 filesize = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
542 filesize += cftellcxx . . $ cftell(65b457210a6528a1).(cfptr);
543
544 // Make sure it is a wave file
545 temp_long = (uint32_tcxx . . $ uint32_t#)cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
546 if (temp_long != 0x45564157) {
547 error_code = 3;
548 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Wav Load: %s is not a WAVE file\n", filename);
549 goto error_state;
550 }
551 nextseek = cftellcxx . . $ cftell(65b457210a6528a1).(cfptr);
552
553 // Read in the chunks
554 while (nextseek < filesize - 9) // Need room for chunk and its header
555 {
556 // Move the the beginning of the next chunck
557 cfseekcxx . . $ cfseek(f9992d249f032805).(cfptr, nextseek, SEEK_SETcxx . . $ `<external>/14710646456994434043/fcntl.h:137:10`!);
558
559 // Read in the chunk size and type
560 ckid = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
561 cksize = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
562 if (cksize <= 0) {
563 error_code = 4;
564 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Wav Load: %s has an invalid block length\n", filename);
565 goto error_state;
566 }
567
568 // Determine where the next chunk begins
569 nextseek = cksize + cftellcxx . . $ cftell(65b457210a6528a1).(cfptr);
570
571 // Determine what to do with the chunk
572 switch (ckid) {
573 case 0x20746D66: // Format Chunk
574 // Make sure that this format was not preceeded by another format without data inbetween them.
575 if (f_fmt) {
576 error_code = 5;
577 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT: Wav Load: Found 2 formats in a row in file %s\n", filename);
578 goto error_state;
579 }
580
581 // Read in the format type
582 fmttag = (uint16_tcxx . . $ uint16_t#)cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(cfptr);
583
584 switch (fmttag) {
585 // We only support WAVE_FORMAT_PCM currently
586 default:
587 case 0x0000:
588 strcpy(format_type, "WAVE_FORMAT_UNKNOWN");
589 break;
590 case 0x0001:
591 strcpy(format_type, "WAVE_FORMAT_PCM");
592 break;
593 case 0x0002:
594 strcpy(format_type, "WAVE_FORMAT_ADPCM");
595 break;
596 case 0x0005:
597 strcpy(format_type, "WAVE_FORMAT_IBM_CVSD");
598 break;
599 case 0x0006:
600 strcpy(format_type, "WAVE_FORMAT_ALAW");
601 break;
602 case 0x0007:
603 strcpy(format_type, "WAVE_FORMAT_MULAW");
604 break;
605 case 0x0010:
606 strcpy(format_type, "WAVE_FORMAT_OKI_ADPCM");
607 break;
608 case 0x0011:
609 strcpy(format_type, "WAVE_FORMAT_DVI_ADPCM");
610 break;
611 case 0x0015:
612 strcpy(format_type, "WAVE_FORMAT_DIGISTD");
613 break;
614 case 0x0016:
615 strcpy(format_type, "WAVE_FORMAT_DIGIFIX");
616 break;
617 case 0x0020:
618 strcpy(format_type, "WAVE_FORMAT_YAMAHA_ADPCM");
619 break;
620 case 0x0021:
621 strcpy(format_type, "WAVE_FORMAT_SONARC");
622 break;
623 case 0x0022:
624 strcpy(format_type, "WAVE_FORMAT_DSPGROUP_TRUESPEECH");
625 break;
626 case 0x0023:
627 strcpy(format_type, "WAVE_FORMAT_ECHOSC1");
628 break;
629 case 0x0024:
630 strcpy(format_type, "WAVE_FORMAT_AUDIOFILE_AF18");
631 break;
632 case 0x0101:
633 strcpy(format_type, "IBM_FORMAT_MULAW");
634 break;
635 case 0x0102:
636 strcpy(format_type, "IBM_FORMAT_ALAW");
637 break;
638 case 0x0103:
639 strcpy(format_type, "IBM_FORMAT_ADPCM");
640 break;
641 case 0x0200:
642 strcpy(format_type, "WAVE_FORMAT_CREATIVE_ADPCM");
643 break;
644 }
645
646 // Currently, we only support PCM wave files
647 if (fmttag != 0x0001) {
648 error_code = 6;
649 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT Wav Load: %s is a type %s wavefile, we only support WAVE_FORMAT_PCM waves.\n",
650 filename,format_type);
651 goto error_state;
652 }
653
654 // Get the number of channels
655 number_channels = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(cfptr);
656 if (number_channels != 1) {
657 error_code = 7;
658 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT Wav Load: Invalid number of channels(%d)in %s, we want mono samples only.\n",
659 number_channels, filename);
660 goto error_state;
661 }
662
663 // Get the number of samples per second
664 samples_per_second = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
665 if (samples_per_second != 22050) {
666 error_code = 8;
667 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT Wav Load: Invalid sample per second(%d)in %s, we want 22k samples only.\n",
668 samples_per_second, filename);
669 goto error_state;
670 }
671
672 // get the Average bytes per second (ignore it)
673 cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfptr);
674
675 // Get the Block Alignment (ignore it)
676 cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(cfptr);
677
678 // Get the Bits per sample
679 bits_per_sample = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(cfptr);
680 if (bits_per_sample != 8 && bits_per_sample != 16) {
681 error_code = 9;
682 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT Wav Load: Invalid bits per sample(%d)in %s, we want 8 or 16 bit samples only.\n",
683 bits_per_sample, filename);
684 goto error_state;
685 }
686
687 // We did find a new format type
688 f_fmt = 1;
689 f_data = 0;
690 break;
691
692 // Data Chunk
693 case 0x61746164:
694 if (!f_fmt) {
695 error_code = 5;
696 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "TAUNT Wav Load: Format Chunk not defined before Data Chunk\n");
697 goto error_state;
698 }
699
700 // It is either 8 or 16 bit as validated from above
701 if (bits_per_sample == 8) {
702 int num_needed = 0;
703
704 // Force sample alignment
705 if ((cksize - 1) % SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`!) {
706 num_needed = SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`! - ((cksize - 1) % SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`!);
707 aligned_size = cksize + num_needed;
708 } else {
709 aligned_size = cksize;
710 }
711
712 wave->sample_lengthcxx . . $ tWaveFile#sample_length. = aligned_size;
713 wave->np_sample_lengthcxx . . $ tWaveFile#np_sample_length. = cksize;
714 wave->sample_8bitcxx . . $ tWaveFile#sample_8bit. = (uint8_tcxx . . $ uint8_t# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(aligned_size);
715
716 cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)wave->sample_8bitcxx . . $ tWaveFile#sample_8bit., cksize, cfptr);
717
718 if (aligned_size != cksize)
719 memset(wave->sample_8bitcxx . . $ tWaveFile#sample_8bit. + cksize, 128, num_needed);
720 } else {
721 int num_needed = 0;
722
723 wave->sample_lengthcxx . . $ tWaveFile#sample_length. = cksize / 2;
724 wave->np_sample_lengthcxx . . $ tWaveFile#np_sample_length. = cksize / 2;
725
726 if ((wave->sample_lengthcxx . . $ tWaveFile#sample_length. - 1) % SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`!) {
727 num_needed = (SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`! - ((wave->sample_lengthcxx . . $ tWaveFile#sample_length. - 1) % SOUND_FILE_SAMPLE_ALIGNMENTcxx . . $ `Descent3/audiotaunts.cpp:491:9`!)) * 2;
728 wave->sample_lengthcxx . . $ tWaveFile#sample_length. = cksize / 2 + num_needed / 2;
729 }
730
731 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. = (int16_t *)mem_malloccxx . . $ `mem/mem.h:79:9`!(cksize + num_needed);
732
733 cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)wave->sample_16bitcxx . . $ tWaveFile#sample_16bit., cksize, cfptr);
734 for (count = 0; count < (int)cksize / 2; count++) {
735 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit.[count] = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(wave->sample_16bit[count]);
736 }
737
738 if (num_needed)
739 memset(wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. + (cksize / 2), 0, num_needed);
740 }
741
742 // We found data, clear format flag
743 f_data = 1;
744 f_fmt = 0; // Multiple waveforms, per file, are allowed
745 break;
746
747 // Undefined chunk
748 default:
749 break;
750 }
751 }
752
753 // Close the file
754 cfclosecxx . . $ cfclose(3639e799710acb68).(cfptr);
755 cfptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
756
757 if (wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
758 ASSERTcxx . . $ `misc/pserror.h:246:9`!(wave->sample_8bit);
759
760 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. = (int16_t *)mem_malloccxx . . $ `mem/mem.h:79:9`!(wave->sample_length * sizeof(int16_t));
761
762 // NOTE: Interesting note on sound conversion: 16 bit sounds are signed (0 biase). 8 bit sounds are unsigned
763 // (+128 biase).
764 for (count = 0; count < (int)wave->sample_lengthcxx . . $ tWaveFile#sample_length.; count++) {
765 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit.[count] = (((int16_t)wave->sample_8bitcxx . . $ tWaveFile#sample_8bit.[count]) - 128) * 256;
766 }
767
768 mem_freecxx . . $ `mem/mem.h:80:9`!(wave->sample_8bit);
769 wave->sample_8bitcxx . . $ tWaveFile#sample_8bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
770 }
771
772 error_state:
773
774 if (error_code != 0) {
775 // free memory and set to NULL
776 if (wave->sample_16bitcxx . . $ tWaveFile#sample_16bit.)
777 mem_freecxx . . $ `mem/mem.h:80:9`!(wave->sample_16bit);
778 if (wave->sample_8bitcxx . . $ tWaveFile#sample_8bit.)
779 mem_freecxx . . $ `mem/mem.h:80:9`!(wave->sample_8bit);
780 wave->sample_16bitcxx . . $ tWaveFile#sample_16bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
781 wave->sample_8bitcxx . . $ tWaveFile#sample_8bit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
782 } else {
783 wave->samples_per_secondcxx . . $ tWaveFile#samples_per_second. = samples_per_second;
784 wave->bits_per_samplecxx . . $ tWaveFile#bits_per_sample. = bits_per_sample;
785 wave->number_channelscxx . . $ tWaveFile#number_channels. = number_channels;
786 }
787
788 if (cfptr)
789 cfclosecxx . . $ cfclose(3639e799710acb68).(cfptr);
790
791 return error_code;
792 }