MCPcopy Create free account
hub / github.com/crownengine/crown / reset

Method reset

3rdparty/openal/alc/backends/wave.cpp:232–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232bool WaveBackend::reset()
233{
234 ALuint channels=0, bytes=0, chanmask=0;
235 int isbformat = 0;
236 size_t val;
237
238 fseek(mFile, 0, SEEK_SET);
239 clearerr(mFile);
240
241 if(GetConfigValueBool(nullptr, "wave", "bformat", 0))
242 {
243 mDevice->FmtChans = DevFmtAmbi3D;
244 mDevice->mAmbiOrder = 1;
245 }
246
247 switch(mDevice->FmtType)
248 {
249 case DevFmtByte:
250 mDevice->FmtType = DevFmtUByte;
251 break;
252 case DevFmtUShort:
253 mDevice->FmtType = DevFmtShort;
254 break;
255 case DevFmtUInt:
256 mDevice->FmtType = DevFmtInt;
257 break;
258 case DevFmtUByte:
259 case DevFmtShort:
260 case DevFmtInt:
261 case DevFmtFloat:
262 break;
263 }
264 switch(mDevice->FmtChans)
265 {
266 case DevFmtMono: chanmask = 0x04; break;
267 case DevFmtStereo: chanmask = 0x01 | 0x02; break;
268 case DevFmtQuad: chanmask = 0x01 | 0x02 | 0x10 | 0x20; break;
269 case DevFmtX51: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x200 | 0x400; break;
270 case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break;
271 case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break;
272 case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break;
273 case DevFmtAmbi3D:
274 /* .amb output requires FuMa */
275 mDevice->mAmbiOrder = minu(mDevice->mAmbiOrder, 3);
276 mDevice->mAmbiLayout = AmbiLayout::FuMa;
277 mDevice->mAmbiScale = AmbiNorm::FuMa;
278 isbformat = 1;
279 chanmask = 0;
280 break;
281 }
282 bytes = mDevice->bytesFromFmt();
283 channels = mDevice->channelsFromFmt();
284
285 rewind(mFile);
286
287 fputs("RIFF", mFile);
288 fwrite32le(0xFFFFFFFF, mFile); // 'RIFF' header len; filled in at close
289

Callers

nothing calls this directly

Calls 10

fseekFunction · 0.85
GetConfigValueBoolFunction · 0.85
minuFunction · 0.85
fwrite32leFunction · 0.85
fwrite16leFunction · 0.85
fwriteFunction · 0.85
ferrorFunction · 0.85
ftellFunction · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected