#include "pa_converters.h"
#include "pa_dither.h"
#include "pa_endianness.h"
#include "pa_types.h"
Defines | |
#define | PA_SELECT_FORMAT_(format, float32, int32, int24, int16, int8, uint8) |
#define | PA_SELECT_CONVERTER_DITHER_CLIP_(flags, source, destination) |
#define | PA_SELECT_CONVERTER_DITHER_(flags, source, destination) |
#define | PA_USE_CONVERTER_(source, destination) return paConverters. source ## _To_ ## destination; |
#define | PA_UNITY_CONVERSION_(wordlength) return paConverters. Copy_ ## wordlength ## _To_ ## wordlength; |
#define | PA_CLIP_(val, min, max) { val = ((val) < (min)) ? (min) : (((val) > (max)) ? (max) : (val)); } |
Functions | |
PaSampleFormat | PaUtil_SelectClosestAvailableFormat (PaSampleFormat availableFormats, PaSampleFormat format) |
PaUtilConverter * | PaUtil_SelectConverter (PaSampleFormat sourceFormat, PaSampleFormat destinationFormat, PaStreamFlags flags) |
PaUtilZeroer * | PaUtil_SelectZeroer (PaSampleFormat destinationFormat) |
Variables | |
PaUtilConverterTable | paConverters |
PaUtilZeroerTable | paZeroers |
If the C9x function lrintf() is available, define PA_USE_C99_LRINTF to use it
#define PA_CLIP_ | ( | val, | |||
min, | |||||
max | ) | { val = ((val) < (min)) ? (min) : (((val) > (max)) ? (max) : (val)); } |
#define PA_SELECT_CONVERTER_DITHER_ | ( | flags, | |||
source, | |||||
destination | ) |
Value:
if( flags & paDitherOff ){ /* no dither */ \ return paConverters. source ## _To_ ## destination; \ }else{ /* dither */ \ return paConverters. source ## _To_ ## destination ## _Dither; \ }
#define PA_SELECT_CONVERTER_DITHER_CLIP_ | ( | flags, | |||
source, | |||||
destination | ) |
Value:
if( flags & paClipOff ){ /* no clip */ \ if( flags & paDitherOff ){ /* no dither */ \ return paConverters. source ## _To_ ## destination; \ }else{ /* dither */ \ return paConverters. source ## _To_ ## destination ## _Dither; \ } \ }else{ /* clip */ \ if( flags & paDitherOff ){ /* no dither */ \ return paConverters. source ## _To_ ## destination ## _Clip; \ }else{ /* dither */ \ return paConverters. source ## _To_ ## destination ## _DitherClip; \ } \ }
#define PA_SELECT_FORMAT_ | ( | format, | |||
float32, | |||||
int32, | |||||
int24, | |||||
int16, | |||||
int8, | |||||
uint8 | ) |
#define PA_UNITY_CONVERSION_ | ( | wordlength | ) | return paConverters. Copy_ ## wordlength ## _To_ ## wordlength; |
#define PA_USE_CONVERTER_ | ( | source, | |||
destination | ) | return paConverters. source ## _To_ ## destination; |
PaSampleFormat PaUtil_SelectClosestAvailableFormat | ( | PaSampleFormat | availableFormats, | |
PaSampleFormat | format | |||
) |
Choose an available sample format which is most appropriate for representing the requested format. If the requested format is not available higher quality formats are considered before lower quality formates.
availableFormats | A variable containing the logical OR of all available formats. | |
format | The desired format. |
PaUtilConverter* PaUtil_SelectConverter | ( | PaSampleFormat | sourceFormat, | |
PaSampleFormat | destinationFormat, | |||
PaStreamFlags | flags | |||
) |
Find a sample converter function for the given source and destinations formats and flags (clip and dither.)
PaUtilZeroer* PaUtil_SelectZeroer | ( | PaSampleFormat | destinationFormat | ) |
Find a buffer zeroer function for the given destination format.
A table of pointers to all required converter functions. PaUtil_SelectConverter() uses this table to lookup the appropriate conversion functions. The fields of this structure are initialized with default conversion functions. Fields may be NULL, indicating that no conversion function is available. User code may substitue optimised conversion functions by assigning different function pointers to these fields.
Initial value:
{ ZeroU8, Zero8, Zero16, Zero24, Zero32, }