le_audio_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_audio Audio
14  *
15  * @ref le_audio_interface.h "API Reference" <br>
16  * @ref platformConstraintsAudio Constraints
17  * <HR>
18  *
19  * The Audio API handles audio interfaces including play and record supported formats.
20  *
21  * A Legato device can use several audio interfaces. You choose the input and output
22  * interfaces to tie together. The Audio stream related to a particular interface is
23  * represented with an 'Audio Stream Reference'.
24  *
25  * You can create your own audio path by connecting several audio streams together using
26  * audio connectors.
27  *
28  * An audio path can support more than two audio interfaces. You can have a basic output audio
29  * path of a voice call to connect the Modem Voice Received interface with the Speaker
30  * interface, and at the same time, the Modem Voice Received interface can be also connected to a
31  * Recorder Device interface.
32  *
33  * @section le_audio_binding IPC interfaces binding
34  *
35  * All the functions of this API are provided by the @b audioService.
36  *
37  * Here's a code sample binding to audio services:
38  * @verbatim
39  bindings:
40  {
41  clientExe.clientComponent.le_audio -> audioService.le_audio
42  }
43  @endverbatim
44  *
45  * @section le_audio_configuration Configure the Audio
46  *
47  * The audio profile can be set with the le_audio_SetProfile() function.
48  *
49  * @warning Ensure to check the number of supported audio profiles for your specific platform.
50  *
51  * An audio profile can be retrieved with le_audio_GetProfile() and set with le_audio_SetProfile().
52  *
53  * Then, the following functions let you enable or disable the audio settings on the selected audio
54  * interface:
55  * - le_audio_EnableNoiseSuppressor()/le_audio_DisableNoiseSuppressor(): Noise Suppressor.
56  * - le_audio_EnableEchoCanceller()/ le_audio_DisableEchoCanceller(): Echo Canceller.
57  * - le_audio_EnableFirFilter()/ le_audio_DisableFirFilter(): downlink FIR Filter (Finite Impulse
58  * Response).
59  * - le_audio_EnableIirFilter()/ le_audio_DisableIirFilter(): downlink IIR Filter (Infinite Impulse
60  * Response).
61  * - le_audio_EnableAutomaticGainControl()/ le_audio_DisableAutomaticGainControl(): automatic
62  * gain on the selected audio stream.
63  *
64  * - le_audio_IsNoiseSuppressorEnabled(): To get the status of Noise Suppressor.
65  * - le_audio_IsEchoCancellerEnabled(): To get the status of Echo Canceller.
66  *
67  * To configure the encoding format, use le_audio_GetEncodingFormat() and le_audio_SetEncodingFormat().
68  *
69  * To configure gain settings, use le_audio_GetGain() and le_audio_SetGain().
70  *
71  * PCM has the following configuration get/set functions:
72  * - le_audio_GetPcmSamplingRate() and le_audio_SetPcmSamplingRate() for Hz rate.
73  * - le_audio_GetPcmSamplingResolution() and le_audio_SetPcmSamplingResolution() for bit/sample settings.
74  * - le_audio_GetPcmCompanding() and le_audio_SetPcmCompanding() for signal settings.
75  * - le_audio_GetSamplePcmChannelNumber() and le_audio_SetSamplePcmChannelNumber() for channel numbers.
76  *
77  * To Mute/Unmute the Call Waiting Tone to alert for an incoming voice call when a voice call is
78  * already in progress, use le_audio_MuteCallWaitingTone() and le_audio_UnmuteCallWaitingTone().
79  *
80  * @note The Call Waiting Supplementary Service must be enabled.
81  *
82  * @section le_audio_interfaces Open/Close an Audio Interface
83  *
84  * The following functions let you select the desired interface attributes:
85  * - le_audio_OpenMic(): returns an Audio Stream Reference of the analog audio signal coming from
86  * the microphone input.
87  * - le_audio_OpenSpeaker(): returns an Audio Stream Reference of the analog audio signal routed
88  * to the Speaker output.
89  * - le_audio_OpenUsbRx(): returns an Audio Stream Reference of the digitized audio signal coming
90  * from an external device connected via USB Audio Class.
91  * - le_audio_OpenUsbTx(): returns an Audio Stream Reference of the digitized audio signal routed
92  * to an external device connected via USB Audio Class.
93  * - le_audio_OpenPcmRx(): it returns an Audio Stream Reference of the digitized audio signal
94  * coming from an external device connected via the PCM interface.
95  * - le_audio_OpenPcmTx(): it returns an Audio Stream Reference of the digitized audio signal
96  * routed to an external device connected via the PCM interface.
97  * - le_audio_OpenI2sRx(): it returns an Audio Stream Reference of the digitized audio signal
98  * coming from an external device connected via the I2S interface.
99  * - le_audio_OpenI2sTx(): it returns an Audio Stream Reference of the digitized audio signal
100  * routed to an external device connected via the I2S interface.
101  * - le_audio_OpenModemVoiceRx(): returns an Audio Stream Reference of the digitized audio signal
102  * coming from a voice call. The audio format is negotiated with the
103  * network when the call is established.
104  * - le_audio_OpenModemVoiceTx(): returns an Audio Stream Reference of the digitized audio signal
105  * routed to a voice call. The audio format is negotiated with the
106  * network when the call is established.
107  *
108  * Multiple users can own the same stream at the same time.
109  *
110  * le_audio_GetDefaultPcmTimeSlot() can be called to get the default PCM time slot used on the
111  * current platform.
112  *
113  * le_audio_GetDefaultI2sMode() can be called to get the default I2s channel mode slot used on
114  * the current platform.
115  *
116  * Call le_audio_Close() to release it. If
117  * several users own the same, corresponding stream reference, the interface will
118  * close only after the last user releases the audio stream.
119  *
120  * You can configure the PCM interface with the le_audio_SetPcmSamplingRate(),
121  * le_audio_SetPcmSamplingResolution() and le_audio_SetPcmCompanding() functions.
122  * This function must be called before activating an audio path with the PCM interface, in other
123  * words you must call this function before connecting the PCM Stream to a connector.
124  *
125  * In addition, the le_audio_GetPcmSamplingRate(), le_audio_GetPcmSamplingResolution() and
126  * le_audio_GetPcmCompanding() functions allows you to retrieve the PCM interface configuration.
127  *
128  * @note Opening a Legato audio stream doesn’t necessarily interact with the audio HW interface.
129  * On most platforms, it only allocates a context in memory. The audio path becomes active when the
130  * streams are plugged into a connector.
131  *
132  *
133  * @section le_audio_streams Control an Audio Stream
134  *
135  * Once the users get an Audio Stream reference, they can control it with the following functions:
136  *
137  * - le_audio_SetGain(): adjust the gain of an audio stream (gain value is specific to the
138  * platform).
139  * - le_audio_GetGain(): retrieve the gain of an audio stream (gain value is specific to the
140  * platform).
141  * - le_audio_Mute(): mute an audio stream.
142  * - le_audio_Unmute(): unmute an audio stream.
143  *
144  * @note Multimedia (playback and recording) must be controled separatly from the main audio path
145  * (Microphone/Speaker, I2S, PCM, USB). Muting/Unmuting a multimedia is done by
146  * muting/unmuting the multimedia stream, and not the other connected stream. For example, in case
147  * of playback + voice on the speaker, if the user wants to mute all the audio outcoming to the
148  * speaker, it must mute both the Speaker stream and the playback stream.
149  *
150  * @warning Ensure to check the list of supported audio streams for these functions on your
151  * specific platform.
152  *
153  * In the case your platform can support other gains in your audio subsystem, you can set or get
154  * the value of them with the following functions:
155  *
156  * - le_audio_SetPlatformSpecificGain(): adjust the value of a platform specific gain in the audio
157  * subsystem.
158  * - le_audio_GetPlatformSpecificGain(): retrieve the value of a platform specific gain in the
159  * audio subsystem.
160  *
161  * @warning Ensure to check the names of supported gains for your specific platform.
162  *
163  * @section le_audio_connectors Create Audio connectors
164  *
165  * You can create your own audio path by connecting several audio streams together.
166  *
167  * le_audio_CreateConnector() function creates a reference to an audio connector.
168  *
169  * You can tie an audio stream to a connector by calling the le_audio_Connect()
170  * function.
171  *
172  * You can remove an audio stream from a connector by calling the le_audio_Disconnect()
173  * function.
174  *
175  * When finished with it, delete it using the le_audio_DeleteConnector() function.
176  *
177  * The following image shows how to connect a Player stream to play a file towards a remote end
178  * during a voice call.
179  * @image html AudioConnector.png
180  *
181  * A sample code that implements audio connectors and audio streams during voice call can be found in
182  * \b audioMccTest.c file (please refer to @ref c_audioMcc page).
183  *
184  * @note It is recommended to set the connectors before the connected streams are used.
185  * In particular, a connector using Modem Voice Rx or Tx interfaces has to be created before dialing
186  * or answering the call if the application needs to customize the audio path.
187  *
188  * @section le_audio_pb_playback Playback
189  *
190  * An audio file can be played to any active output interfaces.
191  *
192  * Open a player interface by calling:
193  * - le_audio_OpenPlayer(): returns an Audio Stream Reference for file playback.
194  * An audio file can be played on the local audio interface like
195  * Speaker, USB Tx, PCM Tx, I2S Tx or on the remote audio
196  * interface Modem Voice Tx depending the kind of connector
197  * (input or output) is tied to.
198  *
199  * - le_audio_PlayFile(): plays a specified file. WAVE (Waveform audio file) and
200  * AMR (Adaptive Multi Rate) are supported.
201  * AMR is an audio compression format optimized for speech coding. Two codecs are supported:
202  * - AMR_NB (AMR Narrowband) codec that encodes narrowband (200--3400 Hz) signals at variable bit
203  * rates ranging from 4.75 to 12.2 kbit/s. It was adopted as the standard speech codec by 3GPP.
204  * - AMR-WB (AMR Wideband) is an ITU-T standard speech codec which improved speech quality due to a
205  * wider speech bandwidth of 50--7000 Hz.
206  *
207  * - le_audio_PlaySamples(): initiates a playback using an audio flow. A pipe has
208  * to be opened first, then the PCM samples are sent throught the opened pipe.
209  * A play can be done only on a connected stream. For instance, the
210  * "I2S Tx", "Modem Voice Rx" and "Player" must be previously connected before playing a file.
211  *
212  * @section le_audio_pb_rec Record
213  *
214  * * Audio file recording can be done from any active input interface.
215  *
216  * Open a "File Recording" interface by calling:
217  * - le_audio_OpenRecorder(): returns an Audio Stream Reference for file recording.
218  * The local audio interface like Microphone, USB Rx, PCM Rx,
219  * I2S Rx is recorded into an audio file; or the Modem Voice Rx
220  * remote audio interface is recorded into an audio file,
221  * depending the kind of connector (input or output) is tied to.
222  * - le_audio_RecordFile(): records in a specified file.
223  * - le_audio_SetEncodingFormat(): sets the encoding format. The same formats as the
224  * player are supported.
225  * - le_audio_GetEncodingFormat(): gets the encoding format.
226  * - le_audio_GetSamples(): gets the audio PCM samples. A pipe has
227  * to be opened first, then the PCM samples are sent throught the opened pipe.
228  * Recording can only be done on a connected stream. For example, the
229  * "I2S Rx", "Modem Voice Tx" and "Recorder" must be previously connected before recording a file.
230  *
231  * A PCM configuration must be set with:
232  * - le_audio_SetSamplePcmChannelNumber(): sets the channel number of a PCM
233  * sample.
234  * - le_audio_SetSamplePcmSamplingRate(): sets the sampling rate of a PCM
235  * sample.
236  * - le_audio_SetSamplePcmSamplingResolution(): sets the sampling resolution
237  * (in bits per sample) of a PCM sample.
238  *
239  * The PCM samples configuration can be retrieved with:
240  * - le_audio_GetSamplePcmChannelNumber(): gets the channel number of a PCM
241  * sample.
242  * - le_audio_GetSamplePcmSamplingRate(): gets the sampling rate of a PCM
243  * sample.
244  * - le_audio_GetSamplePcmSamplingResolution(): can be called to get the sampling resolution
245  * (in bits per sample) of a PCM sample.
246  * The default configuration is PCM 16-bit audio @ 8KHz one channel.
247  *
248  * An AMR configuration must be set with:
249  * - le_audio_SetSampleAmrMode(): sets the AMR mode (NB/WB, bitrate).
250  * - le_audio_SetSampleAmrDtx(): can be called to activate/deactivate the Discontinuous
251  * Transmission (DTX) to reduce bandwidth usage during silence periods.
252  * The AMR configuration can be retrieved with:
253  * - le_audio_GetSampleAmrMode(): gets the AMR mode.
254  * - le_audio_GetSampleAmrDtx(): gets the Discontinuous
255  * Transmission (DTX).
256  *
257  * To stop a play/record call le_audio_Stop():
258  * - The playback/record stops playing/recording, and the read/write position indicator associated
259  * with the file stream is rewound to the beginning of the file. A new file can be played/recorded
260  * using le_audio_PlayFile()/le_audio_PlaySamples()/le_audio_RecordFile()/le_audio_GetSamples().
261  * - le_audio_Pause(): can be called to pause a play/record. The file playing/recording is put on
262  * hold, the read/write position indicator of the file is not moved.
263  * - le_audio_Resume(): can be called to resume a paused play/record. The file playing/recording
264  * continues at the file's position indicator held after the pause.
265  * - le_audio_Flush(): can be called to flush the remaining audio samples before sending
266  * them to the audio driver.
267  *
268  * You can also register a handler function for media-related notifications like errors or audio
269  * events.
270  *
271  * le_audio_AddMediaHandler() function installs a handler for player/recorder stream
272  * notifications.
273  *
274  * le_audio_RemoveMediaHandler() function removes the player/recorder handler function.
275  *
276  * @note The @c LE_AUDIO_MEDIA_NO_MORE_SAMPLES event indicates when all samples put into the pipe
277  * by the user's app have been sent to the audio driver (see le_audio_PlaySamples()).
278  *
279  * A sample code that implements audio playback and capture can be found in \b audioPlaybackRec.c
280  * file (please refer to @ref c_audioCapturePlayback page).
281  *
282  * @section le_audio_dtmf DTMF
283  *
284  * The le_audio_PlayDtmf() function allows the application to play one or several DTMF on a playback
285  * stream. The duration and the pause of the DTMFs must also be specified with the input parameters.
286  *
287  * The le_audio_PlaySignallingDtmf() function allows the application to ask the Mobile Network to
288  * generate on the remote audio party the DTMFs. Compared with le_audio_PlayDtmf(),
289  * le_audio_PlaySignallingDtmf() function may offer a better signal quality, but the the duration
290  * and the pause timings may be less accurate.
291  *
292  * The application must register a handler function to detect incoming DTMF characters on a specific
293  * input audio stream. The le_audio_AddDtmfDetectorHandler() function installs a handler for DTMF
294  * detection.
295  *
296  * The le_audio_RemoveDtmfDetectorHandler() function uninstalls the handler function.
297  *
298  * The DTMFs are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, *, #, A, B, C, D. Not case sensitive.
299  *
300  * @note The DTMF decoding works only on an active audio path.
301  *
302  * A sample code that implements DTMF playback and decoding can be found in \b audioDtmfTest.c file
303  * (please refer to @ref c_audiodtmf page).
304  *
305  * <HR>
306  *
307  * Copyright (C) Sierra Wireless Inc.
308  */
309 /**
310  * @file le_audio_interface.h
311  *
312  * Legato @ref c_audio include file.
313  *
314  * Copyright (C) Sierra Wireless Inc.
315  */
316 /**
317  * @page c_audioMcc Sample code of audio settings for a dialing call
318  *
319  * @include "apps/test/audio/audioMcc/audioMccComp/audioMccTest.c"
320  */
321 /**
322  * @page c_audiodtmf Sample code of dtmf playback and decoding
323  *
324  * @include "apps/test/audio/dtmf/dtmfTestComp/audioDtmfTest.c"
325  */
326 /**
327  * @page c_audioCapturePlayback Sample code of audio playback and capture
328  *
329  * @include "apps/test/audio/audioPlaybackRec/audioPlaybackRecComp/audioPlaybackRec.c"
330  */
331 
332 #ifndef LE_AUDIO_INTERFACE_H_INCLUDE_GUARD
333 #define LE_AUDIO_INTERFACE_H_INCLUDE_GUARD
334 
335 
336 #include "legato.h"
337 
338 
339 //--------------------------------------------------------------------------------------------------
340 /**
341  * Type for handler called when a server disconnects.
342  */
343 //--------------------------------------------------------------------------------------------------
344 typedef void (*le_audio_DisconnectHandler_t)(void *);
345 
346 //--------------------------------------------------------------------------------------------------
347 /**
348  *
349  * Connect the current client thread to the service providing this API. Block until the service is
350  * available.
351  *
352  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
353  * called before any other functions in this API. Normally, ConnectService is automatically called
354  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
355  *
356  * This function is created automatically.
357  */
358 //--------------------------------------------------------------------------------------------------
360 (
361  void
362 );
363 
364 //--------------------------------------------------------------------------------------------------
365 /**
366  *
367  * Try to connect the current client thread to the service providing this API. Return with an error
368  * if the service is not available.
369  *
370  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
371  * called before any other functions in this API. Normally, ConnectService is automatically called
372  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
373  *
374  * This function is created automatically.
375  *
376  * @return
377  * - LE_OK if the client connected successfully to the service.
378  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
379  * bound.
380  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
381  * - LE_COMM_ERROR if the Service Directory cannot be reached.
382  */
383 //--------------------------------------------------------------------------------------------------
385 (
386  void
387 );
388 
389 //--------------------------------------------------------------------------------------------------
390 /**
391  * Set handler called when server disconnection is detected.
392  *
393  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
394  * to continue without exiting, it should call longjmp() from inside the handler.
395  */
396 //--------------------------------------------------------------------------------------------------
398 (
399  le_audio_DisconnectHandler_t disconnectHandler,
400  void *contextPtr
401 );
402 
403 //--------------------------------------------------------------------------------------------------
404 /**
405  *
406  * Disconnect the current client thread from the service providing this API.
407  *
408  * Normally, this function doesn't need to be called. After this function is called, there's no
409  * longer a connection to the service, and the functions in this API can't be used. For details, see
410  * @ref apiFilesC_client.
411  *
412  * This function is created automatically.
413  */
414 //--------------------------------------------------------------------------------------------------
416 (
417  void
418 );
419 
420 
421 //--------------------------------------------------------------------------------------------------
422 /**
423  * Maximum DTMF string length.
424  */
425 //--------------------------------------------------------------------------------------------------
426 #define LE_AUDIO_DTMF_MAX_LEN 100
427 
428 //--------------------------------------------------------------------------------------------------
429 /**
430  * Maximum DTMF string length.
431  * One extra byte is added for the null character.
432  */
433 //--------------------------------------------------------------------------------------------------
434 #define LE_AUDIO_DTMF_MAX_BYTES 101
435 
436 //--------------------------------------------------------------------------------------------------
437 /**
438  * No file descriptor define
439  */
440 //--------------------------------------------------------------------------------------------------
441 #define LE_AUDIO_NO_FD -1
442 
443 //--------------------------------------------------------------------------------------------------
444 /**
445  * Maximum gain's name string length.
446  */
447 //--------------------------------------------------------------------------------------------------
448 #define LE_AUDIO_GAIN_NAME_MAX_LEN 100
449 
450 //--------------------------------------------------------------------------------------------------
451 /**
452  * Maximum gain's name string length.
453  * One extra byte is added for the null character.
454  */
455 //--------------------------------------------------------------------------------------------------
456 #define LE_AUDIO_GAIN_NAME_MAX_BYTES 101
457 
458 //--------------------------------------------------------------------------------------------------
459 /**
460  * Audio recording/playback events.
461  */
462 //--------------------------------------------------------------------------------------------------
463 typedef enum
464 {
466  ///< Playback has reached the end of file.
468  ///< No more audio samples to play.
470  ///< Recording/playback has encountered an error.
472  ///< Enumerate max value.
473 }
475 
476 
477 //--------------------------------------------------------------------------------------------------
478 /**
479  * Companding.
480  */
481 //--------------------------------------------------------------------------------------------------
482 typedef enum
483 {
485  ///< A-law PCM (i.e. Europe and most of the rest of the world).
487  ///< MU-law PCM (i.e. North America and Japan).
489  ///< Linear PCM.
490 }
492 
493 
494 //--------------------------------------------------------------------------------------------------
495 /**
496  * I2S channel mode.
497  */
498 //--------------------------------------------------------------------------------------------------
499 typedef enum
500 {
502  ///< Left channel.
504  ///< Right channel.
506  ///< Mono mode.
508  ///< Stereo mode.
510  ///< Reverse mode (left & right reversed).
511 }
513 
514 
515 //--------------------------------------------------------------------------------------------------
516 /**
517  * Audio format.
518  */
519 //--------------------------------------------------------------------------------------------------
520 typedef enum
521 {
523  ///< Waveform audio file
525  ///< Adaptive Multi Rate
526  LE_AUDIO_FORMAT_MAX = 2
527  ///<
528 }
530 
531 
532 //--------------------------------------------------------------------------------------------------
533 /**
534  * AMR mode.
535  */
536 //--------------------------------------------------------------------------------------------------
537 typedef enum
538 {
540  ///< Not set
542  ///< AMR Narrowband in 4.75kbps
544  ///< AMR Narrowband in 5.15kbps
546  ///< AMR Narrowband in 5.9kbps
548  ///< AMR Narrowband in 6.7kbps
550  ///< AMR Narrowband in 7.4kbps (default value)
552  ///< AMR Narrowband in 7.95kbps
554  ///< AMR Narrowband in 10.3kbps
556  ///< AMR Narrowband in 12.2kbps
558  ///< AMR Wideband in 6.6kbps
560  ///< AMR Wideband in 8.85kbps
562  ///< AMR Wideband in 12.65kbps
564  ///< AMR Wideband in 14.25kbps
566  ///< AMR Wideband in 15.85kbps
568  ///< AMR Wideband in 18.25kbps
570  ///< AMR Wideband in 19.85kbps
572  ///< AMR Wideband in 23.05kbps
574  ///< AMR Wideband in 23.85kbps
575 }
577 
578 
579 //--------------------------------------------------------------------------------------------------
580 /**
581  * Reference type for Audio Stream
582  */
583 //--------------------------------------------------------------------------------------------------
584 typedef struct le_audio_Stream* le_audio_StreamRef_t;
585 
586 
587 //--------------------------------------------------------------------------------------------------
588 /**
589  * Reference type for Audio Connector
590  */
591 //--------------------------------------------------------------------------------------------------
592 typedef struct le_audio_Connector* le_audio_ConnectorRef_t;
593 
594 
595 //--------------------------------------------------------------------------------------------------
596 /**
597  * Reference type used by Add/Remove functions for EVENT 'le_audio_Media'
598  */
599 //--------------------------------------------------------------------------------------------------
600 typedef struct le_audio_MediaHandler* le_audio_MediaHandlerRef_t;
601 
602 
603 //--------------------------------------------------------------------------------------------------
604 /**
605  * Reference type used by Add/Remove functions for EVENT 'le_audio_DtmfDetector'
606  */
607 //--------------------------------------------------------------------------------------------------
608 typedef struct le_audio_DtmfDetectorHandler* le_audio_DtmfDetectorHandlerRef_t;
609 
610 
611 //--------------------------------------------------------------------------------------------------
612 /**
613  * Handler for audio stream event.
614  *
615  */
616 //--------------------------------------------------------------------------------------------------
617 typedef void (*le_audio_MediaHandlerFunc_t)
618 (
619  le_audio_StreamRef_t streamRef,
620  ///< Audio stream reference.
621  le_audio_MediaEvent_t event,
622  ///< Event value.
623  void* contextPtr
624  ///<
625 );
626 
627 //--------------------------------------------------------------------------------------------------
628 /**
629  * Handler for DTMF decoding.
630  *
631  */
632 //--------------------------------------------------------------------------------------------------
634 (
635  le_audio_StreamRef_t streamRef,
636  ///< Audio stream reference.
637  char dtmf,
638  ///< Detected DTMF.
639  void* contextPtr
640  ///<
641 );
642 
643 //--------------------------------------------------------------------------------------------------
644 /**
645  * Open the Microphone.
646  *
647  * @return Reference to the input audio stream, NULL if the function fails.
648  */
649 //--------------------------------------------------------------------------------------------------
651 (
652  void
653 );
654 
655 //--------------------------------------------------------------------------------------------------
656 /**
657  * Open the Speakerphone.
658  *
659  * @return Reference to the output audio stream, NULL if the function fails.
660  */
661 //--------------------------------------------------------------------------------------------------
663 (
664  void
665 );
666 
667 //--------------------------------------------------------------------------------------------------
668 /**
669  * Open the received audio stream of an USB audio class.
670  *
671  * @return Reference to the input audio stream, NULL if the function fails.
672  */
673 //--------------------------------------------------------------------------------------------------
675 (
676  void
677 );
678 
679 //--------------------------------------------------------------------------------------------------
680 /**
681  * Open the transmitted audio stream of an USB audio class.
682  *
683  * @return Reference to the output audio stream, NULL if the function fails.
684  */
685 //--------------------------------------------------------------------------------------------------
687 (
688  void
689 );
690 
691 //--------------------------------------------------------------------------------------------------
692 /**
693  * Open the received audio stream of the PCM interface.
694  *
695  * @return Reference to the input audio stream, NULL if the function fails.
696  */
697 //--------------------------------------------------------------------------------------------------
699 (
700  uint32_t timeslot
701  ///< [IN] The time slot number.
702 );
703 
704 //--------------------------------------------------------------------------------------------------
705 /**
706  * Open the transmitted audio stream of the PCM interface.
707  *
708  * @return Reference to the output audio stream, NULL if the function fails.
709  */
710 //--------------------------------------------------------------------------------------------------
712 (
713  uint32_t timeslot
714  ///< [IN] The time slot number.
715 );
716 
717 //--------------------------------------------------------------------------------------------------
718 /**
719  * Open the received audio stream of the I2S interface.
720  *
721  * @return Reference to the input audio stream, NULL if the function fails.
722  */
723 //--------------------------------------------------------------------------------------------------
725 (
727  ///< [IN] The channel mode.
728 );
729 
730 //--------------------------------------------------------------------------------------------------
731 /**
732  * Open the transmitted audio stream of the I2S interface.
733  *
734  * @return Reference to the output audio stream, NULL if the function fails.
735  */
736 //--------------------------------------------------------------------------------------------------
738 (
740  ///< [IN] The channel mode.
741 );
742 
743 //--------------------------------------------------------------------------------------------------
744 /**
745  * Open the audio stream for playback.
746  *
747  * @return Reference to the audio stream, NULL if the function fails.
748  */
749 //--------------------------------------------------------------------------------------------------
751 (
752  void
753 );
754 
755 //--------------------------------------------------------------------------------------------------
756 /**
757  * Open the audio stream for recording.
758  *
759  * @return Reference to the audio stream, NULL if the function fails.
760  */
761 //--------------------------------------------------------------------------------------------------
763 (
764  void
765 );
766 
767 //--------------------------------------------------------------------------------------------------
768 /**
769  * Open the received audio stream of a voice call.
770  *
771  * @return Reference to the input audio stream, NULL if the function fails.
772  */
773 //--------------------------------------------------------------------------------------------------
775 (
776  void
777 );
778 
779 //--------------------------------------------------------------------------------------------------
780 /**
781  * Open the transmitted audio stream of a voice call.
782  *
783  * @return Reference to the output audio stream, NULL if the function fails.
784  */
785 //--------------------------------------------------------------------------------------------------
787 (
788  void
789 );
790 
791 //--------------------------------------------------------------------------------------------------
792 /**
793  * Add handler function for EVENT 'le_audio_Media'
794  *
795  * This event provides information on player / recorder stream events.
796  *
797  */
798 //--------------------------------------------------------------------------------------------------
800 (
801  le_audio_StreamRef_t streamRef,
802  ///< [IN] The audio stream reference.
803  le_audio_MediaHandlerFunc_t handlerPtr,
804  ///< [IN]
805  void* contextPtr
806  ///< [IN]
807 );
808 
809 //--------------------------------------------------------------------------------------------------
810 /**
811  * Remove handler function for EVENT 'le_audio_Media'
812  */
813 //--------------------------------------------------------------------------------------------------
815 (
816  le_audio_MediaHandlerRef_t handlerRef
817  ///< [IN]
818 );
819 
820 //--------------------------------------------------------------------------------------------------
821 /**
822  * Close an audio stream.
823  * If several users own the stream reference, the interface closes only after
824  * the last user closes the audio stream.
825  *
826  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
827  * function will not return.
828  */
829 //--------------------------------------------------------------------------------------------------
830 void le_audio_Close
831 (
832  le_audio_StreamRef_t streamRef
833  ///< [IN] Audio stream reference.
834 );
835 
836 //--------------------------------------------------------------------------------------------------
837 /**
838  * Set the Gain value of an input or output stream.
839  *
840  * @return LE_FAULT Function failed.
841  * @return LE_BAD_PARAMETER Audio stream reference is invalid.
842  * @return LE_OUT_OF_RANGE Gain value is out of range
843  * @return LE_OK Function succeeded.
844  *
845  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
846  * function will not return.
847  */
848 //--------------------------------------------------------------------------------------------------
850 (
851  le_audio_StreamRef_t streamRef,
852  ///< [IN] Audio stream reference.
853  int32_t gain
854  ///< [IN] Gain value (specific to the platform)
855 );
856 
857 //--------------------------------------------------------------------------------------------------
858 /**
859  * Get the Gain value of an input or output stream.
860  *
861  * @return LE_FAULT Function failed.
862  * @return LE_BAD_PARAMETER Audio stream reference is invalid.
863  * @return LE_OK Function succeeded.
864  *
865  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
866  * function will not return.
867  */
868 //--------------------------------------------------------------------------------------------------
870 (
871  le_audio_StreamRef_t streamRef,
872  ///< [IN] Audio stream reference.
873  int32_t* gainPtr
874  ///< [OUT] Gain value (specific to the platform)
875 );
876 
877 //--------------------------------------------------------------------------------------------------
878 /**
879  * Mute an audio stream.
880  *
881  * @return LE_FAULT Function failed.
882  * @return LE_BAD_PARAMETER Audio stream reference is invalid.
883  * @return LE_OK Function succeeded.
884  *
885  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
886  * function will not return.
887  */
888 //--------------------------------------------------------------------------------------------------
890 (
891  le_audio_StreamRef_t streamRef
892  ///< [IN] Audio stream reference.
893 );
894 
895 //--------------------------------------------------------------------------------------------------
896 /**
897  * Unmute an audio stream.
898  *
899  * @return LE_FAULT Function failed.
900  * @return LE_BAD_PARAMETER Audio stream reference is invalid.
901  * @return LE_OK Function succeeded.
902  *
903  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
904  * function will not return.
905  */
906 //--------------------------------------------------------------------------------------------------
908 (
909  le_audio_StreamRef_t streamRef
910  ///< [IN] Audio stream reference.
911 );
912 
913 //--------------------------------------------------------------------------------------------------
914 /**
915  * Create an audio connector reference.
916  *
917  * @return Reference to the audio connector, NULL if the function fails.
918  */
919 //--------------------------------------------------------------------------------------------------
921 (
922  void
923 );
924 
925 //--------------------------------------------------------------------------------------------------
926 /**
927  * Delete an audio connector reference.
928  *
929  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
930  * function will not return.
931  */
932 //--------------------------------------------------------------------------------------------------
934 (
935  le_audio_ConnectorRef_t connectorRef
936  ///< [IN] Connector reference.
937 );
938 
939 //--------------------------------------------------------------------------------------------------
940 /**
941  * Connect an audio stream to the connector reference.
942  *
943  * @return LE_FAULT Function failed.
944  * @return LE_BUSY Insufficient DSP resources available.
945  * @return LE_BAD_PARAMETER Connector and/or the audio stream references are invalid.
946  * @return LE_OK Function succeeded.
947  *
948  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
949  * function will not return.
950  */
951 //--------------------------------------------------------------------------------------------------
953 (
954  le_audio_ConnectorRef_t connectorRef,
955  ///< [IN] Connector reference.
956  le_audio_StreamRef_t streamRef
957  ///< [IN] Audio stream reference.
958 );
959 
960 //--------------------------------------------------------------------------------------------------
961 /**
962  * Disconnect an audio stream from the connector reference.
963  *
964  * @note If the caller is passing a bad reference into this function, it is a fatal error, the
965  * function will not return.
966  */
967 //--------------------------------------------------------------------------------------------------
969 (
970  le_audio_ConnectorRef_t connectorRef,
971  ///< [IN] Connector reference.
972  le_audio_StreamRef_t streamRef
973  ///< [IN] Audio stream reference.
974 );
975 
976 //--------------------------------------------------------------------------------------------------
977 /**
978  * Add handler function for EVENT 'le_audio_DtmfDetector'
979  *
980  * This event provides information on DTMF decoding for the specified streamRef
981  *
982  */
983 //--------------------------------------------------------------------------------------------------
985 (
986  le_audio_StreamRef_t streamRef,
987  ///< [IN] Audio stream reference.
989  ///< [IN]
990  void* contextPtr
991  ///< [IN]
992 );
993 
994 //--------------------------------------------------------------------------------------------------
995 /**
996  * Remove handler function for EVENT 'le_audio_DtmfDetector'
997  */
998 //--------------------------------------------------------------------------------------------------
1000 (
1002  ///< [IN]
1003 );
1004 
1005 //--------------------------------------------------------------------------------------------------
1006 /**
1007  * This function must be called to enable the Noise Suppressor.
1008  *
1009  * @return LE_FAULT Function failed.
1010  * @return LE_OK Function succeeded.
1011  *
1012  * @note The process exits, if an invalid audio stream reference is given.
1013  */
1014 //--------------------------------------------------------------------------------------------------
1016 (
1017  le_audio_StreamRef_t streamRef
1018  ///< [IN] Audio stream reference.
1019 );
1020 
1021 //--------------------------------------------------------------------------------------------------
1022 /**
1023  * This function must be called to disable the Noise Suppressor.
1024  *
1025  * @return LE_FAULT Function failed.
1026  * @return LE_OK Function succeeded.
1027  *
1028  * @note The process exits, if an invalid audio stream reference is given.
1029  */
1030 //--------------------------------------------------------------------------------------------------
1032 (
1033  le_audio_StreamRef_t streamRef
1034  ///< [IN] Audio stream reference.
1035 );
1036 
1037 //--------------------------------------------------------------------------------------------------
1038 /**
1039  * This function must be called to enable the Echo Canceller.
1040  *
1041  * @return LE_FAULT Function failed.
1042  * @return LE_OK Function succeeded.
1043  *
1044  * @note The process exits, if an invalid audio stream reference is given.
1045  */
1046 //--------------------------------------------------------------------------------------------------
1048 (
1049  le_audio_StreamRef_t streamRef
1050  ///< [IN] Audio stream reference.
1051 );
1052 
1053 //--------------------------------------------------------------------------------------------------
1054 /**
1055  * This function must be called to disable the Echo Canceller.
1056  *
1057  * @return LE_FAULT Function failed.
1058  * @return LE_OK Function succeeded.
1059  *
1060  * @note The process exits, if an invalid audio stream reference is given.
1061  */
1062 //--------------------------------------------------------------------------------------------------
1064 (
1065  le_audio_StreamRef_t streamRef
1066  ///< [IN] Audio stream reference.
1067 );
1068 
1069 //--------------------------------------------------------------------------------------------------
1070 /**
1071  * This function must be called to get the status of Noise Suppressor.
1072  *
1073  * @return LE_FAULT Function failed.
1074  * @return LE_BAD_PARAMETER If streamRef contains an invalid audioInterface.
1075  * @return LE_OK Function succeeded.
1076  *
1077  * @note The process exits, if an invalid audio stream reference is given.
1078  */
1079 //--------------------------------------------------------------------------------------------------
1081 (
1082  le_audio_StreamRef_t streamRef,
1083  ///< [IN] Audio stream reference.
1084  bool* statusPtr
1085  ///< [OUT] true if NS is enabled, false otherwise
1086 );
1087 
1088 //--------------------------------------------------------------------------------------------------
1089 /**
1090  * This function must be called to get the status of Echo Canceller.
1091  *
1092  * @return LE_FAULT Function failed.
1093  * @return LE_BAD_PARAMETER If streamRef contains an invalid audioInterface.
1094  * @return LE_OK Function succeeded.
1095  *
1096  * @note The process exits, if an invalid audio stream reference is given.
1097  */
1098 //--------------------------------------------------------------------------------------------------
1100 (
1101  le_audio_StreamRef_t streamRef,
1102  ///< [IN] Audio stream reference.
1103  bool* statusPtr
1104  ///< [OUT] true if EC is enabled, false otherwise
1105 );
1106 
1107 //--------------------------------------------------------------------------------------------------
1108 /**
1109  * This function must be called to enable the FIR (Finite Impulse Response) filter.
1110  *
1111  * @return LE_FAULT Function failed.
1112  * @return LE_OK Function succeeded.
1113  *
1114  * @note The process exits, if an invalid audio stream reference is given.
1115  */
1116 //--------------------------------------------------------------------------------------------------
1118 (
1119  le_audio_StreamRef_t streamRef
1120  ///< [IN] Audio stream reference.
1121 );
1122 
1123 //--------------------------------------------------------------------------------------------------
1124 /**
1125  * This function must be called to disable the FIR (Finite Impulse Response) filter.
1126  *
1127  * @return LE_FAULT Function failed.
1128  * @return LE_OK Function succeeded.
1129  *
1130  * @note The process exits, if an invalid audio stream reference is given.
1131  */
1132 //--------------------------------------------------------------------------------------------------
1134 (
1135  le_audio_StreamRef_t streamRef
1136  ///< [IN] Audio stream reference.
1137 );
1138 
1139 //--------------------------------------------------------------------------------------------------
1140 /**
1141  * This function must be called to enable the IIR (Infinite Impulse Response) filter.
1142  *
1143  * @return LE_FAULT Function failed.
1144  * @return LE_OK Function succeeded.
1145  *
1146  * @note The process exits, if an invalid audio stream reference is given.
1147  */
1148 //--------------------------------------------------------------------------------------------------
1150 (
1151  le_audio_StreamRef_t streamRef
1152  ///< [IN] Audio stream reference.
1153 );
1154 
1155 //--------------------------------------------------------------------------------------------------
1156 /**
1157  * This function must be called to disable the IIR (Infinite Impulse Response) filter.
1158  *
1159  * @return LE_FAULT Function failed.
1160  * @return LE_OK Function succeeded.
1161  *
1162  * @note The process exits, if an invalid audio stream reference is given.
1163  */
1164 //--------------------------------------------------------------------------------------------------
1166 (
1167  le_audio_StreamRef_t streamRef
1168  ///< [IN] Audio stream reference.
1169 );
1170 
1171 //--------------------------------------------------------------------------------------------------
1172 /**
1173  * This function must be called to enable the automatic gain control on the selected audio stream.
1174  *
1175  * @return LE_FAULT Function failed.
1176  * @return LE_OK Function succeeded.
1177  *
1178  * @note The process exits, if an invalid audio stream reference is given.
1179  */
1180 //--------------------------------------------------------------------------------------------------
1182 (
1183  le_audio_StreamRef_t streamRef
1184  ///< [IN] Audio stream reference.
1185 );
1186 
1187 //--------------------------------------------------------------------------------------------------
1188 /**
1189  * This function must be called to disable the automatic gain control on the selected audio stream.
1190  *
1191  * @return LE_FAULT Function failed.
1192  * @return LE_OK Function succeeded.
1193  *
1194  * @note The process exits, if an invalid audio stream reference is given.
1195  */
1196 //--------------------------------------------------------------------------------------------------
1198 (
1199  le_audio_StreamRef_t streamRef
1200  ///< [IN] Audio stream reference.
1201 );
1202 
1203 //--------------------------------------------------------------------------------------------------
1204 /**
1205  * This function must be called to set the audio profile.
1206  *
1207  * @return LE_FAULT Function failed.
1208  * @return LE_OK Function succeeded.
1209  *
1210  */
1211 //--------------------------------------------------------------------------------------------------
1213 (
1214  uint32_t profile
1215  ///< [IN] Audio profile.
1216 );
1217 
1218 //--------------------------------------------------------------------------------------------------
1219 /**
1220  * This function must be called to get the audio profile in use.
1221  *
1222  * @return LE_FAULT Function failed.
1223  * @return LE_OK Function succeeded.
1224  *
1225  */
1226 //--------------------------------------------------------------------------------------------------
1228 (
1229  uint32_t* profilePtr
1230  ///< [OUT] Audio profile.
1231 );
1232 
1233 //--------------------------------------------------------------------------------------------------
1234 /**
1235  * Configure the PCM Sampling Rate.
1236  *
1237  * @return LE_FAULT Function failed.
1238  * @return LE_OUT_OF_RANGE Your platform does not support the setting's value.
1239  * @return LE_BUSY PCM interface is already active.
1240  * @return LE_OK Function succeeded.
1241  */
1242 //--------------------------------------------------------------------------------------------------
1244 (
1245  uint32_t rate
1246  ///< [IN] Sampling rate in Hz.
1247 );
1248 
1249 //--------------------------------------------------------------------------------------------------
1250 /**
1251  * Configure the PCM Sampling Resolution.
1252  *
1253  * @return LE_FAULT Function failed.
1254  * @return LE_OUT_OF_RANGE Your platform does not support the setting's value.
1255  * @return LE_BUSY PCM interface is already active.
1256  * @return LE_OK Function succeeded.
1257  */
1258 //--------------------------------------------------------------------------------------------------
1260 (
1261  uint32_t bitsPerSample
1262  ///< [IN] Sampling resolution (bits/sample).
1263 );
1264 
1265 //--------------------------------------------------------------------------------------------------
1266 /**
1267  * Configure the PCM Companding.
1268  *
1269  * @return LE_FAULT Function failed.
1270  * @return LE_OUT_OF_RANGE Your platform does not support the setting's value.
1271  * @return LE_BUSY PCM interface is already active.
1272  * @return LE_OK Function succeeded.
1273  */
1274 //--------------------------------------------------------------------------------------------------
1276 (
1277  le_audio_Companding_t companding
1278  ///< [IN] Companding.
1279 );
1280 
1281 //--------------------------------------------------------------------------------------------------
1282 /**
1283  * Retrieve the PCM Sampling Rate.
1284  *
1285  * @return The sampling rate in Hz.
1286  */
1287 //--------------------------------------------------------------------------------------------------
1289 (
1290  void
1291 );
1292 
1293 //--------------------------------------------------------------------------------------------------
1294 /**
1295  * Retrieve the PCM Sampling Resolution.
1296  *
1297  * @return The sampling resolution (bits/sample).
1298  */
1299 //--------------------------------------------------------------------------------------------------
1301 (
1302  void
1303 );
1304 
1305 //--------------------------------------------------------------------------------------------------
1306 /**
1307  * Retrieve the PCM Companding.
1308  *
1309  * @return The PCM companding.
1310  */
1311 //--------------------------------------------------------------------------------------------------
1313 (
1314  void
1315 );
1316 
1317 //--------------------------------------------------------------------------------------------------
1318 /**
1319  * Get the default PCM time slot used on the current platform.
1320  *
1321  * @return the time slot number.
1322  */
1323 //--------------------------------------------------------------------------------------------------
1325 (
1326  void
1327 );
1328 
1329 //--------------------------------------------------------------------------------------------------
1330 /**
1331  * Get the default I2S channel mode used on the current platform.
1332  *
1333  * @return the I2S channel mode.
1334  */
1335 //--------------------------------------------------------------------------------------------------
1337 (
1338  void
1339 );
1340 
1341 //--------------------------------------------------------------------------------------------------
1342 /**
1343  * Play a file on a playback stream.
1344  *
1345  * @return LE_FAULT Function failed.
1346  * @return LE_BAD_PARAMETER Audio stream reference is invalid.
1347  * @return LE_BUSY Player interface is already active.
1348  * @return LE_OK Function succeeded.
1349  *
1350  * @note
1351  * - The fd is closed by the IPC API. To play again the same file, the fd parameter can be set
1352  * to LE_AUDIO_NO_FD: in this case, the previous file descriptor is re-used.
1353  * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using
1354  * dup() ) before calling the API.
1355  * In that case, the old and new file descriptors refer to the same open file description and
1356  * thus share file offset. So, once a playback has reached the end of file, the application must
1357  * reset the file offset by using lseek on the duplicated descriptor to start the playback from
1358  * the beginning.
1359  *
1360  * @note
1361  * - Calling le_audio_PlayFile(<..>, LE_AUDIO_NO_FD) will rewind the audio file to the
1362  * beginning when a playback is already in progress.
1363  *
1364  */
1365 //--------------------------------------------------------------------------------------------------
1367 (
1368  le_audio_StreamRef_t streamRef,
1369  ///< [IN] Audio stream reference.
1370  int fd
1371  ///< [IN] File descriptor.
1372 );
1373 
1374 //--------------------------------------------------------------------------------------------------
1375 /**
1376  * Initiate a playback sending samples over a pipe.
1377  *
1378  * @return LE_FAULT Function failed.
1379  * @return LE_BUSY Player interface is already active.
1380  * @return LE_OK Function succeeded.
1381  *
1382  * @note the fd is closed by the IPC API. To use again the same pipe, the fd parameter can be set
1383  * to LE_AUDIO_NO_FD: in this case, the previous file descriptor is re-used.
1384  * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )
1385  * before calling the API.
1386  *
1387  */
1388 //--------------------------------------------------------------------------------------------------
1390 (
1391  le_audio_StreamRef_t streamRef,
1392  ///< [IN] Audio stream reference.
1393  int fd
1394  ///< [IN] File descriptor.
1395 );
1396 
1397 //--------------------------------------------------------------------------------------------------
1398 /**
1399  * Record a file on a recorder stream.
1400  *
1401  * @return LE_FAULT Function failed.
1402  * @return LE_BAD_PARAMETER The audio stream reference is invalid.
1403  * @return LE_BUSY Recorder interface is already active.
1404  * @return LE_OK Function succeeded.
1405  *
1406  * @note the fd is closed by the API. To record again the same file, the fd parameter can be set to
1407  * LE_AUDIO_NO_FD: in this case, the previous file descriptor is re-used.
1408  * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )
1409  * before calling the API.
1410  *
1411  */
1412 //--------------------------------------------------------------------------------------------------
1414 (
1415  le_audio_StreamRef_t streamRef,
1416  ///< [IN] Audio stream reference.
1417  int fd
1418  ///< [IN] File descriptor.
1419 );
1420 
1421 //--------------------------------------------------------------------------------------------------
1422 /**
1423  * Get samples from a recorder stream.
1424  *
1425  * @return LE_FAULT Function failed.
1426  * @return LE_BUSY Recorder interface is already active.
1427  * @return LE_OK Function succeeded.
1428  *
1429  * @note the fd is closed by the API. To use again the same pipe, the fd parameter can be set to
1430  * LE_AUDIO_NO_FD: in this case, the previous file descriptor is re-used.
1431  * If the fd as to be kept on its side, the application should duplicate the fd (e.g., using dup() )
1432  * before calling the API.
1433  */
1434 //--------------------------------------------------------------------------------------------------
1436 (
1437  le_audio_StreamRef_t streamRef,
1438  ///< [IN] Audio stream reference.
1439  int fd
1440  ///< [IN] File descriptor.
1441 );
1442 
1443 //--------------------------------------------------------------------------------------------------
1444 /**
1445  * Stop the file playback/recording.
1446  *
1447  * @return LE_FAULT Function failed.
1448  * @return LE_OK Function succeeded.
1449  *
1450  * @note The used file descriptor is not deallocated, but is is rewound to the beginning.
1451  *
1452  */
1453 //--------------------------------------------------------------------------------------------------
1455 (
1456  le_audio_StreamRef_t streamRef
1457  ///< [IN] Audio stream reference.
1458 );
1459 
1460 //--------------------------------------------------------------------------------------------------
1461 /**
1462  * Pause the file playback/recording.
1463  *
1464  * @return LE_FAULT Function failed.
1465  * @return LE_OK Function succeeded.
1466  *
1467  */
1468 //--------------------------------------------------------------------------------------------------
1470 (
1471  le_audio_StreamRef_t streamRef
1472  ///< [IN] Audio stream reference.
1473 );
1474 
1475 //--------------------------------------------------------------------------------------------------
1476 /**
1477  * Flush the remaining audio samples.
1478  *
1479  * @return LE_FAULT Function failed.
1480  * @return LE_OK Function succeeded.
1481  *
1482  */
1483 //--------------------------------------------------------------------------------------------------
1485 (
1486  le_audio_StreamRef_t streamRef
1487  ///< [IN] Audio stream reference.
1488 );
1489 
1490 //--------------------------------------------------------------------------------------------------
1491 /**
1492  * Resume a file playback/recording (need to be in pause state).
1493  *
1494  * @return LE_FAULT Function failed.
1495  * @return LE_OK Function succeeded.
1496  *
1497  */
1498 //--------------------------------------------------------------------------------------------------
1500 (
1501  le_audio_StreamRef_t streamRef
1502  ///< [IN] Audio stream reference.
1503 );
1504 
1505 //--------------------------------------------------------------------------------------------------
1506 /**
1507  * Set the channel number of a PCM sample.
1508  *
1509  * @return LE_FAULT Function failed.
1510  * @return LE_OK Function succeeded.
1511  *
1512  */
1513 //--------------------------------------------------------------------------------------------------
1515 (
1516  le_audio_StreamRef_t streamRef,
1517  ///< [IN] Audio stream reference.
1518  uint32_t nbChannel
1519  ///< [IN] Channel Number
1520 );
1521 
1522 //--------------------------------------------------------------------------------------------------
1523 /**
1524  * Get the channel number of a PCM sample.
1525  *
1526  * @return LE_FAULT Function failed.
1527  * @return LE_OK Function succeeded.
1528  *
1529  */
1530 //--------------------------------------------------------------------------------------------------
1532 (
1533  le_audio_StreamRef_t streamRef,
1534  ///< [IN] Audio stream reference.
1535  uint32_t* nbChannelPtr
1536  ///< [OUT] Channel Number
1537 );
1538 
1539 //--------------------------------------------------------------------------------------------------
1540 /**
1541  * Set the PCM sampling rate of a PCM sample.
1542  *
1543  * @return LE_FAULT Function failed.
1544  * @return LE_OK Function succeeded.
1545  *
1546  */
1547 //--------------------------------------------------------------------------------------------------
1549 (
1550  le_audio_StreamRef_t streamRef,
1551  ///< [IN] Audio stream reference.
1552  uint32_t rate
1553  ///< [IN] PCM sampling Rate.
1554 );
1555 
1556 //--------------------------------------------------------------------------------------------------
1557 /**
1558  * Get the PCM sampling rate of a PCM sample.
1559  *
1560  * @return LE_FAULT Function failed.
1561  * @return LE_OK Function succeeded.
1562  *
1563  */
1564 //--------------------------------------------------------------------------------------------------
1566 (
1567  le_audio_StreamRef_t streamRef,
1568  ///< [IN] Audio stream reference.
1569  uint32_t* ratePtr
1570  ///< [OUT] PCM sampling Rate.
1571 );
1572 
1573 //--------------------------------------------------------------------------------------------------
1574 /**
1575  * Set the sampling resolution (in bits per sample) of a PCM sample.
1576  *
1577  * @return LE_FAULT Function failed.
1578  * @return LE_OK Function succeeded.
1579  *
1580  */
1581 //--------------------------------------------------------------------------------------------------
1583 (
1584  le_audio_StreamRef_t streamRef,
1585  ///< [IN] Audio stream reference.
1586  uint32_t samplingRes
1587  ///< [IN] Sampling resolution (in bits per sample).
1588 );
1589 
1590 //--------------------------------------------------------------------------------------------------
1591 /**
1592  * Get the sampling resolution (in bits per sample) of a PCM sample.
1593  *
1594  * @return LE_FAULT Function failed.
1595  * @return LE_OK Function succeeded.
1596  *
1597  */
1598 //--------------------------------------------------------------------------------------------------
1600 (
1601  le_audio_StreamRef_t streamRef,
1602  ///< [IN] Audio stream reference.
1603  uint32_t* samplingResPtr
1604  ///< [OUT] Sampling resolution (in bits per sample).
1605 );
1606 
1607 //--------------------------------------------------------------------------------------------------
1608 /**
1609  * This function must be called to play a DTMF on a specific audio stream.
1610  *
1611  * @return LE_FORMAT_ERROR The DTMF characters are invalid.
1612  * @return LE_BUSY A DTMF playback is already in progress on the playback stream.
1613  * @return LE_FAULT Function failed to play the DTMFs.
1614  * @return LE_OK Funtion succeeded.
1615  *
1616  * @note If the DTMF string is too long (max DTMF_MAX_LEN characters), it is a fatal
1617  * error, the function will not return.
1618  * @note The process exits, if an invalid audio stream reference is given.
1619  */
1620 //--------------------------------------------------------------------------------------------------
1622 (
1623  le_audio_StreamRef_t streamRef,
1624  ///< [IN] Audio stream reference.
1625  const char* dtmf,
1626  ///< [IN] DTMFs to play.
1627  uint32_t duration,
1628  ///< [IN] DTMF duration in milliseconds.
1629  uint32_t pause
1630  ///< [IN] Pause duration between tones in milliseconds.
1631 )
1632 __attribute__(( nonnull(2) ));
1633 
1634 //--------------------------------------------------------------------------------------------------
1635 /**
1636  * This function must be called to ask to the Mobile Network to generate on the remote audio party
1637  * the DTMFs.
1638  *
1639  * @return LE_FORMAT_ERROR The DTMF characters are invalid.
1640  * @return LE_BUSY A DTMF playback is in progress.
1641  * @return LE_FAULT Function failed.
1642  * @return LE_OK Funtion succeeded.
1643  *
1644  * @note If the DTMF string is too long (max DTMF_MAX_LEN characters), it is a fatal
1645  * error, the function will not return.
1646  */
1647 //--------------------------------------------------------------------------------------------------
1649 (
1650  const char* dtmf,
1651  ///< [IN] DTMFs to play.
1652  uint32_t duration,
1653  ///< [IN] DTMF duration in milliseconds.
1654  uint32_t pause
1655  ///< [IN] Pause duration between tones in milliseconds.
1656 )
1657 __attribute__(( nonnull(1) ));
1658 
1659 //--------------------------------------------------------------------------------------------------
1660 /**
1661  * Set the encoding format of a recorder stream.
1662  *
1663  * @return LE_FAULT Function failed.
1664  * @return LE_OK Function succeeded.
1665  *
1666  */
1667 //--------------------------------------------------------------------------------------------------
1669 (
1670  le_audio_StreamRef_t streamRef,
1671  ///< [IN] Audio stream reference.
1672  le_audio_Format_t format
1673  ///< [IN] Encoding format.
1674 );
1675 
1676 //--------------------------------------------------------------------------------------------------
1677 /**
1678  * Get the encoding format of a recorder stream.
1679  *
1680  * @return LE_FAULT Function failed.
1681  * @return LE_OK Function succeeded.
1682  *
1683  */
1684 //--------------------------------------------------------------------------------------------------
1686 (
1687  le_audio_StreamRef_t streamRef,
1688  ///< [IN] Audio stream reference.
1689  le_audio_Format_t* formatPtr
1690  ///< [OUT] Encoding format.
1691 );
1692 
1693 //--------------------------------------------------------------------------------------------------
1694 /**
1695  * Set the AMR mode for AMR encoder.
1696  *
1697  * @return LE_FAULT Function failed.
1698  * @return LE_OK Function succeeded.
1699  *
1700  */
1701 //--------------------------------------------------------------------------------------------------
1703 (
1704  le_audio_StreamRef_t streamRef,
1705  ///< [IN] Audio stream reference.
1706  le_audio_AmrMode_t mode
1707  ///< [IN] AMR mode.
1708 );
1709 
1710 //--------------------------------------------------------------------------------------------------
1711 /**
1712  * Get the AMR mode for AMR encoder.
1713  *
1714  * @return LE_FAULT Function failed.
1715  * @return LE_OK Function succeeded.
1716  *
1717  */
1718 //--------------------------------------------------------------------------------------------------
1720 (
1721  le_audio_StreamRef_t streamRef,
1722  ///< [IN] Audio stream reference.
1723  le_audio_AmrMode_t* modePtr
1724  ///< [OUT] AMR mode.
1725 );
1726 
1727 //--------------------------------------------------------------------------------------------------
1728 /**
1729  * Set the AMR discontinuous transmission (DTX). The DTX is activated by default.
1730  *
1731  * @return LE_FAULT Function failed.
1732  * @return LE_OK Function succeeded.
1733  *
1734  */
1735 //--------------------------------------------------------------------------------------------------
1737 (
1738  le_audio_StreamRef_t streamRef,
1739  ///< [IN] Audio stream reference.
1740  bool dtx
1741  ///< [IN] DTX.
1742 );
1743 
1744 //--------------------------------------------------------------------------------------------------
1745 /**
1746  * Get the AMR discontinuous transmission (DTX) value.
1747  *
1748  * @return LE_FAULT Function failed.
1749  * @return LE_OK Function succeeded.
1750  *
1751  */
1752 //--------------------------------------------------------------------------------------------------
1754 (
1755  le_audio_StreamRef_t streamRef,
1756  ///< [IN] Audio stream reference.
1757  bool* dtxPtr
1758  ///< [OUT] DTX.
1759 );
1760 
1761 //--------------------------------------------------------------------------------------------------
1762 /**
1763  * Set the value of a platform specific gain in the audio subsystem.
1764  *
1765  * @return LE_FAULT The function failed.
1766  * @return LE_NOT_FOUND The specified gain's name is not recognized in your audio subsystem.
1767  * @return LE_OUT_OF_RANGE The gain parameter is out of range
1768  * @return LE_OK The function succeeded.
1769  *
1770  * @warning Ensure to check the names of supported gains for your specific platform.
1771  */
1772 //--------------------------------------------------------------------------------------------------
1774 (
1775  const char* gainName,
1776  ///< [IN] Name of the platform specific gain.
1777  int32_t gain
1778  ///< [IN] The gain value (specific to the platform)
1779 )
1780 __attribute__(( nonnull(1) ));
1781 
1782 //--------------------------------------------------------------------------------------------------
1783 /**
1784  * Get the value of a platform specific gain in the audio subsystem.
1785  *
1786  * @return LE_FAULT The function failed.
1787  * @return LE_NOT_FOUND The specified gain's name is not recognized in your audio subsystem.
1788  * @return LE_OK The function succeeded.
1789  *
1790  * @warning Ensure to check the names of supported gains for your specific platform.
1791  */
1792 //--------------------------------------------------------------------------------------------------
1794 (
1795  const char* gainName,
1796  ///< [IN] Name of the platform specific gain.
1797  int32_t* gainPtr
1798  ///< [OUT] The gain value (specific to the platform)
1799 )
1800 __attribute__(( nonnull(1) ));
1801 
1802 //--------------------------------------------------------------------------------------------------
1803 /**
1804  * Mute the Call Waiting Tone.
1805  *
1806  * @return LE_FAULT The function failed.
1807  * @return LE_OK The function succeeded.
1808  */
1809 //--------------------------------------------------------------------------------------------------
1811 (
1812  void
1813 );
1814 
1815 //--------------------------------------------------------------------------------------------------
1816 /**
1817  * Unmute the Call Waiting Tone.
1818  *
1819  * @return LE_FAULT The function failed.
1820  * @return LE_OK The function succeeded.
1821  */
1822 //--------------------------------------------------------------------------------------------------
1824 (
1825  void
1826 );
1827 
1828 #endif // LE_AUDIO_INTERFACE_H_INCLUDE_GUARD
le_result_t le_audio_SetSamplePcmSamplingRate(le_audio_StreamRef_t streamRef, uint32_t rate)
le_result_t le_audio_GetSamplePcmSamplingRate(le_audio_StreamRef_t streamRef, uint32_t *ratePtr)
le_result_t le_audio_DisableNoiseSuppressor(le_audio_StreamRef_t streamRef)
Linear PCM.
Definition: le_audio_interface.h:488
le_result_t le_audio_Pause(le_audio_StreamRef_t streamRef)
le_result_t le_audio_PlayDtmf(le_audio_StreamRef_t streamRef, const char *dtmf, uint32_t duration, uint32_t pause)
uint32_t le_audio_GetPcmSamplingResolution(void)
le_result_t le_audio_SetSamplePcmChannelNumber(le_audio_StreamRef_t streamRef, uint32_t nbChannel)
void le_audio_RemoveMediaHandler(le_audio_MediaHandlerRef_t handlerRef)
le_result_t le_audio_GetSamplePcmChannelNumber(le_audio_StreamRef_t streamRef, uint32_t *nbChannelPtr)
le_result_t le_audio_DisableEchoCanceller(le_audio_StreamRef_t streamRef)
le_result_t le_audio_SetPcmSamplingRate(uint32_t rate)
le_result_t le_audio_RecordFile(le_audio_StreamRef_t streamRef, int fd)
MU-law PCM (i.e. North America and Japan).
Definition: le_audio_interface.h:486
le_result_t
Definition: le_basics.h:35
le_audio_StreamRef_t le_audio_OpenModemVoiceTx(void)
le_result_t le_audio_IsEchoCancellerEnabled(le_audio_StreamRef_t streamRef, bool *statusPtr)
le_audio_MediaEvent_t
Definition: le_audio_interface.h:463
le_result_t le_audio_GetSampleAmrDtx(le_audio_StreamRef_t streamRef, bool *dtxPtr)
AMR Wideband in 14.25kbps.
Definition: le_audio_interface.h:563
le_audio_StreamRef_t le_audio_OpenI2sTx(le_audio_I2SChannel_t mode)
void le_audio_RemoveDtmfDetectorHandler(le_audio_DtmfDetectorHandlerRef_t handlerRef)
le_audio_StreamRef_t le_audio_OpenI2sRx(le_audio_I2SChannel_t mode)
le_result_t le_audio_GetSamples(le_audio_StreamRef_t streamRef, int fd)
le_result_t le_audio_Flush(le_audio_StreamRef_t streamRef)
le_result_t le_audio_DisableIirFilter(le_audio_StreamRef_t streamRef)
struct le_audio_Stream * le_audio_StreamRef_t
Definition: le_audio_interface.h:584
AMR Narrowband in 7.4kbps (default value)
Definition: le_audio_interface.h:549
Waveform audio file.
Definition: le_audio_interface.h:522
le_result_t le_audio_GetProfile(uint32_t *profilePtr)
le_result_t le_audio_TryConnectService(void)
le_audio_StreamRef_t le_audio_OpenUsbTx(void)
Reverse mode (left & right reversed).
Definition: le_audio_interface.h:509
le_result_t le_audio_Connect(le_audio_ConnectorRef_t connectorRef, le_audio_StreamRef_t streamRef)
le_result_t le_audio_Unmute(le_audio_StreamRef_t streamRef)
void(* le_audio_DtmfDetectorHandlerFunc_t)(le_audio_StreamRef_t streamRef, char dtmf, void *contextPtr)
Definition: le_audio_interface.h:634
AMR Wideband in 8.85kbps.
Definition: le_audio_interface.h:559
le_audio_StreamRef_t le_audio_OpenSpeaker(void)
struct le_audio_Connector * le_audio_ConnectorRef_t
Definition: le_audio_interface.h:592
Not set.
Definition: le_audio_interface.h:539
le_result_t le_audio_GetPlatformSpecificGain(const char *gainName, int32_t *gainPtr)
le_audio_Format_t
Definition: le_audio_interface.h:520
AMR Narrowband in 6.7kbps.
Definition: le_audio_interface.h:547
Enumerate max value.
Definition: le_audio_interface.h:471
le_result_t le_audio_EnableFirFilter(le_audio_StreamRef_t streamRef)
AMR Narrowband in 4.75kbps.
Definition: le_audio_interface.h:541
uint32_t le_audio_GetPcmSamplingRate(void)
Adaptive Multi Rate.
Definition: le_audio_interface.h:524
le_result_t le_audio_MuteCallWaitingTone(void)
le_result_t le_audio_PlaySamples(le_audio_StreamRef_t streamRef, int fd)
le_audio_I2SChannel_t le_audio_GetDefaultI2sMode(void)
struct le_audio_DtmfDetectorHandler * le_audio_DtmfDetectorHandlerRef_t
Definition: le_audio_interface.h:608
AMR Narrowband in 10.3kbps.
Definition: le_audio_interface.h:553
le_result_t le_audio_DisableAutomaticGainControl(le_audio_StreamRef_t streamRef)
le_audio_ConnectorRef_t le_audio_CreateConnector(void)
AMR Narrowband in 5.9kbps.
Definition: le_audio_interface.h:545
le_result_t le_audio_PlayFile(le_audio_StreamRef_t streamRef, int fd)
le_audio_StreamRef_t le_audio_OpenPcmTx(uint32_t timeslot)
le_result_t le_audio_SetPcmCompanding(le_audio_Companding_t companding)
le_result_t le_audio_GetSamplePcmSamplingResolution(le_audio_StreamRef_t streamRef, uint32_t *samplingResPtr)
AMR Wideband in 23.85kbps.
Definition: le_audio_interface.h:573
le_result_t le_audio_IsNoiseSuppressorEnabled(le_audio_StreamRef_t streamRef, bool *statusPtr)
le_audio_AmrMode_t
Definition: le_audio_interface.h:537
le_result_t le_audio_SetProfile(uint32_t profile)
AMR Wideband in 18.25kbps.
Definition: le_audio_interface.h:567
le_audio_StreamRef_t le_audio_OpenModemVoiceRx(void)
AMR Narrowband in 5.15kbps.
Definition: le_audio_interface.h:543
le_audio_StreamRef_t le_audio_OpenRecorder(void)
le_result_t le_audio_Resume(le_audio_StreamRef_t streamRef)
void(* le_audio_DisconnectHandler_t)(void *)
Definition: le_audio_interface.h:344
void le_audio_Close(le_audio_StreamRef_t streamRef)
AMR Wideband in 6.6kbps.
Definition: le_audio_interface.h:557
AMR Narrowband in 12.2kbps.
Definition: le_audio_interface.h:555
A-law PCM (i.e. Europe and most of the rest of the world).
Definition: le_audio_interface.h:484
AMR Narrowband in 7.95kbps.
Definition: le_audio_interface.h:551
le_audio_StreamRef_t le_audio_OpenPlayer(void)
void le_audio_DisconnectService(void)
uint32_t le_audio_GetDefaultPcmTimeSlot(void)
le_result_t le_audio_Stop(le_audio_StreamRef_t streamRef)
le_result_t le_audio_SetGain(le_audio_StreamRef_t streamRef, int32_t gain)
le_audio_StreamRef_t le_audio_OpenPcmRx(uint32_t timeslot)
le_audio_I2SChannel_t
Definition: le_audio_interface.h:499
AMR Wideband in 12.65kbps.
Definition: le_audio_interface.h:561
AMR Wideband in 23.05kbps.
Definition: le_audio_interface.h:571
Mono mode.
Definition: le_audio_interface.h:505
le_result_t le_audio_SetPcmSamplingResolution(uint32_t bitsPerSample)
struct le_audio_MediaHandler * le_audio_MediaHandlerRef_t
Definition: le_audio_interface.h:600
AMR Wideband in 15.85kbps.
Definition: le_audio_interface.h:565
le_result_t le_audio_SetEncodingFormat(le_audio_StreamRef_t streamRef, le_audio_Format_t format)
le_audio_StreamRef_t le_audio_OpenUsbRx(void)
le_result_t le_audio_EnableEchoCanceller(le_audio_StreamRef_t streamRef)
le_result_t le_audio_SetSampleAmrMode(le_audio_StreamRef_t streamRef, le_audio_AmrMode_t mode)
Stereo mode.
Definition: le_audio_interface.h:507
le_result_t le_audio_DisableFirFilter(le_audio_StreamRef_t streamRef)
Recording/playback has encountered an error.
Definition: le_audio_interface.h:469
le_result_t le_audio_PlaySignallingDtmf(const char *dtmf, uint32_t duration, uint32_t pause)
Right channel.
Definition: le_audio_interface.h:503
void le_audio_ConnectService(void)
le_audio_Companding_t
Definition: le_audio_interface.h:482
le_result_t le_audio_GetGain(le_audio_StreamRef_t streamRef, int32_t *gainPtr)
le_result_t le_audio_SetSampleAmrDtx(le_audio_StreamRef_t streamRef, bool dtx)
void le_audio_SetServerDisconnectHandler(le_audio_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_result_t le_audio_SetPlatformSpecificGain(const char *gainName, int32_t gain)
le_result_t le_audio_SetSamplePcmSamplingResolution(le_audio_StreamRef_t streamRef, uint32_t samplingRes)
Playback has reached the end of file.
Definition: le_audio_interface.h:465
le_audio_MediaHandlerRef_t le_audio_AddMediaHandler(le_audio_StreamRef_t streamRef, le_audio_MediaHandlerFunc_t handlerPtr, void *contextPtr)
AMR Wideband in 19.85kbps.
Definition: le_audio_interface.h:569
le_result_t le_audio_GetEncodingFormat(le_audio_StreamRef_t streamRef, le_audio_Format_t *formatPtr)
Left channel.
Definition: le_audio_interface.h:501
le_audio_Companding_t le_audio_GetPcmCompanding(void)
le_audio_DtmfDetectorHandlerRef_t le_audio_AddDtmfDetectorHandler(le_audio_StreamRef_t streamRef, le_audio_DtmfDetectorHandlerFunc_t handlerPtr, void *contextPtr)
void le_audio_Disconnect(le_audio_ConnectorRef_t connectorRef, le_audio_StreamRef_t streamRef)
void le_audio_DeleteConnector(le_audio_ConnectorRef_t connectorRef)
No more audio samples to play.
Definition: le_audio_interface.h:467
le_result_t le_audio_EnableNoiseSuppressor(le_audio_StreamRef_t streamRef)
le_result_t le_audio_UnmuteCallWaitingTone(void)
le_result_t le_audio_GetSampleAmrMode(le_audio_StreamRef_t streamRef, le_audio_AmrMode_t *modePtr)
le_audio_StreamRef_t le_audio_OpenMic(void)
void(* le_audio_MediaHandlerFunc_t)(le_audio_StreamRef_t streamRef, le_audio_MediaEvent_t event, void *contextPtr)
Definition: le_audio_interface.h:618
le_result_t le_audio_EnableIirFilter(le_audio_StreamRef_t streamRef)
le_result_t le_audio_EnableAutomaticGainControl(le_audio_StreamRef_t streamRef)
le_result_t le_audio_Mute(le_audio_StreamRef_t streamRef)