summaryrefslogtreecommitdiff
path: root/zaptel.h
diff options
context:
space:
mode:
Diffstat (limited to 'zaptel.h')
-rwxr-xr-xzaptel.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/zaptel.h b/zaptel.h
index a45b561..aa42374 100755
--- a/zaptel.h
+++ b/zaptel.h
@@ -641,7 +641,7 @@ struct zt_tone_def { /* Structure for zone programming */
int fac2;
int init_v2_2;
int init_v3_2;
-
+ int modulate;
};
@@ -842,6 +842,7 @@ struct zt_tone_state {
int v1_2;
int v2_2;
int v3_2;
+ int modulate;
};
#ifdef CONFIG_ZAPATA_NET
@@ -1322,12 +1323,16 @@ struct zt_tone {
int tonesamples; /* How long to play this tone before
going to the next (in samples) */
struct zt_tone *next; /* Next tone in this sequence */
+
+ int modulate;
};
static inline short zt_tone_nextsample(struct zt_tone_state *ts, struct zt_tone *zt)
{
/* follow the curves, return the sum */
+ int p;
+
ts->v1_1 = ts->v2_1;
ts->v2_1 = ts->v3_1;
ts->v3_1 = (zt->fac1 * ts->v2_1 >> 15) - ts->v1_1;
@@ -1337,7 +1342,13 @@ static inline short zt_tone_nextsample(struct zt_tone_state *ts, struct zt_tone
ts->v3_2 = (zt->fac2 * ts->v2_2 >> 15) - ts->v1_2;
/* Return top 16 bits */
- return ts->v3_1 + ts->v3_2;
+ if (!ts->modulate) return ts->v3_1 + ts->v3_2;
+ /* we are modulating */
+ p = ts->v3_2 - 32768;
+ if (p < 0) p = -p;
+ p = ((p * 9) / 10) + 1;
+ return (ts->v3_1 * p) >> 15;
+
}
static inline short zt_txtone_nextsample(struct zt_chan *ss)