comparison rvinterf/asyncshell/tchplay.c @ 1030:194967e11b2b

fc-shell: tch record and tch play reworked for libgsm-compatible file format
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 31 May 2016 18:39:06 +0000
parents 333015c662bc
children
comparison
equal deleted inserted replaced
1029:333015c662bc 1030:194967e11b2b
29 29
30 static void 30 static void
31 fill_uplink(msgout) 31 fill_uplink(msgout)
32 void (*msgout)(); 32 void (*msgout)();
33 { 33 {
34 u_char sendpkt[35]; 34 u_char readbytes[33], sendpkt[35];
35 int cc; 35 int cc;
36 36
37 sendpkt[0] = RVT_TCH_HEADER; 37 sendpkt[0] = RVT_TCH_HEADER;
38 sendpkt[1] = TCH_ULBITS_REQ; 38 sendpkt[1] = TCH_ULBITS_REQ;
39 while (queued_frames < QUEUE_LIMIT) { 39 while (queued_frames < QUEUE_LIMIT) {
40 cc = fread(sendpkt + 2, 1, 33, gsm_data_file); 40 cc = fread(readbytes, 1, 33, gsm_data_file);
41 if (cc < 33) { 41 if (cc < 33) {
42 if (cc) 42 if (cc)
43 msgout("TCH UL: extra bytes at the end of the file"); 43 msgout("TCH UL: extra bytes at the end of the file");
44 msgout("TCH UL: file play finished"); 44 msgout("TCH UL: file play finished");
45 gsm_data_file = 0; 45 gsm_data_file = 0;
46 return; 46 return;
47 } 47 }
48 if ((readbytes[0] & 0xF0) != 0xD0) {
49 msgout("TCH UL: bad file input, play aborted");
50 gsm_data_file = 0;
51 return;
52 }
53 gsm0610_libgsm_to_tidsp(readbytes, sendpkt + 2);
48 send_pkt_to_target(sendpkt, 35); 54 send_pkt_to_target(sendpkt, 35);
49 queued_frames++; 55 queued_frames++;
50 } 56 }
51 } 57 }
52 58