FreeCalypso > hg > ice1-trau-tester
changeset 12:27ca01bb5b11
pcm: implement play-stop command
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 23 Jun 2024 20:06:09 +0000 |
parents | e149ca1dd14f |
children | 949cfb0bf403 |
files | pcm/globals.h pcm/pcm_tx.c pcm/user_cmd.c |
diffstat | 3 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pcm/globals.h Sun Jun 23 19:59:17 2024 +0000 +++ b/pcm/globals.h Sun Jun 23 20:06:09 2024 +0000 @@ -19,3 +19,4 @@ void cmd_dmw_off(int argc, char **argv); void cmd_play_file(int argc, char **argv); void cmd_play_offset(int argc, char **argv); +void cmd_play_stop(int argc, char **argv);
--- a/pcm/pcm_tx.c Sun Jun 23 19:59:17 2024 +0000 +++ b/pcm/pcm_tx.c Sun Jun 23 20:06:09 2024 +0000 @@ -194,3 +194,13 @@ play_buf_nframes = st.st_size / 160 + 1; play_buf_ptr = 0; } + +void cmd_play_stop(int argc, char **argv) +{ + if (!record_file) { + printf("error: no file play in progress\n"); + return; + } + free(play_buffer); + play_buffer = NULL; +}
--- a/pcm/user_cmd.c Sun Jun 23 19:59:17 2024 +0000 +++ b/pcm/user_cmd.c Sun Jun 23 20:06:09 2024 +0000 @@ -22,6 +22,7 @@ {"pcm-fill", cmd_pcm_fill}, {"play", cmd_play_file}, {"play-offset", cmd_play_offset}, + {"play-stop", cmd_play_stop}, {"print-rx", cmd_print_rx}, {"record", cmd_record_start}, {"record-stop", cmd_record_stop},