nrfxlib API 2.7.99
Loading...
Searching...
No Matches

◆ LC3EncodeSessionOpen()

LC3EncoderHandle_t LC3EncodeSessionOpen ( uint16_t  sampleRate,
uint8_t  bitsPerSample,
LC3FrameSize_t  frameSize,
uint8_t *  buffer,
uint16_t *  bufferSize,
int32_t *  result 
)

#include <lc3/codec/inc/LC3API.h>

Opens and initializes an LC3 Encoder session.

This function initializes the LC3 encoder in preparation for encoding one stream of audio. It allocates the memory needed for the session's processing, including any used for tracking progress from frame to frame, and initializes the allocated memory.

A non-NULL handle to the encoder session is returned when successful. The handle value is passed to future calls of LC3EncodeSessionData() and LC3EncodeSessionClose() for this session.

This function can allocate its own memory or take a user-provided buffer. It can also return the amount of memory needed without initializing. These memory options are performed in the following ways:

bufferSize = NULL: Allocates memory needed. The buffer parameter may be NULL.

*bufferSize < memory required by encoder: Sets bufferSize's referenced value to the total memory required and returns LC3_RESULT_INSUFFICIENT_RESOURCES. The caller can then call this function again with a buffer of at least bufferSize's referenced value. A size of 0 will always trigger this condition. The buffer parameter may be NULL.

*bufferSize >= memory required by encoder: Uses the user-provided buffer. bufferSize's referenced value is set to the amount of memory used by the encoder. The buffer parameter may not be NULL.

Parameters
[in]sampleRateInput PCM sample rate in Hz.
[in]bitsPerSampleInput PCM bits per sample.
[in]frameSizeFrame size of 7.5 or 10 msec.
[in]bufferPointer to a memory buffer.
[in,out]bufferSizeSize of the memory buffer passed in, number of bytes used returned.
[out]resultPointer to an LC3 Return Code integer.
Returns
Non-NULL LC3EncoderHandle_t on success or NULL on failure.