FreeCalypso > hg > ice1-trau-tester
changeset 26:237687e2be6c
ater: implement play internals
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jun 2024 20:15:42 +0000 |
parents | 45411b72b6b3 |
children | 2742dbea95f1 |
files | ater/activate.c ater/submux.h ater/tx_func.c |
diffstat | 3 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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; + } }
--- 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];
--- 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 <osmocom/core/msgb.h> #include <osmocom/core/select.h> #include <osmocom/isdn/i460_mux.h> +#include <osmocom/trau/trau_frame.h> #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;