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