MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / SanitizeAlignment

Function SanitizeAlignment

Engine/lib/openal-soft/al/buffer.cpp:396–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394
395
396ALuint SanitizeAlignment(UserFmtType type, ALuint align)
397{
398 if(align == 0)
399 {
400 if(type == UserFmtIMA4)
401 {
402 /* Here is where things vary:
403 * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel
404 * Most PC sound software uses 2040+1 sample frames per block -> block_size=1024 bytes per channel
405 */
406 return 65;
407 }
408 if(type == UserFmtMSADPCM)
409 return 64;
410 return 1;
411 }
412
413 if(type == UserFmtIMA4)
414 {
415 /* IMA4 block alignment must be a multiple of 8, plus 1. */
416 if((align&7) == 1) return static_cast<ALuint>(align);
417 return 0;
418 }
419 if(type == UserFmtMSADPCM)
420 {
421 /* MSADPCM block alignment must be a multiple of 2. */
422 if((align&1) == 0) return static_cast<ALuint>(align);
423 return 0;
424 }
425
426 return static_cast<ALuint>(align);
427}
428
429
430const ALchar *NameFromUserFmtType(UserFmtType type)

Callers 2

LoadDataFunction · 0.85
buffer.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected