audio/audio_comp.c: Add the composite audio driver

This commit is contained in:
Xiang Xiao 2018-08-27 09:03:09 -06:00 committed by Gregory Nutt
parent 85a993999e
commit b5f8c035a6
4 changed files with 1110 additions and 0 deletions

View file

@ -11,6 +11,12 @@ config AUDIO
if AUDIO
config AUDIO_COMP
bool "Support audio composition"
default n
---help---
Composite several lower level audio devices into big one.
config AUDIO_MULTI_SESSION
bool "Support multiple sessions"
default n

View file

@ -45,6 +45,10 @@ ASRCS =
CSRCS = audio.c
VPATH = .
ifeq ($(CONFIG_AUDIO_COMP),y)
CSRCS += audio_comp.c
endif
# Include support for various drivers. Each Make.defs file will add its
# files to the source file list, add its DEPPATH info, and will add
# the appropriate paths to the VPATH variable

1001
audio/audio_comp.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,99 @@
/****************************************************************************
* include/nuttx/audio/audio_comp.h
* A general audio driver to composite other lower level audio driver.
*
* Copyright (C) 2018 Pinecone Inc. All rights reserved.
* Author: Xiang Xiao <xiaoxiang@pinecone.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H
#define __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_AUDIO_COMP
#include <nuttx/audio/audio.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: audio_comp_initialize
*
* Description:
* Initialize the composite audio device.
*
* Input Parameters:
* name - The name of the audio device.
* ... - The list of the lower half audio driver.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
*
* Note
* The variable argument list must be NULL terminated.
*
****************************************************************************/
int audio_comp_initialize(FAR const char *name, ...);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_AUDIO_COMP */
#endif /* __INCLUDE_NUTTX_AUDIO_AUDIO_COMP_H */