diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-03-03 07:39:46 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-03-03 07:39:46 +1000 |
commit | 43527de2c09eb90e5c1cebbce587b5da2bda957d (patch) | |
tree | c2d8aed141483f9a8fb9d82c82853e9425c58f14 /src | |
parent | 17f1f9d7990461cbdb7b40d42b310321ca47b776 (diff) | |
download | uGFX-43527de2c09eb90e5c1cebbce587b5da2bda957d.tar.gz uGFX-43527de2c09eb90e5c1cebbce587b5da2bda957d.tar.bz2 uGFX-43527de2c09eb90e5c1cebbce587b5da2bda957d.zip |
Updates to GAUDOUT to allow specification of the sample format.
Fix threading issues.
Diffstat (limited to 'src')
-rw-r--r-- | src/gaudout/driver.h | 3 | ||||
-rw-r--r-- | src/gaudout/gaudout.c | 8 | ||||
-rw-r--r-- | src/gaudout/sys_defs.h | 8 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/gaudout/driver.h b/src/gaudout/driver.h index cd9ab01b..8e72dff4 100644 --- a/src/gaudout/driver.h +++ b/src/gaudout/driver.h @@ -62,12 +62,13 @@ void gaudoutReleaseDataBlockI(GAudioData *paud); * * @param[in] channel The channel to use (see the driver for the available channels provided) * @param[in] frequency The sample frequency to use + * @param[in] format The sample format * * @note The driver will always have been stopped and de-init before this is called. * * @api */ -bool_t gaudout_lld_init(uint16_t channel, uint32_t frequency); +bool_t gaudout_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief De-Initialise the driver diff --git a/src/gaudout/gaudout.c b/src/gaudout/gaudout.c index c0d673a0..275677c8 100644 --- a/src/gaudout/gaudout.c +++ b/src/gaudout/gaudout.c @@ -94,10 +94,10 @@ GAudioData *gaudioGetBuffer(delaytime_t ms) { return (GAudioData *)gfxQueueGSyncGet(&freelist, ms); } -bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency) { +bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { gaudioPlayStop(); gaudout_lld_deinit(); - return gaudout_lld_init(channel, frequency); + return gaudout_lld_init(channel, frequency, format); } void gaudioPlay(GAudioData *paud) { @@ -127,11 +127,11 @@ bool_t gaudioPlaySetVolume(uint8_t vol) { */ GAudioData *gaudoutGetDataBlockI(void) { - return (GAudioData *)gfxQueueASyncGet(&playlist); + return (GAudioData *)gfxQueueASyncGetI(&playlist); } void gaudoutReleaseDataBlockI(GAudioData *paud) { - gfxQueueGSyncPut(&freelist, (gfxQueueGSyncItem *)paud); + gfxQueueGSyncPutI(&freelist, (gfxQueueGSyncItem *)paud); } diff --git a/src/gaudout/sys_defs.h b/src/gaudout/sys_defs.h index c3745b8c..4f09678b 100644 --- a/src/gaudout/sys_defs.h +++ b/src/gaudout/sys_defs.h @@ -39,7 +39,7 @@ typedef struct GAudioData { gfxQueueASyncItem next; // @< Used for queuing the buffers size_t size; // @< The size of the buffer area following this structure (in bytes) - size_t len; // @< The length of the data in the buffer area (in samples) + size_t len; // @< The length of the data in the buffer area (in bytes) } GAudioData; /*===========================================================================*/ @@ -92,13 +92,14 @@ void gaudioReleaseBuffer(GAudioData *paud); * * @param[in] channel The audio output channel to use. * @param[in] frequency The audio sample rate in samples per second + * @param[in] format The audio sample format * * @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. * * @api */ -bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency); +bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); /** * @brief Play the specified sample data. @@ -109,8 +110,7 @@ bool_t gaudioPlayInit(uint16_t channel, uint32_t frequency); * * @note Calling this will cancel any pause. * @note Before calling this function the len field of the GAudioData structure must be - * specified. While the buffer size is specified in bytes, this length is specified in samples - * and must be even for stereo channels. + * specified (in bytes). * @note For stereo channels the sample data is interleaved in the buffer. * @note This call returns before the data has completed playing. Subject to available buffers (which * can be obtained from the free-list), any number of buffers may be played. They will be queued |