annotate ringtools/imy/main.c @ 960:411d1cc14326

sms-pdu-decode family: prepare for SC address becoming optional
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 04 Aug 2023 23:09:12 +0000
parents fd4c9bc7835d
children a96cb97b66a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
882
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This file contains the top-level code for fc-imy2pwt.
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "sizelimits.h"
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 char *imy_filename;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char melody_str_buf[MELODY_BUF_SIZE];
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 unsigned beats_per_min = 120;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 unsigned tdma_durations[6][4];
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 FILE *outF;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 main(argc, argv)
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char **argv;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (argc < 2 || argc > 3) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 fprintf(stderr, "usage: %s imy-file [outfile]\n", argv[0]);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 exit(1);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 imy_filename = argv[1];
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 read_imy_firstpass();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 compute_note_durations();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 if (argc > 2) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 outF = fopen(argv[2], "w");
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (!outF) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 perror(argv[2]);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 exit(1);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 } else
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 outF = stdout;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 melody_convert_pass();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 exit(0);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }