comparison ater/play_cmd.c @ 51:db39e8855f3d

ater: implement play-d144
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 25 Sep 2024 05:53:38 +0000
parents 16715bd149e0
children
comparison
equal deleted inserted replaced
50:6ba4de500532 51:db39e8855f3d
45 return; /* error msg already printed */ 45 return; /* error msg already printed */
46 at->play_buf_ptr = 0; 46 at->play_buf_ptr = 0;
47 at->play_wait_align = true; 47 at->play_wait_align = true;
48 } 48 }
49 49
50 void cmd_play_d144(int argc, char **argv)
51 {
52 int nr, rc;
53 struct ater_subslot *at;
54
55 if (argc != 3) {
56 usage: fprintf(stderr, "usage: %s 0|1|2|3 play-file.bin\n", argv[0]);
57 return;
58 }
59 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1])
60 goto usage;
61 nr = argv[1][0] - '0';
62 at = &subslots[nr];
63 if (!at->is_active) {
64 fprintf(stderr, "error: subslot %d is not active\n", nr);
65 return;
66 }
67 if (!at->is_data_144) {
68 fprintf(stderr, "error: subslot %d is not in D144 mode\n", nr);
69 return;
70 }
71 if (at->play_buffer) {
72 fprintf(stderr, "error: file play already in progress\n");
73 return;
74 }
75 rc = read_binary_file_d144(argv[2], &at->play_buffer,
76 &at->play_buf_total);
77 if (rc < 0)
78 return; /* error msg already printed */
79 at->play_buf_ptr = 0;
80 }
81
50 void cmd_play_stop(int argc, char **argv) 82 void cmd_play_stop(int argc, char **argv)
51 { 83 {
52 int nr; 84 int nr;
53 struct ater_subslot *at; 85 struct ater_subslot *at;
54 86