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

Function SanitizeAlignment

3rdparty/openal/al/buffer.cpp:354–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352
353
354ALuint SanitizeAlignment(UserFmtType type, ALuint align)
355{
356 if(align == 0)
357 {
358 if(type == UserFmtIMA4)
359 {
360 /* Here is where things vary:
361 * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel
362 * Most PC sound software uses 2040+1 sample frames per block -> block_size=1024 bytes per channel
363 */
364 return 65;
365 }
366 if(type == UserFmtMSADPCM)
367 return 64;
368 return 1;
369 }
370
371 if(type == UserFmtIMA4)
372 {
373 /* IMA4 block alignment must be a multiple of 8, plus 1. */
374 if((align&7) == 1) return static_cast<ALuint>(align);
375 return 0;
376 }
377 if(type == UserFmtMSADPCM)
378 {
379 /* MSADPCM block alignment must be a multiple of 2. */
380 if((align&1) == 0) return static_cast<ALuint>(align);
381 return 0;
382 }
383
384 return static_cast<ALuint>(align);
385}
386
387
388const ALchar *NameFromUserFmtType(UserFmtType type)

Callers 2

LoadDataFunction · 0.85
buffer.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected