Functions
This section lists all the API functions of the SSRC module and explains their parameters.
SSRC_GetNrSamples
Prototype:
SSRC_ReturnStatus_en SSRC_GetNrSamples
(SSRC_NR_SAMPLES_MODE_en Mode,
SSRC_Params_t* pSSRC_Params );
Description:
This function retrieves the number of samples or sample pairs for stereo used as an input and as an output of the SSRC module.
Name |
Type |
Description |
---|---|---|
Mode |
SSRC_NR_SAMPLES_MODE_en |
There are two modes: |
pSSRC_Params |
SSRC_Params_t* |
Pointer to the instance parameters. The application fills in the values of the input sample rate, the output sample rate, and the number of channels. Based on this input, the |
Returns:
|
When the function call succeeds. |
|
When the requested input or output sampling rates are invalid. |
|
When the channel format is not equal to |
|
When |
|
When mode is not a valid setting. |
Note: The SSRC_GetNrSamples function returns the values from the following tables. Instead of calling the SSRC_GetNrSamples function, use the values from these tables directly.
Sample rate |
Nr of samples |
---|---|
8000 |
320 |
11025 |
441 |
12000 |
480 |
16000 |
640 |
22050 |
882 |
24000 |
960 |
32000 |
1280 |
44100 |
1764 |
48000 |
1920 |
In/Out |
8000 |
11025 |
12000 |
16000 |
22050 |
24000 |
32000 |
44100 |
48000 |
---|---|---|---|---|---|---|---|---|---|
8000 |
1 |
320 |
2 |
1 |
160 |
1 |
1 |
80 |
1 |
11025 |
441 |
1 |
147 |
441 |
1 |
147 |
441 |
1 |
147 |
12000 |
3 |
160 |
1 |
3 |
80 |
1 |
3 |
40 |
1 |
16000 |
2 |
640 |
4 |
1 |
320 |
2 |
1 |
160 |
1 |
22050 |
441 |
2 |
147 |
441 |
1 |
147 |
441 |
1 |
147 |
24000 |
3 |
320 |
2 |
3 |
160 |
1 |
3 |
80 |
1 |
32000 |
4 |
1280 |
8 |
2 |
640 |
4 |
1 |
320 |
2 |
44100 |
441 |
4 |
147 |
441 |
2 |
147 |
441 |
1 |
147 |
48000 |
6 |
640 |
4 |
3 |
320 |
2 |
3 |
160 |
1 |
Parent topic:Functions
SSRC_GetScratchSize
Prototype:
SSRC_ReturnStatus_en SSRC_GetScratchSize
(SSRC_Params_t* pSSRC_Params,
LVM_INT32* pScratchSize );
Description:
This function retrieves the scratch size for a given conversion ratio and for given buffer sizes at the input and at the output.
Name |
Type |
Description |
---|---|---|
|
|
Pointer to the instance parameters. All members should have a valid value. |
|
|
Pointer to the scratch size. The |
|
Returns:
|
When the function call succeeds. |
|
When the requested input or output sampling rates are invalid. |
|
When the channel format is not equal to |
|
When |
|
When the number of samples on the input or on the output are incorrect. |
Parent topic:Functions
SSRC_Init
Prototype:
SSRC_ReturnStatus_en SSRC_Init
(SSRC_Instance_t* pSSRC_Instance,
SSRC_Scratch_t* pSSRC_Scratch,
SSRC_Params_t* pSSRC_Params,
LVM_INT16** ppInputInScratch,
LVM_INT16** ppOutputInScratch);
Description:
The SSRC_Init
function initializes an instance of the SSRC module.
Name |
Type |
Description |
---|---|---|
|
|
Pointer to the instance of the SSRC. This application must allocate the memory before calling the |
|
|
Pointer to the scratch memory. The pointer is saved inside the instance and is used by the |
|
|
Pointer to the instance parameters. |
|
|
The SSRC module can be called with the input samples located in scratch. This pointer points to a location that holds the pointer to the location in the scratch memory that can be used to store the input samples. For example, to save memory. |
|
|
The SSRC module can store the output samples in the scratch memory. This pointer points to a location that holds the pointer to the location in the scratch memory that can be used to store the output samples. For example, to save memory. |
Returns:
|
When the function call succeeds. |
|
When the requested input or output sampling rates are invalid. |
|
When the channel format is not equal to |
|
When |
|
When the number of samples on the input or on the output are incorrect. |
|
When the instance memory or the scratch memory is not 4 bytes aligned. |
Parent topic:Functions
SSRC_SetGains
Prototype:
SSRC_ReturnStatus_en SSRC_SetGains
(SSRC_Instance_t* pSSRC_Instance,
LVM_Mode_en bHeadroomGainEnabled,
LVM_Mode_en bOutputGainEnabled,
LVM_INT16 OutputGain);
Description:
This function sets headroom gain and the post gain of the SSRC. The SSRC_SetGains
function is an optional function that should be used only in rare cases. Preferably, use the default settings.
Name |
Type |
Description |
||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Pointer to the instance of the SSRC. |
||||||||
|
|
Parameter to enable or disable the headroom gain of the SSRC. The default value is |
||||||||
|
|
Parameter to enable or disable the output gain. The default value is |
||||||||
|
|
The value of the output gain. The output gain is a linear gain value. 0x7FFF is equal to +6 dB and 0x0000 corresponds to -inf dB. By default, a 3 dB gain is applied (OutputGain = 23197), resulting in an overall gain of -3 dB (-6 dB headroom +3 dB output gain).
|
Returns:
|
When the function call succeeds |
|
When |
|
Wrong value used for the |
|
When |
Parent topic:Functions
SSRC_Process
Prototype:
SSRC_ReturnStatus_en SSRC_Process
(SSRC_Instance_t* pSSRC_Instance,
LVM_INT16* pSSRC_AudioIn,
LVM_INT16* pSSRC_AudioOut);
Description:
Process function for the SSRC module. The function takes pointers as input and output audio buffers.
The sample format used for the input and output buffers is 16-bit little-endian. Stereo buffers are interleaved (L1, R1, L2, R2, and so on), mono buffers are deinterleaved (L1, L2, and so on).
Name |
Type |
Description |
---|---|---|
|
|
Pointer to the instance of the SSRC. |
|
|
Pointer to the input samples. |
|
|
Pointer to the output samples. |
Returns:
|
When the function call succeeds. |
|
When one of |
Parent topic:Functions
SSRC_Process_D32
Prototype:
SSRC_ReturnStatus_en SSRC_Process_D32
(SSRC_Instance_t* pSSRC_Instance,
LVM_INT32* pSSRC_AudioIn,
LVM_INT32* pSSRC_AudioOut);
Description:
Process function for the SSRC module. The function takes pointers as input and output audio buffers.
The sample format used for the input and output buffers is 32-bit little-endian. Stereo buffers are interleaved (L1, R1, L2, R2, and so on), mono buffers are deinterleaved (L1, L2, and so on).
Name |
Type |
Description |
---|---|---|
|
|
Pointer to the instance of the SSRC. |
|
|
Pointer to the input samples. |
|
|
Pointer to the output samples. |
Returns:
|SSRC_OK
|When the function call succeeds.|
|SSRC_NULL_POINTER
|When one of pSSRC_Instance
, pSSRC_AudioIn
, or pSSRC_AudioOut
is NULL
.|
Parent topic:Functions
Parent topic:Application programmers interface (API)