LIBTTAr_MISC(3)

NAME
libttaR_misc - miscellaneous functions and objects

SYNOPSIS
#include <libttaR.h>
size_t libttaR_codecstate_priv_size(unsigned int nchan);
size_t libttaR_ttabuf_safety_margin(
    enum TTASamplebytes samplebytes, unsigned int nchan
);
size_t libttaR_nsamples_perframe_tta1(size_t samplerate);
bool libttaR_test_nchan(unsigned int nchan);
const struct LibTTAr_VersionInfo libttaR_info;

DESCRIPTION
libttaR_codecstate_priv_size() calculates the size of a private state struct with nchan audio channels (for passing to an allocator). libttaR_ttabuf_safety_margin() calculates a safety-margin size for padding the TTA buffer in order to prevent a possible buffer overrun. The calculated size is greater than the maximum number of TTA bytes that could be encoded for one PCM sample with nchan channels. When decoding, the padding is needed in case the TTA data is corrupted or malformed. Not using this function may result in a >=LIBTTAr_RET_INVAL return from a codec function if the TTA buffer length is too small. libttaR_nsamples_perframe_tta1() returns the number of samples in a TTA1 frame for a given samplerate. libttaR_test_nchan() tests whether the library was built to support nchan audio channels. libttaR_info is a read-only object containing the library's version information.
    struct LibTTAr_VersionInfo {
        unsigned int       version;
        unsigned int       version_major;   // API change
        unsigned int       version_minor;   // bugfix or improvement
        unsigned int       version_revis;	// inbetween minor versions
        const char        *version_extra;
        const char        *version_date;
        const char        *copyright;
        const char        *license;
    };

  Arguments
nchan
    The number of audio channels in the PCM.
samplebytes
    The number of bytes per samples in the originally sized PCM. samplerate
        The audio sampling frequency in samples-per-second.

RETURN VALUE
libttaR_codecstate_priv_size()
    The size of a private state struct.
libttaR_ttabuf_safety_margin()
    How much to pad the TTA buffer by.
libttaR_nsamples_perframe_tta1()
    The number of samples in a TTA1 frame.
libttaR_test_nchan()
    true or false

ERRORS
0 if bad parameters

ATTRIBUTES
All are MT-Safe.

NOTES
libttaR_nsamples_perframe_tta1() is a macro.

SEE ALSO
libttaR_tta_encode(3), libttaR_tta_decode(3), libttaR_pcm_read(3), libttaR_pcm_write(3), libttaR_crc32(3)

AUTHOR
Shane Seelig
    Developer