From 745e8c0f0f13af338e215d0ce6d6a8c446074670 Mon Sep 17 00:00:00 2001 From: AmatCoder Date: Sun, 16 Sep 2018 07:20:34 +0200 Subject: [PATCH] tzx_cass.cpp: 1ms pause is always required Not only when pause from block is greater than zero . Otherwise the last pulse is not terminated properly in some cases. --- src/lib/formats/tzx_cas.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp index d950419361e..fe12640e773 100644 --- a/src/lib/formats/tzx_cas.cpp +++ b/src/lib/formats/tzx_cas.cpp @@ -282,13 +282,15 @@ static int tzx_cas_handle_block( int16_t **buffer, const uint8_t *bytes, int pau } } /* pause */ - if (pause > 0) - { - int start_pause_samples = millisec_to_samplecount(1); - int rest_pause_samples = millisec_to_samplecount(pause - 1); + int start_pause_samples = millisec_to_samplecount(1); - tzx_output_wave(buffer, start_pause_samples); - size += start_pause_samples; + tzx_output_wave(buffer, start_pause_samples); + size += start_pause_samples; + + if (pause > 0) + { + int rest_pause_samples = millisec_to_samplecount(pause - 1); + wave_data = WAVE_LOW; tzx_output_wave(buffer, rest_pause_samples); size += rest_pause_samples;