diff options
author | Maximilien Cuony <maximilien@theglu.org> | 2015-12-09 20:45:21 +0100 |
---|---|---|
committer | Maximilien Cuony <maximilien@theglu.org> | 2015-12-09 20:45:21 +0100 |
commit | e33c264e29859bd4311faef25394bd8d6058d4be (patch) | |
tree | ee8807a8086cdebfac8761c197d425cb7d6630f3 | |
parent | d02e071181e635ecf224350aa13eb120e30e36e5 (diff) | |
download | glutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.tar.gz glutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.tar.bz2 glutte-o-matic-e33c264e29859bd4311faef25394bd8d6058d4be.zip |
Less glitches in tutuages
-rw-r--r-- | src/cw-example/cw.c | 7 |
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; |