Index: asterisk.c =================================================================== RCS file: /usr/cvsroot/asterisk/asterisk.c,v retrieving revision 1.183 diff -u -r1.183 asterisk.c --- asterisk.c 29 Sep 2005 02:38:24 -0000 1.183 +++ asterisk.c 4 Oct 2005 23:33:04 -0000 @@ -2153,6 +2153,10 @@ exit(1); } ast_rtp_init(); + if (init_indications()) { + printf(term_quit()); + exit(1); + } if (ast_image_init()) { printf(term_quit()); exit(1); Index: indications.c =================================================================== RCS file: /usr/cvsroot/asterisk/indications.c,v retrieving revision 1.28 diff -u -r1.28 indications.c --- indications.c 14 Sep 2005 20:46:49 -0000 1.28 +++ indications.c 4 Oct 2005 23:33:04 -0000 @@ -88,6 +88,19 @@ short data[4000]; }; +#define SINE_TABLE_SIZE 8000 +#define SINE_TABLE_BITS ((sizeof(short) * 8)-1) +#define SINE_TABLE_MAX ((1 << (SINE_TABLE_BITS-1))-1) +static short sine_table[SINE_TABLE_SIZE]; + +static void fill_sine_table(void) +{ + unsigned i; + float dx = 2*M_PI/SINE_TABLE_SIZE; + for (i=0;imodulate) /* Modulate 1st tone with 2nd, to 90% modulation depth */ - ps->data[x] = ps->vol * 2 * ( - sin((pi->freq1 * 2.0 * M_PI / 8000.0) * (ps->pos + x)) * - (0.9 * fabs(sin((pi->freq2 * 2.0 * M_PI / 8000.0) * (ps->pos + x))) + 0.1) - ); + ps->data[x] = ((long) (ps->vol*2) * ( + sine_table[((pi->freq1) * (ps->pos + x)) % SINE_TABLE_SIZE] * + ((long) 9*abs(sine_table[((pi->freq2) * (ps->pos + x)) % SINE_TABLE_SIZE])/10 + SINE_TABLE_MAX/10) + ))>>SINE_TABLE_BITS; else /* Add 2 tones together */ - ps->data[x] = ps->vol * ( - sin((pi->freq1 * 2.0 * M_PI / 8000.0) * (ps->pos + x)) + - sin((pi->freq2 * 2.0 * M_PI / 8000.0) * (ps->pos + x)) - ); + ps->data[x] = ((long) ps->vol * ( + (long) sine_table[(pi->freq1 * (ps->pos + x)) % SINE_TABLE_SIZE] + + sine_table[(pi->freq2 * (ps->pos + x)) % SINE_TABLE_SIZE] + ))>>SINE_TABLE_BITS; } ps->f.frametype = AST_FRAME_VOICE; ps->f.subclass = AST_FORMAT_SLINEAR; @@ -577,3 +590,9 @@ ast_mutex_unlock(&tzlock); return res; } + +int init_indications(void) +{ + fill_sine_table(); + return 0; +} Index: include/asterisk.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk.h,v retrieving revision 1.10 diff -u -r1.10 asterisk.h --- include/asterisk.h 23 Aug 2005 01:30:22 -0000 1.10 +++ include/asterisk.h 4 Oct 2005 23:33:04 -0000 @@ -48,6 +48,8 @@ extern void close_logger(void); /* Provided by frame.c */ extern int init_framer(void); +/* Provided by indications.c */ +extern int init_indications(void); /* Provided by logger.c */ extern int reload_logger(int); /* Provided by term.c */