FreeCalypso > hg > ice1-trau-tester
comparison ater/play_cmd.c @ 29:1dda11905e85
ater: implement play-stop command
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jun 2024 20:42:23 +0000 |
parents | 2742dbea95f1 |
children | 16715bd149e0 |
comparison
equal
deleted
inserted
replaced
28:fa341317c844 | 29:1dda11905e85 |
---|---|
40 if (rc < 0) | 40 if (rc < 0) |
41 return; /* error msg already printed */ | 41 return; /* error msg already printed */ |
42 at->play_buf_ptr = 0; | 42 at->play_buf_ptr = 0; |
43 at->play_wait_align = true; | 43 at->play_wait_align = true; |
44 } | 44 } |
45 | |
46 void cmd_play_stop(int argc, char **argv) | |
47 { | |
48 int nr; | |
49 struct ater_subslot *at; | |
50 | |
51 if (argc != 2) { | |
52 usage: fprintf(stderr, "usage: %s 0|1|2|3\n", argv[0]); | |
53 return; | |
54 } | |
55 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) | |
56 goto usage; | |
57 nr = argv[1][0] - '0'; | |
58 at = &subslots[nr]; | |
59 if (!at->is_active) { | |
60 fprintf(stderr, "error: subslot %d is not active\n", nr); | |
61 return; | |
62 } | |
63 if (!at->play_buffer) { | |
64 fprintf(stderr, "error: no file play in progress\n"); | |
65 return; | |
66 } | |
67 free(at->play_buffer); | |
68 at->play_buffer = NULL; | |
69 } |