le_audio_interface.h
Go to the documentation of this file.
54 * An audio profile can be retrieved with le_audio_GetProfile() and set with le_audio_SetProfile().56 * Then, the following functions let you enable or disable the audio settings on the selected audio62 * - le_audio_EnableIirFilter()/ le_audio_DisableIirFilter(): downlink IIR Filter (Infinite Impulse70 * To configure the encoding format, use le_audio_GetEncodingFormat() and le_audio_SetEncodingFormat().76 * - le_audio_GetPcmSamplingResolution() and le_audio_SetPcmSamplingResolution() for bit/sample settings.78 * - le_audio_GetSamplePcmChannelNumber() and le_audio_SetSamplePcmChannelNumber() for channel numbers.107 * - le_audio_OpenModemVoiceRx(): returns an Audio Stream Reference of the digitized audio signal110 * - le_audio_OpenModemVoiceTx(): returns an Audio Stream Reference of the digitized audio signal135 * On most platforms, it only allocates a context in memory. The audio path becomes active when the141 * Once the users get an Audio Stream reference, they can control it with the following functions:150 * @note Multimedia (playback and recording) must be controlled separately from the main audio path152 * muting/unmuting the multimedia stream, and not the other connected stream. For example, in case162 * - le_audio_SetPlatformSpecificGain(): adjust the value of a platform specific gain in the audio187 * A sample code that implements audio connectors and audio streams during voice call can be found in191 * In particular, a connector using Modem Voice Rx or Tx interfaces has to be created before dialing208 * - AMR_NB (AMR Narrowband) codec that encodes narrowband (200--3400 Hz) signals at variable bit210 * - AMR-WB (AMR Wideband) is an ITU-T standard speech codec which improved speech quality due to a237 * "I2S Rx", "Modem Voice Tx" and "Recorder" must be previously connected before recording a file.268 * - The playback/record stops playing/recording, and the read/write position indicator associated269 * with the file stream is rewound to the beginning of the file. A new file can be played/recorded271 * - le_audio_Pause(): can be called to pause a play/record. The file playing/recording is put on286 * @note The @c LE_AUDIO_MEDIA_NO_MORE_SAMPLES event indicates when all samples put into the pipe289 * A sample code that implements audio playback and capture can be found in \b audioPlaybackRec.c294 * The le_audio_PlayDtmf() function allows the application to play one or several DTMF on a playback295 * stream. The duration and the pause of the DTMFs must also be specified with the input parameters.297 * The le_audio_PlaySignallingDtmf() function allows the application to ask the Mobile Network to299 * le_audio_PlaySignallingDtmf() function may offer a better signal quality, but the the duration302 * The application must register a handler function to detect incoming DTMF characters on a specific303 * input audio stream. The le_audio_AddDtmfDetectorHandler() function installs a handler for DTMF312 * A sample code that implements DTMF playback and decoding can be found in \b audioDtmfTest.c file354 //--------------------------------------------------------------------------------------------------358 //--------------------------------------------------------------------------------------------------361 //--------------------------------------------------------------------------------------------------364 * Connect the current client thread to the service providing this API. Block until the service is367 * For each thread that wants to use this API, either ConnectService or TryConnectService must be368 * called before any other functions in this API. Normally, ConnectService is automatically called373 //--------------------------------------------------------------------------------------------------379 //--------------------------------------------------------------------------------------------------382 * Try to connect the current client thread to the service providing this API. Return with an error385 * For each thread that wants to use this API, either ConnectService or TryConnectService must be386 * called before any other functions in this API. Normally, ConnectService is automatically called395 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).398 //--------------------------------------------------------------------------------------------------404 //--------------------------------------------------------------------------------------------------408 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants411 //--------------------------------------------------------------------------------------------------418 //--------------------------------------------------------------------------------------------------424 * longer a connection to the service, and the functions in this API can't be used. For details, see429 //--------------------------------------------------------------------------------------------------436 //--------------------------------------------------------------------------------------------------440 //--------------------------------------------------------------------------------------------------443 //--------------------------------------------------------------------------------------------------447 //--------------------------------------------------------------------------------------------------450 //--------------------------------------------------------------------------------------------------454 //--------------------------------------------------------------------------------------------------457 //--------------------------------------------------------------------------------------------------461 //--------------------------------------------------------------------------------------------------464 //--------------------------------------------------------------------------------------------------468 //--------------------------------------------------------------------------------------------------471 //--------------------------------------------------------------------------------------------------475 //--------------------------------------------------------------------------------------------------478 //--------------------------------------------------------------------------------------------------482 //--------------------------------------------------------------------------------------------------485 //--------------------------------------------------------------------------------------------------490 //--------------------------------------------------------------------------------------------------493 //--------------------------------------------------------------------------------------------------497 //--------------------------------------------------------------------------------------------------500 //--------------------------------------------------------------------------------------------------505 //--------------------------------------------------------------------------------------------------508 //--------------------------------------------------------------------------------------------------512 //--------------------------------------------------------------------------------------------------515 //--------------------------------------------------------------------------------------------------521 //--------------------------------------------------------------------------------------------------527 //--------------------------------------------------------------------------------------------------533 //--------------------------------------------------------------------------------------------------539 //--------------------------------------------------------------------------------------------------545 //--------------------------------------------------------------------------------------------------551 //--------------------------------------------------------------------------------------------------557 //--------------------------------------------------------------------------------------------------563 //--------------------------------------------------------------------------------------------------569 //--------------------------------------------------------------------------------------------------576 //--------------------------------------------------------------------------------------------------582 //--------------------------------------------------------------------------------------------------589 //--------------------------------------------------------------------------------------------------595 //--------------------------------------------------------------------------------------------------602 //--------------------------------------------------------------------------------------------------608 //--------------------------------------------------------------------------------------------------615 //--------------------------------------------------------------------------------------------------621 //--------------------------------------------------------------------------------------------------627 //--------------------------------------------------------------------------------------------------633 //--------------------------------------------------------------------------------------------------639 //--------------------------------------------------------------------------------------------------645 //--------------------------------------------------------------------------------------------------651 //--------------------------------------------------------------------------------------------------657 //--------------------------------------------------------------------------------------------------663 //--------------------------------------------------------------------------------------------------670 //--------------------------------------------------------------------------------------------------681 //--------------------------------------------------------------------------------------------------685 //--------------------------------------------------------------------------------------------------692 //--------------------------------------------------------------------------------------------------701 //--------------------------------------------------------------------------------------------------708 //--------------------------------------------------------------------------------------------------721 //--------------------------------------------------------------------------------------------------730 //--------------------------------------------------------------------------------------------------742 //--------------------------------------------------------------------------------------------------751 //--------------------------------------------------------------------------------------------------763 //--------------------------------------------------------------------------------------------------770 //--------------------------------------------------------------------------------------------------782 //--------------------------------------------------------------------------------------------------789 //--------------------------------------------------------------------------------------------------795 //--------------------------------------------------------------------------------------------------801 //--------------------------------------------------------------------------------------------------808 //--------------------------------------------------------------------------------------------------815 //--------------------------------------------------------------------------------------------------828 //--------------------------------------------------------------------------------------------------837 //--------------------------------------------------------------------------------------------------844 //--------------------------------------------------------------------------------------------------853 //--------------------------------------------------------------------------------------------------860 //--------------------------------------------------------------------------------------------------871 //--------------------------------------------------------------------------------------------------875 //--------------------------------------------------------------------------------------------------882 //--------------------------------------------------------------------------------------------------893 //--------------------------------------------------------------------------------------------------900 //--------------------------------------------------------------------------------------------------911 //--------------------------------------------------------------------------------------------------918 //--------------------------------------------------------------------------------------------------929 //--------------------------------------------------------------------------------------------------936 //--------------------------------------------------------------------------------------------------947 //--------------------------------------------------------------------------------------------------954 //--------------------------------------------------------------------------------------------------965 //--------------------------------------------------------------------------------------------------974 //--------------------------------------------------------------------------------------------------985 //--------------------------------------------------------------------------------------------------994 //--------------------------------------------------------------------------------------------------1005 //--------------------------------------------------------------------------------------------------1012 //--------------------------------------------------------------------------------------------------1023 //--------------------------------------------------------------------------------------------------1030 //--------------------------------------------------------------------------------------------------1041 //--------------------------------------------------------------------------------------------------1048 //--------------------------------------------------------------------------------------------------1059 //--------------------------------------------------------------------------------------------------1066 //--------------------------------------------------------------------------------------------------1068 * This function must be called to enable the automatic gain control on the selected audio stream.1077 //--------------------------------------------------------------------------------------------------1084 //--------------------------------------------------------------------------------------------------1086 * This function must be called to disable the automatic gain control on the selected audio stream.1095 //--------------------------------------------------------------------------------------------------1102 //--------------------------------------------------------------------------------------------------1111 //--------------------------------------------------------------------------------------------------1118 //--------------------------------------------------------------------------------------------------1127 //--------------------------------------------------------------------------------------------------1134 //--------------------------------------------------------------------------------------------------1143 //--------------------------------------------------------------------------------------------------1150 //--------------------------------------------------------------------------------------------------1159 //--------------------------------------------------------------------------------------------------1166 //--------------------------------------------------------------------------------------------------1175 //--------------------------------------------------------------------------------------------------1182 //--------------------------------------------------------------------------------------------------1188 //--------------------------------------------------------------------------------------------------1194 //--------------------------------------------------------------------------------------------------1200 //--------------------------------------------------------------------------------------------------1206 //--------------------------------------------------------------------------------------------------1212 //--------------------------------------------------------------------------------------------------1218 //--------------------------------------------------------------------------------------------------1224 //--------------------------------------------------------------------------------------------------1230 //--------------------------------------------------------------------------------------------------1236 //--------------------------------------------------------------------------------------------------1242 //--------------------------------------------------------------------------------------------------1257 * thus share file offset. So, once a playback has reached the end of file, the application must1266 //--------------------------------------------------------------------------------------------------1275 //--------------------------------------------------------------------------------------------------1283 * @note The fd is closed by the IPC API. To use again the same pipe, the fd parameter can be set1285 * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )1290 //--------------------------------------------------------------------------------------------------1299 //--------------------------------------------------------------------------------------------------1308 * @note the fd is closed by the API. To record again the same file, the fd parameter can be set to1310 * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )1314 //--------------------------------------------------------------------------------------------------1323 //--------------------------------------------------------------------------------------------------1331 * @note The fd is closed by the API. To use again the same pipe, the fd parameter can be set to1333 * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )1338 //--------------------------------------------------------------------------------------------------1347 //--------------------------------------------------------------------------------------------------1357 //--------------------------------------------------------------------------------------------------1364 //--------------------------------------------------------------------------------------------------1372 //--------------------------------------------------------------------------------------------------1379 //--------------------------------------------------------------------------------------------------1387 //--------------------------------------------------------------------------------------------------1394 //--------------------------------------------------------------------------------------------------1402 //--------------------------------------------------------------------------------------------------1409 //--------------------------------------------------------------------------------------------------1417 //--------------------------------------------------------------------------------------------------1426 //--------------------------------------------------------------------------------------------------1434 //--------------------------------------------------------------------------------------------------1443 //--------------------------------------------------------------------------------------------------1451 //--------------------------------------------------------------------------------------------------1460 //--------------------------------------------------------------------------------------------------1468 //--------------------------------------------------------------------------------------------------1477 //--------------------------------------------------------------------------------------------------1485 //--------------------------------------------------------------------------------------------------1494 //--------------------------------------------------------------------------------------------------1502 //--------------------------------------------------------------------------------------------------1511 //--------------------------------------------------------------------------------------------------1526 //--------------------------------------------------------------------------------------------------1539 //--------------------------------------------------------------------------------------------------1541 * This function must be called to ask to the Mobile Network to generate on the remote audio party1552 //--------------------------------------------------------------------------------------------------1563 //--------------------------------------------------------------------------------------------------1571 //--------------------------------------------------------------------------------------------------1580 //--------------------------------------------------------------------------------------------------1591 //--------------------------------------------------------------------------------------------------1600 //--------------------------------------------------------------------------------------------------1608 //--------------------------------------------------------------------------------------------------1617 //--------------------------------------------------------------------------------------------------1627 //--------------------------------------------------------------------------------------------------1636 //--------------------------------------------------------------------------------------------------1646 //--------------------------------------------------------------------------------------------------1655 //--------------------------------------------------------------------------------------------------1665 //--------------------------------------------------------------------------------------------------1674 //--------------------------------------------------------------------------------------------------1689 //--------------------------------------------------------------------------------------------------1698 //--------------------------------------------------------------------------------------------------1712 //--------------------------------------------------------------------------------------------------1721 //--------------------------------------------------------------------------------------------------1729 //--------------------------------------------------------------------------------------------------1735 //--------------------------------------------------------------------------------------------------1743 //--------------------------------------------------------------------------------------------------le_result_t le_audio_GetProfile(uint32_t *profilePtr)le_result_t le_audio_RecordFile(le_audio_StreamRef_t streamRef, int fd)le_result_t le_audio_GetSampleAmrMode(le_audio_StreamRef_t streamRef, le_audio_AmrMode_t *modePtr)le_audio_StreamRef_t le_audio_OpenMic(void)le_audio_StreamRef_t le_audio_OpenPcmRx(uint32_t timeslot)struct le_audio_DtmfDetectorHandler * le_audio_DtmfDetectorHandlerRef_tDefinition: le_audio_common.h:215le_result_t le_audio_SetPcmSamplingRate(uint32_t rate)le_result_t le_audio_PlaySignallingDtmf(const char *LE_NONNULL dtmf, uint32_t duration, uint32_t pause)le_result_t le_audio_GetSamplePcmSamplingResolution(le_audio_StreamRef_t streamRef, uint32_t *samplingResPtr)le_audio_ConnectorRef_t le_audio_CreateConnector(void)le_result_t le_audio_SetPlatformSpecificGain(const char *LE_NONNULL gainName, int32_t gain)void le_audio_ConnectService(void)le_result_t le_audio_GetSamplePcmChannelNumber(le_audio_StreamRef_t streamRef, uint32_t *nbChannelPtr)LE_FULL_API void le_audio_SetServerDisconnectHandler(le_audio_DisconnectHandler_t disconnectHandler, void *contextPtr)le_audio_StreamRef_t le_audio_OpenRecorder(void)le_result_t le_audio_Stop(le_audio_StreamRef_t streamRef)le_result_t le_audio_GetSampleAmrDtx(le_audio_StreamRef_t streamRef, bool *dtxPtr)le_result_t le_audio_MuteCallWaitingTone(void)void le_audio_Close(le_audio_StreamRef_t streamRef)le_result_t le_audio_SetEncodingFormat(le_audio_StreamRef_t streamRef, le_audio_Format_t format)le_result_t le_audio_EnableIirFilter(le_audio_StreamRef_t streamRef)le_result_t le_audio_EnableFirFilter(le_audio_StreamRef_t streamRef)le_result_t le_audio_GetEncodingFormat(le_audio_StreamRef_t streamRef, le_audio_Format_t *formatPtr)le_result_t le_audio_Unmute(le_audio_StreamRef_t streamRef)le_result_t le_audio_PlaySamples(le_audio_StreamRef_t streamRef, int fd)le_result_t le_audio_UnmuteCallWaitingTone(void)le_result_t le_audio_DisableEchoCanceller(le_audio_StreamRef_t streamRef)void le_audio_DisconnectService(void)void(* le_audio_DtmfDetectorHandlerFunc_t)(le_audio_StreamRef_t streamRef, char dtmf, void *contextPtr)Definition: le_audio_common.h:241le_result_t le_audio_GetGain(le_audio_StreamRef_t streamRef, int32_t *gainPtr)le_audio_Companding_t le_audio_GetPcmCompanding(void)le_result_t le_audio_EnableNoiseSuppressor(le_audio_StreamRef_t streamRef)void le_audio_Disconnect(le_audio_ConnectorRef_t connectorRef, le_audio_StreamRef_t streamRef)le_result_t le_audio_SetSamplePcmChannelNumber(le_audio_StreamRef_t streamRef, uint32_t nbChannel)le_result_t le_audio_SetGain(le_audio_StreamRef_t streamRef, int32_t gain)le_result_t le_audio_GetSamples(le_audio_StreamRef_t streamRef, int fd)le_audio_StreamRef_t le_audio_OpenUsbRx(void)le_result_t le_audio_Connect(le_audio_ConnectorRef_t connectorRef, le_audio_StreamRef_t streamRef)le_result_t le_audio_SetSamplePcmSamplingRate(le_audio_StreamRef_t streamRef, uint32_t rate)le_audio_StreamRef_t le_audio_OpenModemVoiceRx(void)le_result_t le_audio_DisableNoiseSuppressor(le_audio_StreamRef_t streamRef)le_result_t le_audio_Flush(le_audio_StreamRef_t streamRef)le_audio_MediaHandlerRef_t le_audio_AddMediaHandler(le_audio_StreamRef_t streamRef, le_audio_MediaHandlerFunc_t handlerPtr, void *contextPtr)le_result_t le_audio_Mute(le_audio_StreamRef_t streamRef)le_audio_StreamRef_t le_audio_OpenModemVoiceTx(void)uint32_t le_audio_GetDefaultPcmTimeSlot(void)le_result_t le_audio_Resume(le_audio_StreamRef_t streamRef)le_result_t le_audio_TryConnectService(void)le_result_t le_audio_Pause(le_audio_StreamRef_t streamRef)le_audio_StreamRef_t le_audio_OpenI2sTx(le_audio_I2SChannel_t mode)le_audio_StreamRef_t le_audio_OpenPcmTx(uint32_t timeslot)le_result_t le_audio_SetSamplePcmSamplingResolution(le_audio_StreamRef_t streamRef, uint32_t samplingRes)struct le_audio_MediaHandler * le_audio_MediaHandlerRef_tDefinition: le_audio_common.h:207struct le_audio_Connector * le_audio_ConnectorRef_tDefinition: le_audio_common.h:199le_audio_DtmfDetectorHandlerRef_t le_audio_AddDtmfDetectorHandler(le_audio_StreamRef_t streamRef, le_audio_DtmfDetectorHandlerFunc_t handlerPtr, void *contextPtr)le_result_t le_audio_SetProfile(uint32_t profile)le_result_t le_audio_SetPcmCompanding(le_audio_Companding_t companding)void(* le_audio_MediaHandlerFunc_t)(le_audio_StreamRef_t streamRef, le_audio_MediaEvent_t event, void *contextPtr)Definition: le_audio_common.h:225le_audio_StreamRef_t le_audio_OpenSpeaker(void)le_result_t le_audio_SetSampleAmrMode(le_audio_StreamRef_t streamRef, le_audio_AmrMode_t mode)le_result_t le_audio_GetSamplePcmSamplingRate(le_audio_StreamRef_t streamRef, uint32_t *ratePtr)le_audio_StreamRef_t le_audio_OpenI2sRx(le_audio_I2SChannel_t mode)uint32_t le_audio_GetPcmSamplingRate(void)le_audio_StreamRef_t le_audio_OpenPlayer(void)le_audio_StreamRef_t le_audio_OpenUsbTx(void)uint32_t le_audio_GetPcmSamplingResolution(void)le_result_t le_audio_DisableAutomaticGainControl(le_audio_StreamRef_t streamRef)le_result_t le_audio_IsEchoCancellerEnabled(le_audio_StreamRef_t streamRef, bool *statusPtr)void le_audio_RemoveDtmfDetectorHandler(le_audio_DtmfDetectorHandlerRef_t handlerRef)le_audio_I2SChannel_t le_audio_GetDefaultI2sMode(void)le_result_t le_audio_GetPlatformSpecificGain(const char *LE_NONNULL gainName, int32_t *gainPtr)le_result_t le_audio_EnableEchoCanceller(le_audio_StreamRef_t streamRef)le_result_t le_audio_IsNoiseSuppressorEnabled(le_audio_StreamRef_t streamRef, bool *statusPtr)void le_audio_DeleteConnector(le_audio_ConnectorRef_t connectorRef)le_result_t le_audio_DisableFirFilter(le_audio_StreamRef_t streamRef)le_result_t le_audio_DisableIirFilter(le_audio_StreamRef_t streamRef)void(* le_audio_DisconnectHandler_t)(void *)Definition: le_audio_interface.h:359le_result_t le_audio_EnableAutomaticGainControl(le_audio_StreamRef_t streamRef)le_result_t le_audio_PlayDtmf(le_audio_StreamRef_t streamRef, const char *LE_NONNULL dtmf, uint32_t duration, uint32_t pause)void le_audio_RemoveMediaHandler(le_audio_MediaHandlerRef_t handlerRef)le_result_t le_audio_SetSampleAmrDtx(le_audio_StreamRef_t streamRef, bool dtx)le_result_t le_audio_PlayFile(le_audio_StreamRef_t streamRef, int fd)le_result_t le_audio_SetPcmSamplingResolution(uint32_t bitsPerSample)