Skip to content
Snippets Groups Projects
Commit cfa76b52 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Flesh out a few more PCM methods, still incomplete. Re-vision PCM structure definition

parent a0c707ec
No related branches found
No related tags found
No related merge requests found
......@@ -386,9 +386,10 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s*)((uintptr_t)arg);
DEBUGASSERT(lower->ops->getcaps != NULL);
audvdbg("AUDIOIOC_GETCAPS: Device=%d", caps->ac_type);
audvdbg("AUDIOIOC_GETCAPS: Device=%d\n", caps->ac_type);
/* Call the lower-half driver capabilities handler */
ret = lower->ops->getcaps(lower, caps->ac_type, caps);
}
break;
......@@ -399,7 +400,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
(FAR const struct audio_caps_desc_s*)((uintptr_t)arg);
DEBUGASSERT(lower->ops->configure != NULL);
audvdbg("AUDIOIOC_INITIALIZE: Device=%d", caps->caps.ac_type);
audvdbg("AUDIOIOC_INITIALIZE: Device=%d\n", caps->caps.ac_type);
/* Call the lower-half driver configure handler */
......
This diff is collapsed.
......@@ -1500,7 +1500,7 @@ static int wm8904_reserve(FAR struct audio_lowerhalf_s *dev)
}
else
{
/* Initialize the session context. We don't really use it. */
/* Initialize the session context */
#ifdef CONFIG_AUDIO_MULTI_SESSION
*session = NULL;
......
......@@ -68,38 +68,59 @@
/* Default configuration values */
/* WAVE Header Definitions **************************************************/
/* All values are little endian */
/* All values are little 32-bit or 16-bit endian */
#define WAV_CHUNKID 0x46464952 /* "RIFF" */
#define WAV_FORMAT 0x45564157 /* "WAVE" */
#define WAV_SUBCHKID1 0x20746d66 /* "fmt " */
#define WAV_SUBCHKLEN1 16 /* Size of a PCM subchunk */
#define WAV_COMPRESSION 1 /* Linear quantization */
#define WAV_MONO 1 /* nchannels=1 */
#define WAV_STEREO 2 /* nchannels=2 */
#define WAV_DATA 0x61746164 /* "data"
#define WAV_HDR_CHUNKID 0x46464952 /* "RIFF" */
#define WAV_HDR_FORMAT 0x45564157 /* "WAVE" */
#define WAV_FMT_CHUNKID 0x20746d66 /* "fmt " */
#define WAV_FMT_CHUNKLEN 16 /* Size of a PCM subchunk */
#define WAV_FMT_FORMAT 1 /* Linear quantization */
#define WAV_FMT_MONO 1 /* nchannels=1 */
#define WAV_FMT_STEREO 2 /* nchannels=2 */
#define WAV_DATA_CHUNKID 0x61746164 /* "data" */
/****************************************************************************
* Public Types
****************************************************************************/
/* The standard WAV header consist of three chunks
*
* 1. A WAV header chunk,
* 2. A format chunk, and
* 3. A data chunk.
*/
/* Standard WAV file header format */
struct wav_header_s
struct wav_hdrchunk_s
{
uint32_t chkid; /* Contains the letters "RIFF" in ASCII form. */
uint32_t chklen; /* Size of the rest of the following chunk */
uint32_t chunkid; /* Contains the letters "RIFF" in ASCII form. */
uint32_t chunklen; /* Size of the rest of the following chunk */
uint32_t format; /* Contains the letters "WAVE" */
uint32_t subchkid1; /* Contains the letters "fmt " */
uint32_t subchklen1; /* Size of the following subchunk (16 for PCM) */
uint16_t compression; /* PCM=1 (i.e. Linear quantization) */
};
struct wav_formatchunk_s
{
uint32_t chunkid; /* Contains the letters "fmt " */
uint32_t chunklen; /* Size of the following chunk (16 for PCM) */
uint16_t format; /* PCM=1 (i.e. Linear quantization) */
uint16_t nchannels; /* Mono=1, Stereo=2 */
uint32_t samprate; /* 8000, 44100, ... */
uint32_t byterate; /* samprate * nchannels * bpsamp / 8 */
uint16_t align; /* nchannels * bpsamp / 8 */
uint16_t bpsamp; /* Bits per sample: 8 bits = 8, 16 bits = 16 */
uint32_t subchkid2; /* Contains the letters "data" */
uint32_t subchklen2; /* Number of bytes in the data */
};
struct wav_datachunk_s
{
uint32_t chunkid; /* Contains the letters "data" */
uint32_t chunklen; /* Number of bytes in the data */
};
/* The standard WAV file header format is then these three chunks */
struct wav_header_s
{
struct wav_hdrchunk_s hdr;
struct wav_formatchunk_s fmt;
struct wav_datachunk_s data;
};
/****************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment