1.3.4.1 Library Interface

This section lists the files that are available in the FLAC Decoder Library.

Description

This section lists the files that are available in the src folder of the FLAC Decoder Library. It lists which files need to be included in the build based on a configuration option selected by the system.

The following three tables list and describe the header (.h) and source (.c) files that implement this library. The parent folder for these files is src/config/<config_dir>/audio/decoder/

Interface File(s)

This table lists and describes the header files that must be included (i.e., using #include) by any code that uses this library.

Source File NameDescription
audio_decoders.hHeader file that includes the lower-level include files (e.g. flac_dec.h)
audio_decoders_config.hHeader file that contains #defines for each enabled decoder FLAC_DECODER_ENABLED)

Required File(s)

All of the required files listed in the following table are automatically added into the MPLAB X IDE project by the MHC when the library is selected for use.

This table lists and describes the header and source files that must always be included in the MPLAB X IDE project to build this library.

Source File NameDescription
audio_decoders/flac/flac_dec.c,.hThese are public APIs for using the FLAC Decoder
audio_decoders/flac/flac_master/include/FLAC/format.hThis file configures decoding logic and format

The FLAC Decoder Library files in the apps repository only contain a wrapper around the Xiph open-source FLAC Decoder, located in the xiph_flac repository. Files from the Harmony framework's xiph repo are copied into the local flac folder of the application when code is generated using MHC.

If using the FLAC Decoder Library from the audio repository, the xiph_flac repository must also be downloaded.

1.3.4.1 Library Interface

This section describes the Application Programming Interface (API) functions of the FLAC Decoder Library, in this version of the release.

Functions

NameDescription
FLAC_isDecoder_enabledFunction to check if FLAC decoding is enabled.
FLAC_InitializeFunction to initialize FLAC library.
FLAC_RegisterDecoderEventHandlerCallbackRegisters application defined Decoder Callbacks.
FLAC_DecodeSingleFrameThis function decodes one FLAC frame and returns the decoded data.
FLAC_GetChannelsThis function returns number of channels.
FLAC_GetBitRateThis function returns the bit rate.
FLAC_GetSamplingRateThis function returns the sample rate.
FLAC_GetBlockSizeThis Function returns the number of samples in a sub block.
FLAC_GetBitdepthThis function returns the resolution of the sound data.
FLAC_GetDurationThis function returns the track length of the FLAC audio file.
FLAC_CleanupThis is the function for deallocating memory resources of a FLAC decoder.
FLAC_DecoderIsFileValidFunction to check if a given FLAC file is valid or not.

Data Types and Constants

NameDescription
DecoderEventHandlerCBThe Callback function template for the application defined callback Functions.
FLAC_DEC_APPLICATIONCB_SETThe set of callbacks an application would be interested for callback.
FLAC_DEC_WRITE_EVT_CONTINUEWrite status Success upon decoder writecallback.
FLAC_DEC_WRITE_EVT_ERRWrite status Error upon decoder writecallback.