# HG changeset patch # User Mychaela Falconia # Date 1719260142 0 # Node ID 237687e2be6cd77734a3d72cd8f7c4f60bf35c61 # Parent 45411b72b6b3f7d81d496d5d7d4b900ad3d3b349 ater: implement play internals diff -r 45411b72b6b3 -r 237687e2be6c ater/activate.c --- a/ater/activate.c Mon Jun 24 18:56:05 2024 +0000 +++ b/ater/activate.c Mon Jun 24 20:15:42 2024 +0000 @@ -90,4 +90,8 @@ return; } at->is_active = false; + if (at->play_buffer) { + free(at->play_buffer); + at->play_buffer = NULL; + } } diff -r 45411b72b6b3 -r 237687e2be6c ater/submux.h --- a/ater/submux.h Mon Jun 24 18:56:05 2024 +0000 +++ b/ater/submux.h Mon Jun 24 20:15:42 2024 +0000 @@ -22,6 +22,10 @@ bool is_efr; struct osmo_trau_frame ul_frame; unsigned mfrm_count; + uint8_t *play_buffer; + unsigned play_buf_total; + unsigned play_buf_ptr; + bool play_wait_align; }; extern struct ater_subslot subslots[ATER_SUBSLOTS]; diff -r 45411b72b6b3 -r 237687e2be6c ater/tx_func.c --- a/ater/tx_func.c Mon Jun 24 18:56:05 2024 +0000 +++ b/ater/tx_func.c Mon Jun 24 20:15:42 2024 +0000 @@ -12,9 +12,11 @@ #include #include #include +#include #include "globals.h" #include "submux.h" +#include "out_frame.h" void init_trau_ul_frame(int nr) { @@ -28,6 +30,22 @@ memset(fr->t_bits, 1, 4); } +static void handle_play(struct ater_subslot *at) +{ + if (at->play_wait_align) { + if (at->mfrm_count) + return; + at->play_wait_align = false; + } + trau_frame_from_record(at->play_buffer + at->play_buf_ptr * 34, + at->is_efr, &at->ul_frame); + at->play_buf_ptr++; + if (at->play_buf_ptr < at->play_buf_total) + return; + free(at->play_buffer); + at->play_buffer = NULL; +} + static void tx_service_subslot(int nr) { struct ater_subslot *at = &subslots[nr]; @@ -37,6 +55,8 @@ if (!at->is_active) return; + if (at->play_buffer) + handle_play(at); at->mfrm_count++; if (at->mfrm_count >= 24) { at->mfrm_count = 0;