diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /lib/decode_msk144.f90 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'lib/decode_msk144.f90')
| -rw-r--r-- | lib/decode_msk144.f90 | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/lib/decode_msk144.f90 b/lib/decode_msk144.f90 index 17110cf4..513cc342 100644 --- a/lib/decode_msk144.f90 +++ b/lib/decode_msk144.f90 @@ -1,4 +1,8 @@ -subroutine decode_msk144(audio_samples, params, data_dir) +subroutine decode_msk144_core(audio_samples, params, data_dir, completion) + use streaming_emit, only: streaming_emit_enabled, & + streaming_emit_decode + use decode_completion_module, only: decode_completion_result, & + reset_decode_completion, set_decode_completion include 'jt9com.f90' ! constants @@ -11,6 +15,7 @@ subroutine decode_msk144(audio_samples, params, data_dir) integer*2 audio_samples(NMAX) type(params_block) :: params character(len = 500) :: data_dir + type(decode_completion_result), intent(out) :: completion ! parameters of mskrtd integer*2 :: buffer(BLOCK_SIZE) @@ -26,7 +31,10 @@ subroutine decode_msk144(audio_samples, params, data_dir) ! local variables integer :: sample_count integer :: position - integer :: message_count = 0 + integer :: message_count + + call reset_decode_completion(completion) + message_count = 0 ! decode in 0.3s blocks @@ -43,15 +51,60 @@ subroutine decode_msk144(audio_samples, params, data_dir) if (line(1:1) .ne. char(0)) then line = line(1:index(line, char(0))-1) - write(*, 1001) line + if (streaming_emit_enabled()) then + call emit_msk144_line(line) + else + write(*, 1001) line + end if 1001 format(a80) message_count = message_count + 1; end if end do - if (.not. params%ndiskdat) then - write(*, 1002) 0, message_count, 0 - 1002 format('<DecodeFinished>', 2i4, i9) - end if + call set_decode_completion(completion, 0, message_count, 0) + +contains + + ! Parse the 80-char mskrtd line and emit it as NDJSON. mskrtd's format + ! mirrors the FT8/FT4/Q65 emit shape: + ! cols 1-6: HHMMSS (i6.6) + ! cols 7-10: snr (i4) + ! cols 11-15: dt (f5.1) + ! cols 16-20: freq (i5) + ! col 22: '&' (mode separator) + ! cols 24-60: message (a37, trimmed) + subroutine emit_msk144_line(line_in) + character(len=*), intent(in) :: line_in + integer :: nutc_l, snr_l, freq_l, ios_l + real :: dt_l + character(len=37) :: msg_l + read(line_in, '(i6,i4,f5.1,i5,1x,1x,1x,a37)', & + iostat=ios_l) nutc_l, snr_l, dt_l, freq_l, msg_l + if (ios_l /= 0) return ! parse failure: silently drop + call streaming_emit_decode("MSK144", nutc_l, snr_l, dt_l, freq_l, & + adjustl(msg_l)) + end subroutine emit_msk144_line + +end subroutine decode_msk144_core + +subroutine decode_msk144(audio_samples, params, data_dir) + use streaming_emit, only: streaming_emit_enabled, & + streaming_emit_decode_finished + use decode_completion_module, only: decode_completion_result, & + write_decode_completion -end subroutine decode_msk144
\ No newline at end of file + include 'jt9com.f90' + + integer*2 audio_samples(NMAX) + type(params_block) :: params + character(len = 500) :: data_dir + type(decode_completion_result) :: completion + + call decode_msk144_core(audio_samples, params, data_dir, completion) + if (streaming_emit_enabled()) then + call streaming_emit_decode_finished(params%nutc) + else if (.not. params%ndiskdat) then + call write_decode_completion(completion) + call flush(6) + end if +end subroutine decode_msk144 |
