aboutsummaryrefslogtreecommitdiffstats
path: root/src/libam/am.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2019-12-05 21:57:23 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2019-12-08 17:26:47 +0100
commit4af2dca10dc4fb15eb5731bfba25b407a272f63b (patch)
tree01cc84fe1d1ea08329261b8b25bb8a65a5855a51 /src/libam/am.c
parent150a77b69d7a91a300540606b4eccf382e0caf08 (diff)
Add power control to AM (power on/off per sample)
Diffstat (limited to 'src/libam/am.c')
-rw-r--r--src/libam/am.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libam/am.c b/src/libam/am.c
index d5c50b6..7194b49 100644
--- a/src/libam/am.c
+++ b/src/libam/am.c
@@ -91,7 +91,7 @@ void am_mod_exit(am_mod_t __attribute__((unused)) *mod)
{
}
-void am_modulate_complex(am_mod_t *mod, sample_t *amplitude, int num, float *baseband)
+void am_modulate_complex(am_mod_t *mod, sample_t *amplitude, uint8_t *power, int num, float *baseband)
{
int s;
double vector;
@@ -101,7 +101,10 @@ void am_modulate_complex(am_mod_t *mod, sample_t *amplitude, int num, float *bas
double bias = mod->bias;
for (s = 0; s < num; s++) {
- vector = *amplitude++ * gain + bias;
+ if (*power++)
+ vector = *amplitude++ * gain + bias;
+ else
+ vector = 0.0;
if (fast_math) {
*baseband++ += cos_tab[(uint16_t)phase] * vector;
*baseband++ += sin_tab[(uint16_t)phase] * vector;