Return to dsp.c CVS log | Up to [local] / src / usr.bin / sndiod |
version 1.4, 2014/02/08 15:16:17 | version 1.5, 2014/03/05 20:06:05 | ||
---|---|---|---|
|
|
||
} | } | ||
#endif | #endif | ||
} | } | ||
/* | |||
* produce a square tone, for instance with: | |||
* | |||
* period = round / (220 * round / rate) | |||
*/ | |||
int | |||
sqrtone(int ctx, adata_t *out, int period, int vol, int todo) | |||
{ | |||
int i; | |||
for (i = todo; i > 0; i--) { | |||
if (ctx == 0) { | |||
vol = -vol; | |||
ctx = period / 2; | |||
} | |||
ctx--; | |||
*(out++) += vol; | |||
} | |||
return ctx; | |||
} |