version 2.8
gaudio_driver_record.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.org/license.html
6  */
7 
8 /**
9  * @file src/gaudio/gaudio_driver_record.h
10  * @brief GAUDIO - Audio Recording driver header file.
11  *
12  * @defgroup GAUDIO_Driver_Record Driver Recording
13  * @ingroup GAUDIO
14  *
15  * @brief Recording driver interface for the GAUDIO module.
16  *
17  * @{
18  */
19 
20 #ifndef _GAUDIO_RECORD_LLD_H
21 #define _GAUDIO_RECORD_LLD_H
22 
23 #include "../../gfx.h"
24 
25 #if (GFX_USE_GAUDIO && GAUDIO_NEED_RECORD) || defined(__DOXYGEN__)
26 
27 /*===========================================================================*/
28 /* Type definitions */
29 /*===========================================================================*/
30 
31 /**
32  * @brief Get a free block of audio data that we can record into
33  * @return A pointer to the GAaudioData structure or NULL if none is currently available
34  *
35  * @note Defined in the high level GAUDIO code for use by the GAUDIO record drivers.
36  *
37  * @iclass
38  * @notapi
39  */
40 #define gaudioRecordGetFreeBlockI() gfxBufferGetI()
41 
42 /**
43  * @brief Save a block of recorded audio data ready for the application
44  *
45  * @param[in] paud The GDataBuffer block with data.
46  *
47  * @note Defined in the high level GAUDIO code for use by the GAUDIO record drivers.
48  *
49  * @iclass
50  * @notapi
51  */
53 
54 /**
55  * @brief Signal that all recording has now stopped
56  *
57  * @note Defined in the high level GAUDIO code for use by the GAUDIO record drivers.
58  *
59  * @iclass
60  * @notapi
61  */
62 void gaudioRecordDoneI(void);
63 
64 /*===========================================================================*/
65 /* External declarations. */
66 /*===========================================================================*/
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 /**
73  * @brief Initialise the record driver
74  * @return TRUE if the channel, frequency and format are valid.
75  *
76  * @param[in] channel The channel to use (see the driver for the available channels provided)
77  * @param[in] frequency The sample frequency to use
78  * @param[in] format The sample format
79  *
80  * @note The driver will always have been stopped and de-init before this is called.
81  *
82  * @api
83  */
84 bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format);
85 
86 /**
87  * @brief Start the audio recording
88  *
89  * @api
90  */
91 void gaudio_record_lld_start(void);
92 
93 /**
94  * @brief Stop the audio recording.
95  *
96  * @note Some drivers may only stop recording at a data block boundary.
97  * @note This routine should not return until any currently active buffers have been
98  * saved (even if with zero length) and @p gaudioRecordDoneI() has been called.
99  *
100  * @api
101  */
102 void gaudio_record_lld_stop(void);
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */
109 
110 #endif /* _GAUDIO_RECORD_LLD_H */
111 /** @} */
A Data Buffer Queue.
Definition: gqueue.h:78
void gaudio_record_lld_start(void)
Start the audio recording.
void gaudioRecordSaveDataBlockI(GDataBuffer *paud)
Save a block of recorded audio data ready for the application.
void gaudio_record_lld_stop(void)
Stop the audio recording.
void gaudioRecordDoneI(void)
Signal that all recording has now stopped.
bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format)
Initialise the record driver.
enum ArrayDataFormat_e ArrayDataFormat
Sample data formats.