| 352 | |
| 353 | |
| 354 | ALuint 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 | |
| 388 | const ALchar *NameFromUserFmtType(UserFmtType type) |
no outgoing calls
no test coverage detected