forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxxStream.h
More file actions
132 lines (115 loc) · 4.64 KB
/
MaxxStream.h
File metadata and controls
132 lines (115 loc) · 4.64 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2021 Waves Audio Ltd. All rights reserved.
*/
/*******************************************************************************
* @page CoreConcepts_DataPath Data Path
*
* Data path is a collection of components and functions used in processing.
*
* **Sample** is a signal value at some point, irrespective of the number of
* channels. Thus, for mono signal sample value is a single data element but
* for multiple channels, sample is a collection of data values,
* one per channel.
*
* **Frame** is a sequence of **samples** to be processed.
*
* ![Interleaved stereo buffer]
* (CoreConcepts/DataPath/MaxxBuffer_StereoFrame.svg)
*
* @section CoreConcepts_DataPath_Streams Data Streams
* All @ref CoreConcepts_MaxxEffect instances receive frames from input streams
* and send processed frames to output streams. Stream example is shown below.
*
* ![Data stream and the corresponding format]
* (CoreConcepts/DataPath/MaxxStream_DeinterleavedStereo.svg)
*
* @subsection CoreConcepts_DataPath_Stream Stream
* @ref MaxxStream_t contains information about all used @ref MaxxBuffer_t,
* and available/processed samples count. @ref MaxxEffect_t handler might
* require a specific frame length to be available in the stream.
*
* @subsection CoreConcepts_DataPath_StreamFormat Stream Format
* Expected streams formats must be defined during @ref Initialization with
* @ref MaxxStreamFormat_t. It holds information about @ref MaxxStream_t
* configuration such as
* [sampling rate](@ref MaxxStreamFormat_t.sampleRate),
* [number of channels](@ref MaxxStreamFormat_t.numChannels),
* [format](@ref MaxxStreamFormat_t.samplesFormat), and
* [layout](@ref MaxxStreamFormat_t.samplesLayout).
*
* @subsection CoreConcepts_DataPath_Buffer Buffer
* @ref MaxxBuffer_t is a pointer to the continuous memory region which
* is used for storing data values. Buffers can contain audio, IV sensors,
* head-tracking data, etc.
*
* @subsection CoreConcepts_DataPath_MultichannelStreams Multichannel Streams
* Multichannel data can be represented in interleaved or deinterleaved manner.
* In interleaved stream single buffer is used to store all channels, whereas
* in deinterleaved stream several buffers are used, one for each channel.
* @ref MaxxBuffer_Layout_t defines buffer layout for multichannel data. This
* field is ignored for single-channel data.
******************************************************************************/
#ifndef MAXX_STREAM_H
#define MAXX_STREAM_H
#include <stdint.h>
/**
* An array of signal values with the @ref MaxxBuffer_Format_t format.
*
* @see @ref CoreConcepts_DataPath_Buffer
*/
typedef void* MaxxBuffer_t;
/**
* Defines data encoding format of @ref MaxxBuffer_t elements.
*/
typedef enum
{
MAXX_BUFFER_FORMAT_Q1_15 = 0, /**< PCM Q15 */
MAXX_BUFFER_FORMAT_Q9_23 = 1, /**< PCM Q23 in 32 bit container */
MAXX_BUFFER_FORMAT_Q1_31 = 2, /**< PCM Q31 */
MAXX_BUFFER_FORMAT_FLOAT = 3, /**< FLOAT */
MAXX_BUFFER_FORMAT_Q5_27 = 4, /**< PCM Q27 */
MAXX_BUFFER_FORMAT_Q1_23 = 5, /**< PCM Q23 */
MAXX_BUFFER_FORMAT_FORCE_SIZE = INT32_MAX
} MaxxBuffer_Format_t;
/**
* Defines buffers layout inside of the @ref MaxxStream_t.
*
* @see @ref CoreConcepts_DataPath_MultichannelStreams
*/
typedef enum
{
MAXX_BUFFER_LAYOUT_INTERLEAVED = 0, /**< Interleaved buffer */
MAXX_BUFFER_LAYOUT_DEINTERLEAVED = 1, /**< Deinterleaved buffer */
MAXX_BUFFER_LAYOUT_FORCE_SIZE = INT32_MAX
} MaxxBuffer_Layout_t;
/**
* Defines @ref CoreConcepts_DataPath_StreamFormat.
*/
typedef struct
{
uint32_t sampleRate; /**< Sampling rate in Hz */
uint32_t numChannels; /**< Channels count */
MaxxBuffer_Format_t samplesFormat; /**< Data format */
MaxxBuffer_Layout_t samplesLayout; /**< Data layout */
uint32_t frameSize; /**< Minimum available samples count */
} MaxxStreamFormat_t;
/**
* A @ref CoreConcepts_DataPath_Stream with the @ref MaxxStreamFormat_t format.
*/
typedef struct
{
/**
* For @ref MAXX_BUFFER_LAYOUT_INTERLEAVED array length must be 1.
* For @ref MAXX_BUFFER_LAYOUT_DEINTERLEAVED must be equal to the
* [number of channels](@ref MaxxStreamFormat_t.numChannels).
*/
MaxxBuffer_t* buffersArray;
/** number of available samples in data buffers. */
uint32_t numAvailableSamples;
/** number of processed samples in data buffers. */
uint32_t numProcessedSamples;
/** maximum number of samples which buffers can contain. */
uint32_t maxNumSamples;
} MaxxStream_t;
#endif