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