| 394 | |
| 395 | |
| 396 | ALuint 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 | |
| 430 | const ALchar *NameFromUserFmtType(UserFmtType type) |
no outgoing calls
no test coverage detected