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,
21 // Not the best routines (fraction does not get saved between calls,
22 // loads of byte writes, no interpolation etc), but who cares?
30 * size Number of SAMPLES to fill. (Max 131071)
31 * add Add interger.fraction in samples (2×16 bit)
32 * src Source (AHIST_S16S)
33 * offset Pointer to Source Offset in bytes (will be updated)
34 * dest Pointer to Destination (will be updated)
51 Fixed64 step
= ((Fixed64
) add
) << 16;
52 struct sample
* from
= (struct sample
*) (src
+ *offset
);
56 for( i
= 0; i
< size
; ++i
)
58 *to
++ = from
[ offs
>> 32 ].left
>> 8;
63 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );
75 Fixed64 step
= ((Fixed64
) add
) << 16;
76 struct sample
* from
= (struct sample
*) (src
+ *offset
);
80 for( i
= 0; i
< size
; ++i
)
82 *to
++ = from
[ offs
>> 32 ].left
>> 8;
83 *to
++ = from
[ offs
>> 32 ].right
>> 8;
88 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );
100 Fixed64 step
= ((Fixed64
) add
) << 16;
101 struct sample
* from
= (struct sample
*) (src
+ *offset
);
105 for( i
= 0; i
< size
; ++i
)
107 *to
++ = from
[ offs
>> 32 ].left
;
112 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );
124 Fixed64 step
= ((Fixed64
) add
) << 16;
125 struct sample
* from
= (struct sample
*) (src
+ *offset
);
129 for( i
= 0; i
< size
; ++i
)
131 *to
++ = from
[ offs
>> 32 ].left
;
132 *to
++ = from
[ offs
>> 32 ].right
;
137 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );
149 Fixed64 step
= ((Fixed64
) add
) << 16;
150 struct sample
* from
= (struct sample
*) (src
+ *offset
);
154 for( i
= 0; i
< size
; ++i
)
156 *to
++ = from
[ offs
>> 32 ].left
<< 16;
161 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );
173 Fixed64 step
= ((Fixed64
) add
) << 16;
174 struct sample
* from
= (struct sample
*) (src
+ *offset
);
178 for( i
= 0; i
< size
; ++i
)
180 *to
++ = from
[ offs
>> 32 ].left
<< 16;
181 *to
++ = from
[ offs
>> 32 ].right
<< 16;
186 *offset
+= ( offs
>> 32 ) * sizeof( struct sample
* );