diff options
author | jim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-02-15 02:23:25 +0000 |
---|---|---|
committer | jim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-02-15 02:23:25 +0000 |
commit | f928dbbced084622838fa6c8772833a96c66d960 (patch) | |
tree | 60f8453b95e38a5906b40f4bee6f648b7c9d02b1 /tonezone.c | |
parent | 7e8d60dcbeef0bbdb1860c4f5bb169c91d34e994 (diff) |
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
Diffstat (limited to 'tonezone.c')
-rwxr-xr-x | tonezone.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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, ","); @@ -88,11 +89,23 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun #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) { #if 0 printf("f1/time format: %d, %d\n", freq1, time); @@ -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)); |