forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmixer.h
More file actions
82 lines (64 loc) · 1.99 KB
/
mixer.h
File metadata and controls
82 lines (64 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2019 Intel Corporation. All rights reserved.
*
* Author: Janusz Jankowski <janusz.jankowski@linux.intel.com>
*/
#ifndef __SOF_AUDIO_MIXER_H__
#define __SOF_AUDIO_MIXER_H__
#include <sof/audio/buffer.h>
#include <sof/audio/component.h>
#include <sof/audio/format.h>
#include <sof/platform.h>
#include <stddef.h>
#include <stdint.h>
#ifdef UNIT_TEST
void sys_comp_module_mixer_interface_init(void);
#endif
#define MIXER_GENERIC
#if defined(__XCC__)
#include <xtensa/config/core-isa.h>
#if XCHAL_HAVE_HIFI3 || XCHAL_HAVE_HIFI4
#undef MIXER_GENERIC
#endif
#endif
#define MIXER_MAX_SOURCES 2
/* mixer component private data */
struct mixer_data {
void (*mix_func)(struct comp_dev *dev, struct audio_stream *sink,
const struct audio_stream **sources, uint32_t count,
uint32_t frames);
};
/**
* \brief mixer processing function interface
*/
typedef void (*mixer_func)(struct comp_dev *dev, struct audio_stream *sink,
const struct audio_stream **sources, uint32_t num_sources,
uint32_t frames);
/** \brief Volume processing functions map. */
struct mixer_func_map {
enum sof_ipc_frame frame_fmt; /**< frame format */
mixer_func func; /**< volume processing function */
};
/** \brief Map of formats with dedicated processing functions. */
extern const struct mixer_func_map mixer_func_map[];
/** \brief Number of processing functions. */
extern const size_t mixer_func_count;
/**
* \brief Retrievies mixer processing function.
* \param[in,out] dev Mixer base component device.
* \param[in] sinkb Sink buffer to match against
*/
static inline mixer_func mixer_get_processing_function(struct comp_dev *dev,
struct comp_buffer *sinkb)
{
int i;
/* map the volume function for source and sink buffers */
for (i = 0; i < mixer_func_count; i++) {
if (audio_stream_get_frm_fmt(&sinkb->stream) != mixer_func_map[i].frame_fmt)
continue;
return mixer_func_map[i].func;
}
return NULL;
}
#endif /* __SOF_AUDIO_MIXER_H__ */