le_audio_interface.h

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