aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilien Cuony <maximilien@theglu.org>2015-12-09 20:45:21 +0100
committerMaximilien Cuony <maximilien@theglu.org>2015-12-09 20:45:21 +0100
commite33c264e29859bd4311faef25394bd8d6058d4be (patch)
treeee8807a8086cdebfac8761c197d425cb7d6630f3 /src
parentd02e071181e635ecf224350aa13eb120e30e36e5 (diff)
downloadglutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.tar.gz
glutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.tar.bz2
glutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.zip
Less glitches in tutuages
Diffstat (limited to 'src')
-rw-r--r--src/cw-example/cw.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/cw-example/cw.c b/src/cw-example/cw.c
index 1e42469..a54a3ea 100644
--- a/src/cw-example/cw.c
+++ b/src/cw-example/cw.c
@@ -237,6 +237,7 @@ static void cw_task(void *pvParameters)
struct cw_out_message_s cw_fill_msg_current;
float nco_phase = 0.0f;
+ float ampl = 0.0f;
int buf_pos = 0;
@@ -251,8 +252,6 @@ static void cw_task(void *pvParameters)
const float omega = 2.0f * FLOAT_PI * cw_fill_msg_current.freq /
(float)cw_samplerate;
- float ampl = 0.0f;
-
for (int i = 0; i < cw_fill_msg_current.on_buffer_end; i++) {
for (int t = 0; t < samples_per_dit; t++) {
int16_t s = 0;
@@ -260,10 +259,10 @@ static void cw_task(void *pvParameters)
// Remove clicks from CW
if (cw_fill_msg_current.on_buffer[i]) {
const float remaining = 32768.0f - ampl;
- ampl += remaining / 16.0f;
+ ampl += remaining / 64.0f;
}
else {
- ampl *= 0.8f;
+ ampl -= ampl / 64.0f;
}
nco_phase += omega;