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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/**
* @ingroup sc68_lib
* @file sc68/mixer68.h
* @author Benjamin Gerard
* @date 1999/05/17
* @brief audio mixer header.
*
*/
/* $Id: mixer68.h 102 2009-03-14 17:21:58Z benjihan $ */
/* Copyright (C) 1998-2009 Benjamin Gerard */
/** @defgroup sc68_mixer audio mixer
* @ingroup sc68_lib
*
* sc68 audio mixer provides functions for computing audio data PCM.
* Almost all functions work on 16 bit stereo PCM. Some functions
* require signed input to work properly. All functions allow to
* change PCM sign. Functions that require signed input perform a
* double sign change operation which allow to have any kind of input
* PCM.
*
* Internaly PCM are read as 32bit integer. This implies that buffer
* must be properly aligned (depending on the architecture). Left
* channel is stored the less signifiant 16 bit and right the most
* signifiant 16 bit. Ensure the audio device use the same byte
* order.
*
* @{
*/
/** @name Constants for PCM sign transformation.
* @{
*/
/**@}*/
/** Copy 16-bit-stereo PCM with optionnal sign change.
*
* @param dst dstination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param sign Sign transformation.
*/
void ;
/** Copy 16-bit-stereo PCM with channel swapping and optionnal sign change.
*
* @note Sign change occurs after channel swapping.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param sign Sign transformation.
*/
void ;
/** Copy 16-bit-stereo PCM into normalized float-stereo (-norm..+norm).
*
* @note Sign change occurs before float transformation.
* @warning PCM are assumed to be signed after sign transform.
*
* @param dst dstination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param sign Sign transformation.
* @param norm float absolute range (normalization).
*
* @note Minus norm causes a sign/phase inversion.
*/
void ;
/** Copy left channel of 16-bit stereo PCM into L/R channels
* with optionnal sign change.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param sign Sign transformation.
*/
void ;
/** Copy right channel of 16-bit stereo PCM into L/R channels
* with optionnal sign change.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param sign Sign transformation.
*/
void ;
/** Copy 16-bit-stereo PCM with L/R blending and optionnal sign change.
*
* This function performs following transformations in this order :
* - Read 32 bit value from src.
* - Apply sign_r transformation; it is a bitwise EOR.
* - Apply blending (here PCM are asuumed to be signed).
* - Apply sign_w transformation; it is a bitwise EOR too.
* - Store 32 bit value.
*
* @warning As the blending occurs on signed PCM the sign_r and
* the sign_w must be setted properly.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param factor Blending factor from [0..65536].
* - 0, blend nothing.
* - 65536, Swap L/R.
* - other value, linear blending.
* @param sign_r sign transform for input PCM.
* @param sign_w sign transform for output PCM.
*/
void ;
/** Copy 16-bit-stereo PCM with L/R amplitude factor and
* optionnal sign change.
*
* This function performs following transformations in this order :
* - Read 32 bit value from src.
* - Apply sign_r transformation; it is a bitwise EOR.
* - Apply signed modulation to both channels.
* - Apply sign_w transformation; it is a bitwise EOR too.
* - Store 32 bit value.
*
* @warning As the modulation occurs on signed PCM the sign_r and
* the sign_w must be setted properly.
*
* @note Amplitude factors (ml and mr) can be minus to invert phase.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer (can be same as dst).
* @param nb Number of PCM
* @param ml Left channel factor from [-65536..65536].
* @param mr Like ml but for right channel.
* @param sign_r sign transform for input PCM.
* @param sign_w sign transform for output PCM.
*/
void ;
/** Fill 16-bit-stereo buffer with sign value (RRRRLLLL).
*
* @param dst Destination PCM buffer
* @param nb Number of PCM
* @param sign PCM value written (right channel is MSW).
*/
void ;
/** Copy 16-bit-stereo buffer.
*
* @param dst Destination PCM buffer
* @param src Source PCM buffer
* @param nb Number of PCM
*/
void ;
/**
* @}
*/
/* #ifndef _MIXER68_H_ */