summaryrefslogtreecommitdiff
path: root/tonezone.c
diff options
context:
space:
mode:
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));