This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BUFSIZE in C6747 audioSample

Expert 1215 points

Hi,

In pspdrivers_01_20_00\packages\ti\pspiom\examples\evm6747\audio\src\audioSample_io.c, the BUFSIZE is defined as 

 

#define BUFSIZE                 (BUFLEN * sizeof(Ptr))

Looks quite strange to me. Why *sizeof(Ptr)? The result turns out to be correct for 16bit stereo buffer, but this is not the right way to define it. Where is the Ptr defined?

 

Thanks

Yan

 

 

  • Hi,

    Sorry for the confusion.

    The macro "BUFSIZE" is used to specify the length of the buffer. This value is used to specify how large a buffer the application wants to supply.
    e.g. if you want to supply data as 32 bit,2 slot mode then the buffer size needs to be a multiple of  4bytes * 2 slots i.e. 8bytes. Similarily if the data is 16 bit,2 slot mode then the buffer size needs to be a multiple of 2bytes * 2slots i.e. 4 bytes.

    So the change in this "BUFSIZE" actually determines how many samples of data are present in the application buffer only. The actual configuration of the slot size and the number of slots are taken from the channel parameters used during the creation of the channel.

    Here in this sample application case, since we are reading data in DSP mode i.e. 32 bit,1 slot mode, we were calculating the size of the buffer as (2560 *4) i.e. to have a minimum of 2560 samples per packet.
    We will be changing this in the next release.

    And also Ptr is just (void *) type and the size is 4 bytes.

    Thanks & Regards,
    Imtiaz SMA