msm6258.c revision 1.20 1 1.20 isaki /* $NetBSD: msm6258.c,v 1.20 2017/07/30 05:51:34 isaki Exp $ */
2 1.1 minoura
3 1.1 minoura /*
4 1.1 minoura * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
5 1.1 minoura *
6 1.1 minoura * Redistribution and use in source and binary forms, with or without
7 1.1 minoura * modification, are permitted provided that the following conditions
8 1.1 minoura * are met:
9 1.1 minoura * 1. Redistributions of source code must retain the above copyright
10 1.1 minoura * notice, this list of conditions and the following disclaimer.
11 1.1 minoura * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 minoura * notice, this list of conditions and the following disclaimer in the
13 1.1 minoura * documentation and/or other materials provided with the distribution.
14 1.1 minoura *
15 1.1 minoura * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 1.1 minoura * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 1.1 minoura * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 1.1 minoura * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 1.1 minoura * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 1.1 minoura * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 1.1 minoura * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 1.1 minoura * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 1.1 minoura * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.1 minoura * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.1 minoura * SUCH DAMAGE.
26 1.1 minoura */
27 1.1 minoura
28 1.1 minoura /*
29 1.1 minoura * OKI MSM6258 ADPCM voice synthesizer codec.
30 1.1 minoura */
31 1.5 lukem
32 1.5 lukem #include <sys/cdefs.h>
33 1.20 isaki __KERNEL_RCSID(0, "$NetBSD: msm6258.c,v 1.20 2017/07/30 05:51:34 isaki Exp $");
34 1.1 minoura
35 1.1 minoura #include <sys/systm.h>
36 1.1 minoura #include <sys/device.h>
37 1.17 jmcneill #include <sys/kmem.h>
38 1.1 minoura #include <sys/select.h>
39 1.1 minoura #include <sys/audioio.h>
40 1.1 minoura
41 1.1 minoura #include <dev/audio_if.h>
42 1.6 isaki #include <dev/auconv.h>
43 1.1 minoura #include <dev/audiovar.h>
44 1.4 minoura #include <dev/mulaw.h>
45 1.1 minoura #include <dev/ic/msm6258var.h>
46 1.1 minoura
47 1.9 isaki struct msm6258_codecvar {
48 1.12 kent stream_filter_t base;
49 1.12 kent short mc_amp;
50 1.12 kent char mc_estim;
51 1.9 isaki };
52 1.9 isaki
53 1.12 kent static stream_filter_t *msm6258_factory
54 1.17 jmcneill (struct audio_softc *,
55 1.17 jmcneill int (*)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int));
56 1.12 kent static void msm6258_dtor(struct stream_filter *);
57 1.15 perry static inline uint8_t pcm2adpcm_step(struct msm6258_codecvar *, int16_t);
58 1.15 perry static inline int16_t adpcm2pcm_step(struct msm6258_codecvar *, uint8_t);
59 1.1 minoura
60 1.12 kent static const int adpcm_estimindex[16] = {
61 1.9 isaki 2, 6, 10, 14, 18, 22, 26, 30,
62 1.9 isaki -2, -6, -10, -14, -18, -22, -26, -30
63 1.1 minoura };
64 1.1 minoura
65 1.12 kent static const int adpcm_estim[49] = {
66 1.1 minoura 16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
67 1.1 minoura 41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
68 1.1 minoura 107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
69 1.1 minoura 279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
70 1.10 isaki 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
71 1.1 minoura };
72 1.1 minoura
73 1.12 kent static const int adpcm_estimstep[16] = {
74 1.1 minoura -1, -1, -1, -1, 2, 4, 6, 8,
75 1.1 minoura -1, -1, -1, -1, 2, 4, 6, 8
76 1.1 minoura };
77 1.1 minoura
78 1.20 isaki static int16_t buzzer; /* sound for debug */
79 1.20 isaki
80 1.12 kent static stream_filter_t *
81 1.17 jmcneill msm6258_factory(struct audio_softc *asc,
82 1.17 jmcneill int (*fetch_to)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int))
83 1.1 minoura {
84 1.12 kent struct msm6258_codecvar *this;
85 1.1 minoura
86 1.17 jmcneill this = kmem_alloc(sizeof(struct msm6258_codecvar), KM_SLEEP);
87 1.12 kent this->base.base.fetch_to = fetch_to;
88 1.12 kent this->base.dtor = msm6258_dtor;
89 1.12 kent this->base.set_fetcher = stream_filter_set_fetcher;
90 1.12 kent this->base.set_inputbuffer = stream_filter_set_inputbuffer;
91 1.12 kent return &this->base;
92 1.8 isaki }
93 1.8 isaki
94 1.12 kent static void
95 1.12 kent msm6258_dtor(struct stream_filter *this)
96 1.8 isaki {
97 1.12 kent if (this != NULL)
98 1.17 jmcneill kmem_free(this, sizeof(struct msm6258_codecvar));
99 1.1 minoura }
100 1.1 minoura
101 1.9 isaki /*
102 1.9 isaki * signed 16bit linear PCM -> OkiADPCM
103 1.9 isaki */
104 1.15 perry static inline uint8_t
105 1.12 kent pcm2adpcm_step(struct msm6258_codecvar *mc, int16_t a)
106 1.9 isaki {
107 1.9 isaki int estim = (int)mc->mc_estim;
108 1.9 isaki int df;
109 1.9 isaki short dl, c;
110 1.12 kent uint8_t b;
111 1.12 kent uint8_t s;
112 1.9 isaki
113 1.9 isaki df = a - mc->mc_amp;
114 1.9 isaki dl = adpcm_estim[estim];
115 1.9 isaki c = (df / 16) * 8 / dl;
116 1.9 isaki if (df < 0) {
117 1.9 isaki b = (unsigned char)(-c) / 2;
118 1.9 isaki s = 0x08;
119 1.9 isaki } else {
120 1.9 isaki b = (unsigned char)(c) / 2;
121 1.9 isaki s = 0;
122 1.9 isaki }
123 1.9 isaki if (b > 7)
124 1.9 isaki b = 7;
125 1.9 isaki s |= b;
126 1.9 isaki mc->mc_amp += (short)(adpcm_estimindex[(int)s] * dl);
127 1.9 isaki estim += adpcm_estimstep[b];
128 1.9 isaki if (estim < 0)
129 1.9 isaki estim = 0;
130 1.9 isaki else if (estim > 48)
131 1.9 isaki estim = 48;
132 1.9 isaki
133 1.9 isaki mc->mc_estim = estim;
134 1.9 isaki return s;
135 1.9 isaki }
136 1.9 isaki
137 1.12 kent #define DEFINE_FILTER(name) \
138 1.12 kent static int \
139 1.17 jmcneill name##_fetch_to(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int); \
140 1.12 kent stream_filter_t * \
141 1.12 kent name(struct audio_softc *sc, const audio_params_t *from, \
142 1.12 kent const audio_params_t *to) \
143 1.12 kent { \
144 1.17 jmcneill return msm6258_factory(sc, name##_fetch_to); \
145 1.12 kent } \
146 1.12 kent static int \
147 1.17 jmcneill name##_fetch_to(struct audio_softc *asc, stream_fetcher_t *self, audio_stream_t *dst, int max_used)
148 1.12 kent
149 1.12 kent DEFINE_FILTER(msm6258_slinear16_to_adpcm)
150 1.12 kent {
151 1.12 kent stream_filter_t *this;
152 1.12 kent struct msm6258_codecvar *mc;
153 1.12 kent uint8_t *d;
154 1.12 kent const uint8_t *s;
155 1.12 kent int m, err, enc_src;
156 1.12 kent
157 1.12 kent this = (stream_filter_t *)self;
158 1.12 kent mc = (struct msm6258_codecvar *)self;
159 1.17 jmcneill if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used * 4)))
160 1.12 kent return err;
161 1.12 kent m = dst->end - dst->start;
162 1.12 kent m = min(m, max_used);
163 1.12 kent d = dst->inp;
164 1.12 kent s = this->src->outp;
165 1.12 kent enc_src = this->src->param.encoding;
166 1.12 kent if (enc_src == AUDIO_ENCODING_SLINEAR_LE) {
167 1.12 kent while (dst->used < m && this->src->used >= 4) {
168 1.12 kent uint8_t f;
169 1.12 kent int16_t ss;
170 1.12 kent #if BYTE_ORDER == LITTLE_ENDIAN
171 1.13 he ss = *(const int16_t*)s;
172 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
173 1.12 kent f = pcm2adpcm_step(mc, ss);
174 1.13 he ss = *(const int16_t*)s;
175 1.12 kent #else
176 1.12 kent ss = (s[1] << 8) | s[0];
177 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
178 1.12 kent f = pcm2adpcm_step(mc, ss);
179 1.12 kent ss = (s[1] << 8) | s[0];
180 1.12 kent #endif
181 1.12 kent f |= pcm2adpcm_step(mc, ss) << 4;
182 1.12 kent *d = f;
183 1.12 kent d = audio_stream_add_inp(dst, d, 1);
184 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
185 1.12 kent }
186 1.18 isaki } else if (enc_src == AUDIO_ENCODING_SLINEAR_BE) {
187 1.12 kent while (dst->used < m && this->src->used >= 4) {
188 1.12 kent uint8_t f;
189 1.12 kent int16_t ss;
190 1.9 isaki #if BYTE_ORDER == BIG_ENDIAN
191 1.13 he ss = *(const int16_t*)s;
192 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
193 1.12 kent f = pcm2adpcm_step(mc, ss);
194 1.13 he ss = *(const int16_t*)s;
195 1.12 kent #else
196 1.12 kent ss = (s[0] << 8) | s[1];
197 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
198 1.12 kent f = pcm2adpcm_step(mc, ss);
199 1.12 kent ss = (s[0] << 8) | s[1];
200 1.9 isaki #endif
201 1.12 kent f |= pcm2adpcm_step(mc, ss) << 4;
202 1.12 kent *d = f;
203 1.12 kent d = audio_stream_add_inp(dst, d, 1);
204 1.12 kent s = audio_stream_add_outp(this->src, s, 2);
205 1.12 kent }
206 1.20 isaki } else {
207 1.18 isaki #if defined(DIAGNOSTIC)
208 1.18 isaki panic("msm6258_slinear16_to_adpcm: unsupported enc_src(%d)", enc_src);
209 1.20 isaki #endif
210 1.20 isaki /* dummy run */
211 1.20 isaki while (dst->used < m && this->src->used >= 4) {
212 1.20 isaki s = audio_stream_add_outp(this->src, s, 2);
213 1.20 isaki s = audio_stream_add_outp(this->src, s, 2);
214 1.20 isaki *d = buzzer++;
215 1.20 isaki d = audio_stream_add_inp(dst, d, 1);
216 1.20 isaki }
217 1.18 isaki }
218 1.12 kent dst->inp = d;
219 1.12 kent this->src->outp = s;
220 1.12 kent return 0;
221 1.9 isaki }
222 1.1 minoura
223 1.12 kent DEFINE_FILTER(msm6258_linear8_to_adpcm)
224 1.9 isaki {
225 1.12 kent stream_filter_t *this;
226 1.12 kent struct msm6258_codecvar *mc;
227 1.12 kent uint8_t *d;
228 1.12 kent const uint8_t *s;
229 1.12 kent int m, err, enc_src;
230 1.12 kent
231 1.12 kent this = (stream_filter_t *)self;
232 1.12 kent mc = (struct msm6258_codecvar *)self;
233 1.17 jmcneill if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used * 2)))
234 1.12 kent return err;
235 1.12 kent m = dst->end - dst->start;
236 1.12 kent m = min(m, max_used);
237 1.12 kent d = dst->inp;
238 1.12 kent s = this->src->outp;
239 1.12 kent enc_src = this->src->param.encoding;
240 1.19 isaki if (enc_src == AUDIO_ENCODING_SLINEAR_LE
241 1.19 isaki || enc_src == AUDIO_ENCODING_SLINEAR_BE) {
242 1.12 kent while (dst->used < m && this->src->used >= 4) {
243 1.12 kent uint8_t f;
244 1.12 kent int16_t ss;
245 1.12 kent ss = ((int16_t)s[0]) * 256;
246 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
247 1.12 kent f = pcm2adpcm_step(mc, ss);
248 1.12 kent ss = ((int16_t)s[0]) * 256;
249 1.12 kent f |= pcm2adpcm_step(mc, ss) << 4;
250 1.12 kent *d = f;
251 1.12 kent d = audio_stream_add_inp(dst, d, 1);
252 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
253 1.12 kent }
254 1.19 isaki } else if (enc_src == AUDIO_ENCODING_ULINEAR_LE
255 1.19 isaki || enc_src == AUDIO_ENCODING_ULINEAR_BE) {
256 1.12 kent while (dst->used < m && this->src->used >= 4) {
257 1.12 kent uint8_t f;
258 1.12 kent int16_t ss;
259 1.12 kent ss = ((int16_t)(s[0] ^ 0x80)) * 256;
260 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
261 1.12 kent f = pcm2adpcm_step(mc, ss);
262 1.12 kent ss = ((int16_t)(s[0] ^ 0x80)) * 256;
263 1.12 kent f |= pcm2adpcm_step(mc, ss) << 4;
264 1.12 kent *d = f;
265 1.12 kent d = audio_stream_add_inp(dst, d, 1);
266 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
267 1.12 kent }
268 1.20 isaki } else {
269 1.18 isaki #if defined(DIAGNOSTIC)
270 1.18 isaki panic("msm6258_linear8_to_adpcm: unsupported enc_src(%d)", enc_src);
271 1.20 isaki #endif
272 1.20 isaki /* dummy run */
273 1.20 isaki while (dst->used < m && this->src->used >= 4) {
274 1.20 isaki s = audio_stream_add_outp(this->src, s, 1);
275 1.20 isaki s = audio_stream_add_outp(this->src, s, 1);
276 1.20 isaki *d = buzzer++;
277 1.20 isaki d = audio_stream_add_inp(dst, d, 1);
278 1.20 isaki }
279 1.18 isaki }
280 1.12 kent dst->inp = d;
281 1.12 kent this->src->outp = s;
282 1.12 kent return 0;
283 1.1 minoura }
284 1.1 minoura
285 1.9 isaki /*
286 1.9 isaki * OkiADPCM -> signed 16bit linear PCM
287 1.9 isaki */
288 1.15 perry static inline int16_t
289 1.12 kent adpcm2pcm_step(struct msm6258_codecvar *mc, uint8_t b)
290 1.1 minoura {
291 1.9 isaki int estim = (int)mc->mc_estim;
292 1.7 isaki
293 1.9 isaki mc->mc_amp += adpcm_estim[estim] * adpcm_estimindex[b];
294 1.9 isaki estim += adpcm_estimstep[b];
295 1.7 isaki
296 1.7 isaki if (estim < 0)
297 1.7 isaki estim = 0;
298 1.9 isaki else if (estim > 48)
299 1.7 isaki estim = 48;
300 1.9 isaki
301 1.9 isaki mc->mc_estim = estim;
302 1.9 isaki
303 1.9 isaki return mc->mc_amp;
304 1.1 minoura }
305 1.1 minoura
306 1.12 kent DEFINE_FILTER(msm6258_adpcm_to_slinear16)
307 1.9 isaki {
308 1.12 kent stream_filter_t *this;
309 1.12 kent struct msm6258_codecvar *mc;
310 1.12 kent uint8_t *d;
311 1.12 kent const uint8_t *s;
312 1.12 kent int m, err, enc_dst;
313 1.12 kent
314 1.12 kent this = (stream_filter_t *)self;
315 1.12 kent mc = (struct msm6258_codecvar *)self;
316 1.12 kent max_used = (max_used + 3) & ~3; /* round up multiple of 4 */
317 1.17 jmcneill if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used / 4)))
318 1.12 kent return err;
319 1.12 kent m = (dst->end - dst->start) & ~3;
320 1.12 kent m = min(m, max_used);
321 1.12 kent d = dst->inp;
322 1.12 kent s = this->src->outp;
323 1.12 kent enc_dst = dst->param.encoding;
324 1.12 kent if (enc_dst == AUDIO_ENCODING_SLINEAR_LE) {
325 1.12 kent while (dst->used < m && this->src->used >= 1) {
326 1.12 kent uint8_t a;
327 1.12 kent int16_t s1, s2;
328 1.12 kent a = s[0];
329 1.12 kent s1 = adpcm2pcm_step(mc, a & 0x0f);
330 1.12 kent s2 = adpcm2pcm_step(mc, a >> 4);
331 1.12 kent #if BYTE_ORDER == LITTLE_ENDIAN
332 1.12 kent *(int16_t*)d = s1;
333 1.12 kent d = audio_stream_add_inp(dst, d, 2);
334 1.12 kent *(int16_t*)d = s2;
335 1.12 kent #else
336 1.12 kent d[0] = s1;
337 1.12 kent d[1] = s1 >> 8;
338 1.12 kent d = audio_stream_add_inp(dst, d, 2);
339 1.12 kent d[0] = s2;
340 1.12 kent d[1] = s2 >> 8;
341 1.12 kent #endif
342 1.12 kent d = audio_stream_add_inp(dst, d, 2);
343 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
344 1.12 kent }
345 1.18 isaki } else if (enc_dst == AUDIO_ENCODING_SLINEAR_BE) {
346 1.12 kent while (dst->used < m && this->src->used >= 1) {
347 1.12 kent uint8_t a;
348 1.12 kent int16_t s1, s2;
349 1.12 kent a = s[0];
350 1.12 kent s1 = adpcm2pcm_step(mc, a & 0x0f);
351 1.12 kent s2 = adpcm2pcm_step(mc, a >> 4);
352 1.9 isaki #if BYTE_ORDER == BIG_ENDIAN
353 1.12 kent *(int16_t*)d = s1;
354 1.12 kent d = audio_stream_add_inp(dst, d, 2);
355 1.12 kent *(int16_t*)d = s2;
356 1.12 kent #else
357 1.12 kent d[1] = s1;
358 1.12 kent d[0] = s1 >> 8;
359 1.12 kent d = audio_stream_add_inp(dst, d, 2);
360 1.12 kent d[1] = s2;
361 1.12 kent d[0] = s2 >> 8;
362 1.9 isaki #endif
363 1.12 kent d = audio_stream_add_inp(dst, d, 2);
364 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
365 1.12 kent }
366 1.20 isaki } else {
367 1.18 isaki #if defined(DIAGNOSTIC)
368 1.18 isaki panic("msm6258_adpcm_to_slinear16: unsupported enc_dst(%d)", enc_dst);
369 1.20 isaki #endif
370 1.20 isaki /* dummy run */
371 1.20 isaki while (dst->used < m && this->src->used >= 1) {
372 1.20 isaki *d = buzzer++;
373 1.20 isaki d = audio_stream_add_inp(dst, d, 2);
374 1.20 isaki *d = buzzer++;
375 1.20 isaki d = audio_stream_add_inp(dst, d, 2);
376 1.20 isaki s = audio_stream_add_outp(this->src, s, 1);
377 1.20 isaki }
378 1.18 isaki }
379 1.12 kent dst->inp = d;
380 1.12 kent this->src->outp = s;
381 1.12 kent return 0;
382 1.9 isaki }
383 1.9 isaki
384 1.12 kent DEFINE_FILTER(msm6258_adpcm_to_linear8)
385 1.9 isaki {
386 1.12 kent stream_filter_t *this;
387 1.12 kent struct msm6258_codecvar *mc;
388 1.12 kent uint8_t *d;
389 1.12 kent const uint8_t *s;
390 1.12 kent int m, err, enc_dst;
391 1.12 kent
392 1.12 kent this = (stream_filter_t *)self;
393 1.12 kent mc = (struct msm6258_codecvar *)self;
394 1.12 kent max_used = (max_used + 1) & ~1; /* round up multiple of 4 */
395 1.17 jmcneill if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used / 2)))
396 1.12 kent return err;
397 1.12 kent m = (dst->end - dst->start) & ~1;
398 1.12 kent m = min(m, max_used);
399 1.12 kent d = dst->inp;
400 1.12 kent s = this->src->outp;
401 1.12 kent enc_dst = dst->param.encoding;
402 1.12 kent if (enc_dst == AUDIO_ENCODING_SLINEAR_LE) {
403 1.12 kent while (dst->used < m && this->src->used >= 1) {
404 1.12 kent uint8_t a;
405 1.12 kent int16_t s1, s2;
406 1.12 kent a = s[0];
407 1.12 kent s1 = adpcm2pcm_step(mc, a & 0x0f);
408 1.12 kent s2 = adpcm2pcm_step(mc, a >> 4);
409 1.12 kent d[0] = s1 / 266;
410 1.12 kent d = audio_stream_add_inp(dst, d, 1);
411 1.12 kent d[0] = s2 / 266;
412 1.12 kent d = audio_stream_add_inp(dst, d, 1);
413 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
414 1.12 kent }
415 1.18 isaki } else if (enc_dst == AUDIO_ENCODING_ULINEAR_LE) {
416 1.12 kent while (dst->used < m && this->src->used >= 1) {
417 1.12 kent uint8_t a;
418 1.12 kent int16_t s1, s2;
419 1.12 kent a = s[0];
420 1.12 kent s1 = adpcm2pcm_step(mc, a & 0x0f);
421 1.12 kent s2 = adpcm2pcm_step(mc, a >> 4);
422 1.12 kent d[0] = (s1 / 266) ^ 0x80;
423 1.12 kent d = audio_stream_add_inp(dst, d, 1);
424 1.12 kent d[0] = (s2 / 266) ^ 0x80;
425 1.12 kent d = audio_stream_add_inp(dst, d, 1);
426 1.12 kent s = audio_stream_add_outp(this->src, s, 1);
427 1.12 kent }
428 1.20 isaki } else {
429 1.18 isaki #if defined(DIAGNOSTIC)
430 1.18 isaki panic("msm6258_adpcm_to_linear8: unsupported enc_dst(%d)", enc_dst);
431 1.20 isaki #endif
432 1.20 isaki /* dummy run */
433 1.20 isaki while (dst->used < m && this->src->used >= 1) {
434 1.20 isaki *d = buzzer++;
435 1.20 isaki d = audio_stream_add_inp(dst, d, 1);
436 1.20 isaki *d = buzzer++;
437 1.20 isaki d = audio_stream_add_inp(dst, d, 1);
438 1.20 isaki s = audio_stream_add_outp(this->src, s, 1);
439 1.20 isaki }
440 1.18 isaki }
441 1.12 kent dst->inp = d;
442 1.12 kent this->src->outp = s;
443 1.12 kent return 0;
444 1.1 minoura }
445