From f928dbbced084622838fa6c8772833a96c66d960 Mon Sep 17 00:00:00 2001 From: jim Date: Sun, 15 Feb 2004 02:23:25 +0000 Subject: Added support for modulation (not just two tone addition) in tonezones git-svn-id: http://svn.digium.com/svn/zaptel/trunk@313 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- tonezone.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tonezone.c') diff --git a/tonezone.c b/tonezone.c index f70f9f4..c0aa66d 100755 --- a/tonezone.c +++ b/tonezone.c @@ -70,6 +70,7 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun int firstnobang = -1; int freq1, freq2, time; int used = 0; + int modulate = 0; float gain; dup = strdup(t->data); s = strtok(dup, ","); @@ -87,10 +88,22 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun /* f1+f2/time format */ #if 0 printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); +#endif + } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) { + /* f1*f2/time format */ + modulate = 1; +#if 0 + printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); #endif } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) { #if 0 printf("f1+f2 format: %d, %d\n", freq1, freq2); +#endif + time = 0; + } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) { + modulate = 1; +#if 0 + printf("f1+f2 format: %d, %d\n", freq1, freq2); #endif time = 0; } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) { @@ -129,6 +142,8 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun td->init_v2_2 = sin(-4.0 * M_PI * (freq2 / 8000.0)) * gain; td->init_v3_2 = sin(-2.0 * M_PI * (freq2 / 8000.0)) * gain; + td->modulate = modulate; + data += (sizeof(struct zt_tone_def)); used += (sizeof(struct zt_tone_def)); size -= (sizeof(struct zt_tone_def)); -- cgit v1.2.3