aboutsummaryrefslogtreecommitdiffstats
path: root/src/gaudout/sys_defs.h
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-03-05 13:45:37 +1000
committerinmarket <andrewh@inmarket.com.au>2014-03-05 13:45:37 +1000
commite762e91bd5d5347071c3b43fbdb021376584c267 (patch)
treefdb17e76a67cc9eb163735dd7adf5d2911fd27ee /src/gaudout/sys_defs.h
parent68a0be8110d2dea408890f819bae443b9b476f84 (diff)
downloaduGFX-e762e91bd5d5347071c3b43fbdb021376584c267.tar.gz
uGFX-e762e91bd5d5347071c3b43fbdb021376584c267.tar.bz2
uGFX-e762e91bd5d5347071c3b43fbdb021376584c267.zip
Updates to GAUDOUT.
Add Events to the GAUDOUT api.
Diffstat (limited to 'src/gaudout/sys_defs.h')
-rw-r--r--src/gaudout/sys_defs.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gaudout/sys_defs.h b/src/gaudout/sys_defs.h
index 4f09678b..75cda243 100644
--- a/src/gaudout/sys_defs.h
+++ b/src/gaudout/sys_defs.h
@@ -42,6 +42,36 @@ typedef struct GAudioData {
size_t len; // @< The length of the data in the buffer area (in bytes)
} GAudioData;
+
+// Event types for GAUDOUT
+#define GEVENT_AUDIO_OUT (GEVENT_GAUDOUT_FIRST+0)
+
+/**
+ * @brief The Audio output event structure.
+ * @{
+ */
+typedef struct GEventAudioOut_t {
+ #if GFX_USE_GEVENT || defined(__DOXYGEN__)
+ /**
+ * @brief The type of this event (GEVENT_AUDIO_OUT)
+ */
+ GEventType type;
+ #endif
+ /**
+ * @brief The event flags
+ */
+ uint16_t flags;
+ /**
+ * @brief The event flag values.
+ * @{
+ */
+ #define GAUDOUT_LOSTEVENT 0x0001 /**< @brief The last GEVENT_AUDIO_OUT event was lost */
+ #define GAUDOUT_PLAYING 0x0002 /**< @brief The audio out system is currently playing */
+ #define GAUDOUT_FREEBLOCK 0x0004 /**< @brief An audio buffer has been freed */
+ /** @} */
+} GEventAudioOut;
+/** @} */
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -96,6 +126,8 @@ void gaudioReleaseBuffer(GAudioData *paud);
*
* @note Some channels are mono, and some are stereo. See your driver config file
* to determine which channels to use and whether they are stereo or not.
+ * @note Only one channel can be playing at a time. Calling this will stop any
+ * currently playing channel.
*
* @api
*/
@@ -155,6 +187,25 @@ void gaudioPlayStop(void);
*/
bool_t gaudioPlaySetVolume(uint8_t vol);
+#if GFX_USE_GEVENT || defined(__DOXYGEN__)
+ /**
+ * @brief Turn on sending results to the GEVENT sub-system.
+ * @details Returns a GSourceHandle to listen for GEVENT_AUDIO_OUT events.
+ *
+ * @note The audio output will not use the GEVENT system unless this is
+ * called first. This saves processing time if the application does
+ * not want to use the GEVENT sub-system for audio output.
+ * Once turned on it can only be turned off by calling @p gaudioPlayInit() again.
+ * @note The audio output is capable of signalling via this method and other methods
+ * at the same time.
+ *
+ * @return The GSourceHandle
+ *
+ * @api
+ */
+ GSourceHandle gaudioPlayGetSource(void);
+#endif
+
#ifdef __cplusplus
}
#endif