comparison test-voice/user_cmd.c @ 14:f96153d15889

sipout-test-voice: implement play from file
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 May 2024 22:10:38 -0800
parents 059b79c9f0c3
children 71f01a834820
comparison
equal deleted inserted replaced
13:059b79c9f0c3 14:f96153d15889
29 fprintf(stderr, 29 fprintf(stderr,
30 "error: pcm-fill octet argument out of range\n"); 30 "error: pcm-fill octet argument out of range\n");
31 return; 31 return;
32 } 32 }
33 set_pcm_fill_octet(octet); 33 set_pcm_fill_octet(octet);
34 }
35
36 static void
37 play_file_cmd(args)
38 char *args;
39 {
40 char *cp, *filename;
41 int loop;
42
43 for (cp = args; isspace(*cp); cp++)
44 ;
45 if (!*cp) {
46 inv_syntax: fprintf(stderr, "error: play-file command invalid syntax\n");
47 return;
48 }
49 for (filename = cp; *cp && !isspace(*cp); cp++)
50 ;
51 if (*cp) {
52 *cp++ = '\0';
53 while (isspace(*cp))
54 cp++;
55 if (strcmp(cp, "loop"))
56 goto inv_syntax;
57 loop = 1;
58 } else
59 loop = 0;
60 play_file_cmdop(filename, loop);
34 } 61 }
35 62
36 static void 63 static void
37 tfo_req_cmd(args) 64 tfo_req_cmd(args)
38 char *args; 65 char *args;
95 pcm_fill_cmd(cp + 9); 122 pcm_fill_cmd(cp + 9);
96 else if (!strcmp(cp, "dmw-on")) 123 else if (!strcmp(cp, "dmw-on"))
97 cmd_dmw_on(); 124 cmd_dmw_on();
98 else if (!strcmp(cp, "dmw-off")) 125 else if (!strcmp(cp, "dmw-off"))
99 cmd_dmw_off(); 126 cmd_dmw_off();
127 else if (!strncmp(cp, "play-file", 9) && isspace(cp[9]))
128 play_file_cmd(cp + 10);
129 else if (!strcmp(cp, "play-stop"))
130 play_file_stop();
100 else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7])) 131 else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7]))
101 tfo_req_cmd(cp + 8); 132 tfo_req_cmd(cp + 8);
102 else if (!strcmp(cp, "tfo-stop")) 133 else if (!strcmp(cp, "tfo-stop"))
103 stop_tfo_out(); 134 stop_tfo_out();
104 else 135 else