Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
cfa76b52
Commit
cfa76b52
authored
10 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Flesh out a few more PCM methods, still incomplete. Re-vision PCM structure definition
parent
a0c707ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
audio/audio.c
+3
-2
3 additions, 2 deletions
audio/audio.c
audio/pcm_decode.c
+311
-86
311 additions, 86 deletions
audio/pcm_decode.c
drivers/audio/wm8904.c
+1
-1
1 addition, 1 deletion
drivers/audio/wm8904.c
include/nuttx/audio/pcm.h
+40
-19
40 additions, 19 deletions
include/nuttx/audio/pcm.h
with
355 additions
and
108 deletions
audio/audio.c
+
3
−
2
View file @
cfa76b52
...
...
@@ -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.
Click to expand it.
audio/pcm_decode.c
+
311
−
86
View file @
cfa76b52
This diff is collapsed.
Click to expand it.
drivers/audio/wm8904.c
+
1
−
1
View file @
cfa76b52
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
include/nuttx/audio/pcm.h
+
40
−
19
View file @
cfa76b52
...
...
@@ -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_
SUBCH
KLEN
1
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_CHUN
KLEN 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
ch
un
kid
;
/* Contains the letters "RIFF" in ASCII form. */
uint32_t
ch
un
klen
;
/* 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
;
};
/****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment