summaryrefslogtreecommitdiff
path: root/tonezone.c
diff options
context:
space:
mode:
authorjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-02-15 02:23:25 +0000
committerjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-02-15 02:23:25 +0000
commitf928dbbced084622838fa6c8772833a96c66d960 (patch)
tree60f8453b95e38a5906b40f4bee6f648b7c9d02b1 /tonezone.c
parent7e8d60dcbeef0bbdb1860c4f5bb169c91d34e994 (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-xtonezone.c15
1 files changed, 15 insertions, 0 deletions
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, ",");
@@ -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));