nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ contin_array_buf_create()

int contin_array_buf_create ( struct net_buf * pcm_contin,
void const *const pcm_finite,
uint16_t pcm_finite_size,
uint32_t locations,
uint16_t *const _finite_pos )

#include <include/contin_array.h>

Creates a continuous array in the locations in the net_buf of given in locations, from a single channel finite array.

Note
This function assumes the finite array is of the same PCM format as the continuous array.
This function serves the purpose of e.g. having a set of audio samples stored in pcm_finite. This can then be fetched in smaller pieces into RAM and played back in a loop using the results in pcm_cont. The function keeps track of the current position in finite_pos, so that the function can be called multiple times and maintain the correct position in pcm_finite.
Parameters
pcm_continPointer to the destination net buf.
Note
The continuous array can be empty. If so, the locations given in locations are filled with the finite array. All other valid locations are zeroed.
Parameters
pcm_finitePointer to the single channel de-interleaved finite array buffer.
pcm_finite_sizeSize of the finite array buffer.
locationsLocation(s) to write the finite array to.
Note
If locations is set to zero (mono) the pcm_contin locations must also be set to zero (mono) for the function to operate. If non-zero then all locations must be in the pcm_contin array for the function to operate.
Parameters
_finite_posVariable used internally. Must be set to 0 for the first run and not changed.
Return values
0If the operation was successful.
ENXIOOn NULL pointer.
EPERMIf any sizes or location is out of range.
EINVALIf the _finite_pos or locations are out of range.