Skip to content

Commit b5f8c03

Browse files
xiaoxiang781216gregory-nutt
authored andcommittedAug 27, 2018
audio/audio_comp.c: Add the composite audio driver
1 parent 85a9939 commit b5f8c03

File tree

4 files changed

+1110
-0
lines changed

4 files changed

+1110
-0
lines changed
 

‎audio/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ config AUDIO
1111

1212
if AUDIO
1313

14+
config AUDIO_COMP
15+
bool "Support audio composition"
16+
default n
17+
---help---
18+
Composite several lower level audio devices into big one.
19+
1420
config AUDIO_MULTI_SESSION
1521
bool "Support multiple sessions"
1622
default n

‎audio/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ ASRCS =
4545
CSRCS = audio.c
4646
VPATH = .
4747

48+
ifeq ($(CONFIG_AUDIO_COMP),y)
49+
CSRCS += audio_comp.c
50+
endif
51+
4852
# Include support for various drivers. Each Make.defs file will add its
4953
# files to the source file list, add its DEPPATH info, and will add
5054
# the appropriate paths to the VPATH variable

‎audio/audio_comp.c

+1,001
Large diffs are not rendered by default.

‎include/nuttx/audio/audio_comp.h

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/****************************************************************************
2+
* include/nuttx/audio/audio_comp.h
3+
* A general audio driver to composite other lower level audio driver.
4+
*
5+
* Copyright (C) 2018 Pinecone Inc. All rights reserved.
6+
* Author: Xiang Xiao <xiaoxiang@pinecone.net>
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* 2. Redistributions in binary form must reproduce the above copyright
15+
* notice, this list of conditions and the following disclaimer in
16+
* the documentation and/or other materials provided with the
17+
* distribution.
18+
* 3. Neither the name NuttX nor the names of its contributors may be
19+
* used to endorse or promote products derived from this software
20+
* without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29+
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
****************************************************************************/
36+
37+
#ifndef __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H
38+
#define __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H
39+
40+
/****************************************************************************
41+
* Included Files
42+
****************************************************************************/
43+
44+
#include <nuttx/config.h>
45+
46+
#ifdef CONFIG_AUDIO_COMP
47+
#include <nuttx/audio/audio.h>
48+
49+
/****************************************************************************
50+
* Pre-processor Definitions
51+
****************************************************************************/
52+
53+
/****************************************************************************
54+
* Public Types
55+
****************************************************************************/
56+
57+
/****************************************************************************
58+
* Public Data
59+
****************************************************************************/
60+
61+
#ifdef __cplusplus
62+
#define EXTERN extern "C"
63+
extern "C"
64+
{
65+
#else
66+
#define EXTERN extern
67+
#endif
68+
69+
/****************************************************************************
70+
* Public Function Prototypes
71+
****************************************************************************/
72+
73+
/****************************************************************************
74+
* Name: audio_comp_initialize
75+
*
76+
* Description:
77+
* Initialize the composite audio device.
78+
*
79+
* Input Parameters:
80+
* name - The name of the audio device.
81+
* ... - The list of the lower half audio driver.
82+
*
83+
* Returned Value:
84+
* Zero on success; a negated errno value on failure.
85+
*
86+
* Note
87+
* The variable argument list must be NULL terminated.
88+
*
89+
****************************************************************************/
90+
91+
int audio_comp_initialize(FAR const char *name, ...);
92+
93+
#undef EXTERN
94+
#ifdef __cplusplus
95+
}
96+
#endif
97+
98+
#endif /* CONFIG_AUDIO_COMP */
99+
#endif /* __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H */

0 commit comments

Comments
 (0)
Please sign in to comment.