2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
22 .type _EchoMono16,@func
24 .type _EchoStereo16,@func
26 .type _EchoMono32,@func
28 .type _EchoStereo32,@func
30 .type _EchoMulti32,@func
35 .set ahiecho_FeedbackDS, 8
36 .set ahiecho_FeedbackDO, 12
37 .set ahiecho_FeedbackNS, 16
38 .set ahiecho_FeedbackNO, 20
41 .set ahiecho_Offset, 32
42 .set ahiecho_SrcPtr, 36
43 .set ahiecho_DstPtr, 40
44 .set ahiecho_EndPtr, 44
45 .set ahiecho_BufferLength, 48
46 .set ahiecho_BufferSize, 52
47 .set ahiecho_Buffer, 56
100 move.w
(a1
),d0
/* Get sample x[n] */
103 muls.l ahiecho_MixN
(a0
),d0
104 move.w
(a3
)+,d3
/* Get delayed sample d[n-N] */
107 muls.l ahiecho_MixD
(a0
),d3
110 move.w d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
112 addq.
l #1,d2 /* Fix for -1 */
113 muls.l ahiecho_FeedbackDS
(a0
),d2
/* d2=FeedbackDS*d[n-N] */
115 muls.l ahiecho_FeedbackNS
(a0
),d1
116 add.l d1
,d2
/* d2=...+FeedbackNS*x[n] */
119 move.w d2
,(a6
)+ /* store d2 */
135 move.w
(a1
),d0
/* Get left sample x[n] */
138 muls.l ahiecho_MixN
(a0
),d0
139 move.w
(a3
)+,d3
/* Get left delayed sample d[n-N]*/
142 muls.l ahiecho_MixD
(a0
),d3
145 move.w d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
147 move.w
(a1
),d0
/* Get right sample x[n] */
150 muls.l ahiecho_MixN
(a0
),d0
151 move.w
(a3
)+,d3
/*Get right delayed sample d[n-N]*/
154 muls.l ahiecho_MixD
(a0
),d3
157 move.w d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
159 addq.
l #1,d2 /* Fix for -1 */
161 muls.l ahiecho_FeedbackDS
(a0
),d2
/* d2=FeedbackDS*d[n-N] (left) */
162 muls.l ahiecho_FeedbackDO
(a0
),d0
164 addq.
l #1,d5 /* Fix for -1 */
166 muls.l ahiecho_FeedbackDS
(a0
),d5
/* d5=FeedbackDS*d[n-N] (right) */
167 muls.l ahiecho_FeedbackDO
(a0
),d3
169 add.l d3
,d2
/* d2=...+FeedbackDO*d[n-N] */
170 add.l d0
,d5
/* d5=...+FeedbackDO*d[n-N] */
173 muls.l ahiecho_FeedbackNS
(a0
),d0
174 add.l d0
,d2
/* d2=...+FeedbackNS*x[n] */
175 muls.l ahiecho_FeedbackNO
(a0
),d1
176 add.l d1
,d5
/* d5=...+FeedbackNO*x[n] */
179 muls.l ahiecho_FeedbackNO
(a0
),d0
180 add.l d0
,d2
/* d2=...+FeedbackNO*x[n] */
181 muls.l ahiecho_FeedbackNS
(a0
),d4
182 add.l d4
,d5
/* d5=...+FeedbackNS*x[n] */
186 move.
l d2
,(a6
)+ /* store d2 and d5 */
201 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
202 *** input data is used! */
205 move.w
(a1
),d0
/* Get sample x[n] (high word) */
208 muls.l ahiecho_MixN
(a0
),d0
209 move.w
(a3
)+,d3
/* Get delayed sample d[n-N] */
212 muls.l ahiecho_MixD
(a0
),d3
214 move.
l d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
216 addq.
l #1,d2 /* Fix for -1 */
217 muls.l ahiecho_FeedbackDS
(a0
),d2
/* d2=FeedbackDS*d[n-N] */
219 muls.l ahiecho_FeedbackNS
(a0
),d1
220 add.l d1
,d2
/* d2=...+FeedbackNS*x[n] */
223 move.w d2
,(a6
)+ /* store d2 */
238 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
239 *** input data is used! */
242 move.w
(a1
),d0
/*Get left sample x[n] (high word)*/
245 muls.l ahiecho_MixN
(a0
),d0
246 move.w
(a3
)+,d3
/* Get left delayed sample d[n-N]*/
249 muls.l ahiecho_MixD
(a0
),d3
251 move.
l d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
253 move.w
(a1
),d0
/* Get right sample x[n] (high word) */
256 muls.l ahiecho_MixN
(a0
),d0
257 move.w
(a3
)+,d3
/*Get right delayed sample d[n-N]*/
260 muls.l ahiecho_MixD
(a0
),d3
262 move.
l d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
264 addq.
l #1,d2 /* Fix for -1 */
266 muls.l ahiecho_FeedbackDS
(a0
),d2
/* d2=FeedbackDS*d[n-N] (left) */
267 muls.l ahiecho_FeedbackDO
(a0
),d0
269 addq.
l #1,d5 /* Fix for -1 */
271 muls.l ahiecho_FeedbackDS
(a0
),d5
/* d5=FeedbackDS*d[n-N] (right) */
272 muls.l ahiecho_FeedbackDO
(a0
),d3
274 add.l d3
,d2
/* d2=...+FeedbackDO*d[n-N] */
275 add.l d0
,d5
/* d5=...+FeedbackDO*d[n-N] */
278 muls.l ahiecho_FeedbackNS
(a0
),d0
279 add.l d0
,d2
/* d2=...+FeedbackNS*x[n] */
280 muls.l ahiecho_FeedbackNO
(a0
),d1
281 add.l d1
,d5
/* d5=...+FeedbackNO*x[n] */
284 muls.l ahiecho_FeedbackNO
(a0
),d0
285 add.l d0
,d2
/* d2=...+FeedbackNO*x[n] */
286 muls.l ahiecho_FeedbackNS
(a0
),d4
287 add.l d4
,d5
/* d5=...+FeedbackNS*x[n] */
291 move.
l d2
,(a6
)+ /* store d1 and d4 */
306 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
307 *** input data is used! */
310 move.w
(a1
),d0
/*Get left sample x[n] (high word)*/
313 muls.l ahiecho_MixN
(a0
),d0
314 move.w
(a3
)+,d3
/* Get left delayed sample d[n-N]*/
317 muls.l ahiecho_MixD
(a0
),d3
319 move.
l d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
321 move.w
(a1
),d0
/* Get right sample x[n] (high word) */
324 muls.l ahiecho_MixN
(a0
),d0
325 move.w
(a3
)+,d3
/*Get right delayed sample d[n-N]*/
328 muls.l ahiecho_MixD
(a0
),d3
330 move.
l d3
,(a1
)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
332 addq.
l #1,d2 /* Fix for -1 */
334 muls.l ahiecho_FeedbackDS
(a0
),d2
/* d2=FeedbackDS*d[n-N] (left) */
335 muls.l ahiecho_FeedbackDO
(a0
),d0
337 addq.
l #1,d5 /* Fix for -1 */
339 muls.l ahiecho_FeedbackDS
(a0
),d5
/* d5=FeedbackDS*d[n-N] (right) */
340 muls.l ahiecho_FeedbackDO
(a0
),d3
342 add.l d3
,d2
/* d2=...+FeedbackDO*d[n-N] */
343 add.l d0
,d5
/* d5=...+FeedbackDO*d[n-N] */
346 muls.l ahiecho_FeedbackNS
(a0
),d0
347 add.l d0
,d2
/* d2=...+FeedbackNS*x[n] */
348 muls.l ahiecho_FeedbackNO
(a0
),d1
349 add.l d1
,d5
/* d5=...+FeedbackNO*x[n] */
352 muls.l ahiecho_FeedbackNO
(a0
),d0
353 add.l d0
,d2
/* d2=...+FeedbackNO*x[n] */
354 muls.l ahiecho_FeedbackNS
(a0
),d4
355 add.l d4
,d5
/* d5=...+FeedbackNS*x[n] */
359 move.
l d2
,(a6
)+ /* store d1 and d4 */